teapot 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dd1292b87cd5db2fadc2379f270574504222ca5865d020c1463c072ddb14e79
4
- data.tar.gz: 9c7a12f5887482e46b896d5a3e77147a28d3563cdf2ec194f489ab064f75d9ef
3
+ metadata.gz: 74fb639fe5cc1f9596048d3a55255d8b9ed534114bb7ac4ce0a337274a93b7ec
4
+ data.tar.gz: ee891bde08844f98b972f76a77ee6427996b5b05de39ac8a0f2ca3891310ee09
5
5
  SHA512:
6
- metadata.gz: 4dfac1b253ce27cd86644dfae4f9b1ee3b8cc43a1436b11022a33a18b17e0ba53bd79deb420b236b9dd7b1d48f5859a5f1d2cfafc223cbc3689801eefc1f20cc
7
- data.tar.gz: 797f3d03946859f2e8c8fefc4a610a3f7bb14d6dad90fdc8063989b7cf1a66524b5608ebeeb7c984455603c8d9a6096be5c0bef74385a4711d326c4bd0af3c13
6
+ metadata.gz: 5061e625c2c4ccdd3a698a829699a62170e0753d95bdeff9ab87790795aa960974fd0955cf4c68df815cbf5e201ac9492b6f9b11e4e2516d64385a34399bb479
7
+ data.tar.gz: 331cd7ab35e021d1720a9426332583bd8141cf79f4a5e63da90bf8d19ef2583eb1afb6338e11242ad7da64241c2c8e265ff2be8fed1c28be9e49d3ac5da60762
@@ -32,7 +32,6 @@ module Teapot
32
32
 
33
33
  options do
34
34
  option '-j/-l/--limit <n>', "Limit the build to <n> concurrent processes.", type: Integer
35
- option '--only', "Only build direct dependencies."
36
35
  option '-c/--continuous', "Run the build graph continually (experimental)."
37
36
  end
38
37
 
@@ -50,23 +49,11 @@ module Teapot
50
49
  end
51
50
 
52
51
  chain = selection.chain
53
-
54
- ordered = chain.ordered
55
-
56
- if @options[:only]
57
- ordered = selection.direct_targets(ordered)
58
- end
52
+ environment = context.configuration.environment
59
53
 
60
54
  controller = ::Build::Controller.new(logger: parent.logger, limit: @options[:limit]) do |controller|
61
- ordered.each do |resolution|
62
- target = resolution.provider
63
-
64
- if target.build
65
- environment = target.environment(selection.configuration, chain)
66
-
67
- controller.add_target(target, environment.flatten, self.argv)
68
- end
69
- end
55
+
56
+ controller.add_chain(chain, self.argv, environment)
70
57
  end
71
58
 
72
59
  walker = nil
@@ -91,7 +78,7 @@ module Teapot
91
78
  end
92
79
  end
93
80
 
94
- return chain, ordered
81
+ return chain
95
82
  end
96
83
 
97
84
  def show_dependencies(walker)
@@ -48,7 +48,7 @@ module Teapot
48
48
  end
49
49
 
50
50
  logger.info "Cloning #{@source} to #{root}...".color(:cyan)
51
- repository = Rugged::Repository.clone_at(@source, root.to_s, credentials: self.method(:credentials))
51
+ _repository = Rugged::Repository.clone_at(@source, root.to_s, credentials: self.method(:credentials))
52
52
 
53
53
  # Fetch the initial packages:
54
54
  Fetch[].invoke(nested)
@@ -52,7 +52,6 @@ module Teapot
52
52
  logger = parent.logger
53
53
  context = parent.context
54
54
 
55
- updated = Set.new
56
55
  selection = context.select
57
56
 
58
57
  packages = selection.configuration.packages
@@ -23,7 +23,7 @@ require 'set'
23
23
 
24
24
  require 'yaml/store'
25
25
 
26
- require_relative 'identity_set'
26
+ require 'build/dependency/set'
27
27
  require_relative 'definition'
28
28
 
29
29
  module Teapot
@@ -40,8 +40,8 @@ module Teapot
40
40
 
41
41
  @options = DEFAULT_OPTIONS.merge(options)
42
42
 
43
- @packages = IdentitySet.new(packages)
44
- @imports = IdentitySet.new
43
+ @packages = Build::Dependency::Set.new(packages)
44
+ @imports = Build::Dependency::Set.new
45
45
 
46
46
  @visibility = :private
47
47
 
@@ -63,6 +63,15 @@ module Teapot
63
63
  super
64
64
  end
65
65
 
66
+ def environment
67
+ configuration = self
68
+
69
+ Build::Environment.new(name: self.name) do
70
+ default build_path configuration.build_path
71
+ default platforms_path configuration.build_path
72
+ end
73
+ end
74
+
66
75
  # Controls how the configuration is exposed in the context.
67
76
  attr :visibility
68
77
 
@@ -148,7 +157,7 @@ module Teapot
148
157
  end
149
158
 
150
159
  # Process all import directives and return a new configuration based on the current configuration. Import directives bring packages and other import directives from the specififed configuration definition.
151
- def traverse(configurations, imported = IdentitySet.new, &block)
160
+ def traverse(configurations, imported = Build::Dependency::Set.new, &block)
152
161
  yield self # Whatever happens here, should ensure that...
153
162
 
154
163
  @imports.each do |import|
@@ -32,7 +32,7 @@ module Teapot
32
32
 
33
33
  @loaded = {}
34
34
 
35
- load_root_package(options) unless options[:load_root] == false
35
+ load_root_package(**options)
36
36
  end
37
37
 
38
38
  attr :root
@@ -102,7 +102,7 @@ module Teapot
102
102
 
103
103
  private
104
104
 
105
- def load_root_package(options)
105
+ def load_root_package(**options)
106
106
  # Load the root package:
107
107
  script = load(root_package)
108
108
 
data/lib/teapot/loader.rb CHANGED
@@ -31,7 +31,7 @@ module Teapot
31
31
  # Version 1.3: Added support for build-dependency library which allows options for `#depends`. The primary use case is private dependencies.
32
32
  # Version 2.0: Generators removed and refactored into build.
33
33
  # Version 2.3: Rework install_prefix -> build_prefix.
34
- LOADER_VERSION = "2.3"
34
+ LOADER_VERSION = "3.0"
35
35
 
36
36
  # Cannot load packages older than this.
37
37
  MINIMUM_LOADER_VERSION = "1.0"
@@ -107,6 +107,8 @@ module Teapot
107
107
 
108
108
  yield target
109
109
 
110
+ target.update_environments!
111
+
110
112
  @defined << target
111
113
  end
112
114
 
data/lib/teapot/target.rb CHANGED
@@ -54,24 +54,22 @@ module Teapot
54
54
  return @build
55
55
  end
56
56
 
57
- # Given a specific configuration, generate the build environment based on this target and it's provision chain.
58
- def environment(configuration, chain)
59
- chain = chain.partial(self)
57
+ def update_environments!
58
+ return unless @build
60
59
 
61
- # Calculate the dependency chain's ordered environments:
62
- environments = chain.provisions.collect do |provision|
63
- Build::Environment.new(&provision.value)
64
- end
65
-
66
- # Merge all the environments together:
67
- environment = Build::Environment.combine(*environments)
68
-
69
- environment.merge do
70
- default build_path configuration.build_path
60
+ self.provisions.each do |key, provision|
61
+ build = @build
62
+ original = provision.value
71
63
 
72
- # TODO deprecated - remove in 3.0
73
- default platforms_path configuration.platforms_path
64
+ wrapper = proc do |*arguments|
65
+ self.instance_exec(*arguments, &original) if original
66
+ self.instance_exec(*arguments, &build) if build
67
+ end
68
+
69
+ provision.value = wrapper
74
70
  end
71
+
72
+ @build = nil
75
73
  end
76
74
  end
77
75
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "2.3.0"
22
+ VERSION = "3.0.0"
23
23
  end
@@ -23,7 +23,7 @@ require 'teapot/context'
23
23
  RSpec.describe Teapot::Target do
24
24
  let(:root) {Build::Files::Path.new(__dir__) + "target_spec"}
25
25
 
26
- it "should generate environment for configuration" do
26
+ it "should generate correct chain for configuration" do
27
27
  context = Teapot::Context.new(root)
28
28
  selection = context.select(["Test/TargetSpec"])
29
29
 
@@ -39,15 +39,6 @@ RSpec.describe Teapot::Target do
39
39
  expect(chain.ordered[1].name).to be == 'Platform/generic'
40
40
  expect(chain.ordered[2].name).to be == 'Test/TargetSpec'
41
41
  expect(chain.ordered[2].provider).to be == target
42
-
43
- environment = target.environment(selection.configuration, chain)
44
- # Environment#to_hash flattens the environment and evaluates all values:
45
- hash = environment.to_hash
46
-
47
- expect(hash[:variant]).to be == 'debug'
48
- expect(hash[:platform_name]).to be == 'generic'
49
-
50
- expect(hash).to include(:buildflags, :linkflags, :build_prefix, :install_prefix, :platforms_path)
51
42
  end
52
43
 
53
44
  it "should match wildcard packages" do
data/teapot.gemspec CHANGED
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency "rugged"
32
32
 
33
- spec.add_dependency "build", "~> 1.1"
34
- spec.add_dependency "build-files", "~> 1.3"
35
- spec.add_dependency "build-dependency", "~> 1.1"
33
+ spec.add_dependency "build", "~> 2.0"
34
+ spec.add_dependency "build-files", "~> 1.4"
35
+ spec.add_dependency "build-dependency", "~> 1.4"
36
36
  spec.add_dependency "build-uri", "~> 1.0"
37
37
  spec.add_dependency "build-text", "~> 1.0"
38
38
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teapot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-05 00:00:00.000000000 Z
11
+ date: 2019-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: build-files
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.3'
75
+ version: '1.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.3'
82
+ version: '1.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: build-dependency
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.1'
89
+ version: '1.4'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.1'
96
+ version: '1.4'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: build-uri
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +224,6 @@ files:
224
224
  - lib/teapot/configuration.rb
225
225
  - lib/teapot/context.rb
226
226
  - lib/teapot/definition.rb
227
- - lib/teapot/identity_set.rb
228
227
  - lib/teapot/loader.rb
229
228
  - lib/teapot/package.rb
230
229
  - lib/teapot/project.rb
@@ -246,7 +245,6 @@ files:
246
245
  - spec/teapot/configuration_spec/teapot.rb
247
246
  - spec/teapot/context_spec.rb
248
247
  - spec/teapot/context_spec/teapot.rb
249
- - spec/teapot/identity_set_spec.rb
250
248
  - spec/teapot/target_spec.rb
251
249
  - spec/teapot/target_spec/teapot.rb
252
250
  - teapot.gemspec
@@ -285,6 +283,5 @@ test_files:
285
283
  - spec/teapot/configuration_spec/teapot.rb
286
284
  - spec/teapot/context_spec.rb
287
285
  - spec/teapot/context_spec/teapot.rb
288
- - spec/teapot/identity_set_spec.rb
289
286
  - spec/teapot/target_spec.rb
290
287
  - spec/teapot/target_spec/teapot.rb
@@ -1,78 +0,0 @@
1
- # Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'forwardable'
22
-
23
- module Teapot
24
- # Very similar to a set but uses a specific callback (defaults to &:name) for object identity.
25
- class IdentitySet
26
- include Enumerable
27
-
28
- def initialize(contents = [])
29
- @table = {}
30
-
31
- contents.each do |object|
32
- add(object)
33
- end
34
- end
35
-
36
- attr :table
37
-
38
- def freeze
39
- @table.freeze
40
-
41
- super
42
- end
43
-
44
- def initialize_dup(other)
45
- @table = other.table.dup
46
- end
47
-
48
- def identity(object)
49
- object.name
50
- end
51
-
52
- def add(object)
53
- @table[identity(object)] = object
54
- end
55
-
56
- alias << add
57
-
58
- def delete(object)
59
- @table.delete(identity(object))
60
- end
61
-
62
- def include?(object)
63
- @table.include?(identity(object))
64
- end
65
-
66
- def each(&block)
67
- @table.each_value(&block)
68
- end
69
-
70
- def slice(names)
71
- names.collect{|name| @table[name]}
72
- end
73
-
74
- extend Forwardable
75
-
76
- def_delegators :@table, :size, :empty?, :clear, :count, :[], :to_s, :inspect
77
- end
78
- end
@@ -1,94 +0,0 @@
1
- # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- require 'teapot/identity_set'
22
-
23
- module Teapot::IdentitySetSpec
24
- describe Teapot::IdentitySet do
25
- NamedObject = Struct.new(:name, :age)
26
-
27
- let(:bob) {NamedObject.new('Bob', 10)}
28
- let(:empty_identity_set) {Teapot::IdentitySet.new}
29
- let(:bob_identity_set) {Teapot::IdentitySet.new([bob])}
30
-
31
- it "should contain named objects" do
32
- expect(bob_identity_set).to be_include bob
33
- end
34
-
35
- it "can enumerate all contained objects" do
36
- expect(bob_identity_set.each.to_a).to be == [bob]
37
- end
38
-
39
- it "could contain items" do
40
- expect(bob_identity_set).to_not be_empty
41
- expect(bob_identity_set.size).to be == 1
42
- end
43
-
44
- it "could be empty" do
45
- expect(empty_identity_set).to be_empty
46
- end
47
-
48
- it "could contain many items" do
49
- identity_set = empty_identity_set
50
-
51
- names = ["Apple", "Orange", "Banana", "Kiwifruit"]
52
-
53
- names.each_with_index do |name, index|
54
- identity_set << NamedObject.new(name, index)
55
- end
56
-
57
- expect(identity_set.size).to be == names.size
58
- end
59
-
60
- it "can be cleared" do
61
- identity_set = bob_identity_set.dup
62
-
63
- expect(identity_set).to_not be_empty
64
-
65
- identity_set.clear
66
-
67
- expect(identity_set).to be_empty
68
- end
69
-
70
- it "can delete items" do
71
- identity_set = bob_identity_set.dup
72
-
73
- expect(identity_set).to_not be_empty
74
-
75
- identity_set.delete(bob)
76
-
77
- expect(identity_set).to be_empty
78
- end
79
-
80
- it "can be frozen" do
81
- empty_identity_set.freeze
82
-
83
- expect(empty_identity_set).to be_frozen
84
- end
85
-
86
- it "can look up named items" do
87
- expect(bob_identity_set[bob.name]).to be == bob
88
- end
89
-
90
- it "should have string representation" do
91
- expect(bob_identity_set.to_s).to be =~ /Bob/
92
- end
93
- end
94
- end