teapot 0.7.2 → 0.7.3
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 +8 -8
- data/bin/teapot +17 -1
- data/lib/teapot/configuration.rb +3 -3
- data/lib/teapot/context.rb +25 -16
- data/lib/teapot/controller/build.rb +3 -29
- data/lib/teapot/controller/clean.rb +2 -4
- data/lib/teapot/controller/create.rb +0 -2
- data/lib/teapot/controller/fetch.rb +1 -2
- data/lib/teapot/controller/generate.rb +1 -3
- data/lib/teapot/controller/list.rb +1 -3
- data/lib/teapot/controller.rb +4 -9
- data/lib/teapot/dependency.rb +23 -6
- data/lib/teapot/substitutions.rb +1 -1
- data/lib/teapot/target.rb +9 -8
- data/lib/teapot/version.rb +1 -1
- data/test/test_dependency.rb +2 -2
- data/test/test_teapot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTYzMjgzYTc0NDJhNWYyMmVjMWM4ZTBkMWUxM2Y4MDgyNmU1OTI4OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDExZGU3NmRmMWMxYjE3MmFlNjY1ZTJkZWUzMmVmZjdlNmRlNjlmYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWRlNzAwY2Y4YjUwYjY5YmFjOTExNmIzN2RlNjFlOWRkNGQ2MzUxZmQ4OWMx
|
10
|
+
MTFmYzcwODUxZTBlNTI2MDkzMDYzZjEwNWYwMjY0NDFjOWY4MDFjMjcyNjNh
|
11
|
+
NjZlOGQ0NzdlYjBjMWIxZTU3MzM4MDdkYzVhNWU0NDZmNDY4ZTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGQxYzFiZGVlNDk1NmZhYTI5NWVlNmFjMjczYjlkYTEyM2VmNGE3YjQ4ZjEx
|
14
|
+
Y2UwM2QwYjMzZWExM2JiY2RiNDIzN2VmNTljZGQyMDUxY2Y3NmZiZDVhODlh
|
15
|
+
YjY0MGM0Y2E0NmZkMzg4ODdhYmYxODlkZjMxNjFmNjk2NGUwNGY=
|
data/bin/teapot
CHANGED
@@ -35,7 +35,7 @@ OPTIONS = Trollop::options do
|
|
35
35
|
opt :only, "Only compiled direct dependencies."
|
36
36
|
opt :in, "Work in the given directory.", :type => :string
|
37
37
|
|
38
|
-
opt :configuration, "Specify a specific build configuration.", :type => :string
|
38
|
+
opt :configuration, "Specify a specific build configuration.", :type => :string
|
39
39
|
end
|
40
40
|
|
41
41
|
def make_controller(root = nil)
|
@@ -109,6 +109,22 @@ time = Benchmark.measure do
|
|
109
109
|
$stderr.puts error.message.color(:red)
|
110
110
|
rescue Teapot::Commands::CommandError => error
|
111
111
|
$stderr.puts error.message.color(:red)
|
112
|
+
rescue Teapot::Dependency::UnresolvedDependencyError => error
|
113
|
+
$stderr.puts "Unresolved dependencies:"
|
114
|
+
|
115
|
+
error.chain.unresolved.each do |(name, parent)|
|
116
|
+
$stderr.puts "#{parent} depends on #{name.inspect}".color(:red)
|
117
|
+
|
118
|
+
conflicts = error.chain.conflicts[name]
|
119
|
+
|
120
|
+
if conflicts
|
121
|
+
conflicts.each do |conflict|
|
122
|
+
$stderr.puts " - provided by #{conflict.inspect}".color(:red)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
$stderr.puts "Cannot continue due to unresolved dependencies!".color(:red)
|
112
128
|
end
|
113
129
|
end
|
114
130
|
|
data/lib/teapot/configuration.rb
CHANGED
@@ -144,10 +144,10 @@ module Teapot
|
|
144
144
|
|
145
145
|
# Enumerate all imports and attempt to resolve the packages:
|
146
146
|
@imports.each do |import|
|
147
|
-
|
147
|
+
named_configuration = @context.configurations[import.name]
|
148
148
|
|
149
|
-
if
|
150
|
-
configuration.append(
|
149
|
+
if named_configuration
|
150
|
+
configuration.append(named_configuration.materialize, import.options)
|
151
151
|
else
|
152
152
|
# It couldn't be resolved...
|
153
153
|
configuration.imports << import
|
data/lib/teapot/context.rb
CHANGED
@@ -55,7 +55,17 @@ module Teapot
|
|
55
55
|
defined = load(root_package)
|
56
56
|
|
57
57
|
# Find the default configuration, if it exists:
|
58
|
+
|
58
59
|
@default_configuration = defined.default_configuration
|
60
|
+
|
61
|
+
if options[:configuration]
|
62
|
+
@configuration = @configurations[options[:configuration]]
|
63
|
+
else
|
64
|
+
@configuration = @default_configuration
|
65
|
+
end
|
66
|
+
|
67
|
+
# Materialize the configuration:
|
68
|
+
@configuration = @configuration.materialize if @configuration
|
59
69
|
end
|
60
70
|
|
61
71
|
attr :root
|
@@ -63,8 +73,16 @@ module Teapot
|
|
63
73
|
|
64
74
|
attr :targets
|
65
75
|
attr :generators
|
76
|
+
|
77
|
+
# All public configurations.
|
66
78
|
attr :configurations
|
67
79
|
|
80
|
+
# The context's primary configuration.
|
81
|
+
attr :configuration
|
82
|
+
|
83
|
+
attr :dependencies
|
84
|
+
attr :selection
|
85
|
+
|
68
86
|
def select(names)
|
69
87
|
names.each do |name|
|
70
88
|
if @targets.key? name
|
@@ -75,8 +93,13 @@ module Teapot
|
|
75
93
|
end
|
76
94
|
end
|
77
95
|
|
78
|
-
|
79
|
-
|
96
|
+
def dependency_chain(dependency_names, configuration = @configuration)
|
97
|
+
configuration.load_all
|
98
|
+
|
99
|
+
select(dependency_names)
|
100
|
+
|
101
|
+
Dependency::chain(@selection, @dependencies, @targets.values)
|
102
|
+
end
|
80
103
|
|
81
104
|
def direct_targets(ordered)
|
82
105
|
@dependencies.collect do |dependency|
|
@@ -125,20 +148,6 @@ module Teapot
|
|
125
148
|
end
|
126
149
|
end
|
127
150
|
|
128
|
-
attr :default_configuration
|
129
|
-
|
130
|
-
def configuration_named(name)
|
131
|
-
if name == DEFAULT_CONFIGURATION_NAME
|
132
|
-
configuration = @default_configuration
|
133
|
-
else
|
134
|
-
configuration = @configurations[name]
|
135
|
-
end
|
136
|
-
|
137
|
-
if configuration
|
138
|
-
configuration.materialize
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
151
|
def unresolved(packages)
|
143
152
|
failed_to_load = Set.new
|
144
153
|
|
@@ -22,35 +22,9 @@ require 'teapot/controller'
|
|
22
22
|
|
23
23
|
module Teapot
|
24
24
|
class Controller
|
25
|
-
def build(
|
26
|
-
context, configuration
|
25
|
+
def build(dependency_names)
|
26
|
+
chain = context.dependency_chain(dependency_names, context.configuration)
|
27
27
|
|
28
|
-
configuration.load_all
|
29
|
-
|
30
|
-
context.select(package_names)
|
31
|
-
|
32
|
-
chain = Dependency::chain(context.selection, context.dependencies, context.targets.values)
|
33
|
-
|
34
|
-
if chain.unresolved.size > 0
|
35
|
-
log "Unresolved dependencies:"
|
36
|
-
|
37
|
-
chain.unresolved.each do |(name, parent)|
|
38
|
-
log "#{parent} depends on #{name.inspect}".color(:red)
|
39
|
-
|
40
|
-
conflicts = chain.conflicts[name]
|
41
|
-
|
42
|
-
if conflicts
|
43
|
-
conflicts.each do |conflict|
|
44
|
-
log " - provided by #{conflict.inspect}".color(:red)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
abort "Cannot continue build due to unresolved dependencies!".color(:red)
|
50
|
-
end
|
51
|
-
|
52
|
-
log "Resolved: #{chain.resolved.inspect}".color(:magenta)
|
53
|
-
|
54
28
|
ordered = chain.ordered
|
55
29
|
|
56
30
|
if @options[:only]
|
@@ -61,7 +35,7 @@ module Teapot
|
|
61
35
|
log "Building #{target.name} for dependency #{dependency}...".color(:cyan)
|
62
36
|
|
63
37
|
if target.respond_to?(:build!) and !@options[:dry]
|
64
|
-
target.build!(configuration)
|
38
|
+
target.build!(context.configuration)
|
65
39
|
end
|
66
40
|
end
|
67
41
|
|
@@ -23,13 +23,11 @@ require 'teapot/controller'
|
|
23
23
|
module Teapot
|
24
24
|
class Controller
|
25
25
|
def clean
|
26
|
-
context, configuration = load_teapot
|
27
|
-
|
28
26
|
log "Removing #{configuration.platforms_path}...".color(:cyan)
|
29
|
-
FileUtils.rm_rf configuration.platforms_path
|
27
|
+
FileUtils.rm_rf context.configuration.platforms_path
|
30
28
|
|
31
29
|
log "Removing #{configuration.packages_path}...".color(:cyan)
|
32
|
-
FileUtils.rm_rf configuration.packages_path
|
30
|
+
FileUtils.rm_rf context.configuration.packages_path
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
@@ -23,9 +23,8 @@ require 'teapot/controller'
|
|
23
23
|
module Teapot
|
24
24
|
class Controller
|
25
25
|
def fetch
|
26
|
-
context, configuration = load_teapot
|
27
|
-
|
28
26
|
resolved = Set.new
|
27
|
+
configuration = context.configuration
|
29
28
|
unresolved = context.unresolved(configuration.packages)
|
30
29
|
tries = 0
|
31
30
|
|
@@ -23,10 +23,8 @@ require 'teapot/controller'
|
|
23
23
|
module Teapot
|
24
24
|
class Controller
|
25
25
|
def list
|
26
|
-
context, configuration = load_teapot
|
27
|
-
|
28
26
|
# Should this somehow consider context.root_package?
|
29
|
-
configuration.packages.each do |package|
|
27
|
+
context.configuration.packages.each do |package|
|
30
28
|
log "Package #{package.name} (from #{package.path}):".bright
|
31
29
|
|
32
30
|
begin
|
data/lib/teapot/controller.rb
CHANGED
@@ -42,15 +42,10 @@ module Teapot
|
|
42
42
|
@log_output.puts *args
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
context = Context.new(@root)
|
51
|
-
configuration = context.configuration_named(configuration_name)
|
52
|
-
|
53
|
-
return context, configuration
|
45
|
+
def context
|
46
|
+
@context ||= Context.new(@root,
|
47
|
+
:configuration => @options[:configuration]
|
48
|
+
)
|
54
49
|
end
|
55
50
|
end
|
56
51
|
end
|
data/lib/teapot/dependency.rb
CHANGED
@@ -24,6 +24,16 @@ require 'teapot/environment'
|
|
24
24
|
|
25
25
|
module Teapot
|
26
26
|
module Dependency
|
27
|
+
class UnresolvedDependencyError < StandardError
|
28
|
+
def initialize(chain)
|
29
|
+
super "Unresolved dependency chain!"
|
30
|
+
|
31
|
+
@chain = chain
|
32
|
+
end
|
33
|
+
|
34
|
+
attr :chain
|
35
|
+
end
|
36
|
+
|
27
37
|
Provision = Struct.new(:value)
|
28
38
|
Alias = Struct.new(:dependencies)
|
29
39
|
|
@@ -149,10 +159,10 @@ module Teapot
|
|
149
159
|
|
150
160
|
# We will now satisfy this dependency by satisfying any dependent dependencies, but we no longer need to revisit this one.
|
151
161
|
@resolved << dependency
|
152
|
-
|
162
|
+
|
153
163
|
if Alias === provision
|
154
164
|
# puts "** Resolving alias #{provision}".color(:magenta)
|
155
|
-
|
165
|
+
|
156
166
|
provision.dependencies.each do |dependency|
|
157
167
|
expand(dependency, provider)
|
158
168
|
end
|
@@ -160,23 +170,30 @@ module Teapot
|
|
160
170
|
# puts "** Appending #{dependency} -> provisions".color(:magenta)
|
161
171
|
@provisions << provision
|
162
172
|
end
|
163
|
-
|
173
|
+
|
164
174
|
unless @resolved.include?(provider)
|
165
175
|
# We are now satisfying the provider by expanding all its own dependencies:
|
166
176
|
@resolved << provider
|
167
|
-
|
177
|
+
|
168
178
|
provider.dependencies.each do |dependency|
|
169
179
|
expand(dependency, provider)
|
170
180
|
end
|
171
|
-
|
181
|
+
|
172
182
|
# puts "** Appending #{dependency} -> ordered".color(:magenta)
|
173
183
|
@ordered << [provider, dependency]
|
174
184
|
end
|
175
185
|
end
|
176
186
|
end
|
177
187
|
|
188
|
+
# An `UnresolvedDependencyError` will be thrown if there are any unresolved dependencies.
|
178
189
|
def self.chain(selection, dependencies, providers)
|
179
|
-
Chain.new(selection, dependencies, providers)
|
190
|
+
chain = Chain.new(selection, dependencies, providers)
|
191
|
+
|
192
|
+
if chain.unresolved.size > 0
|
193
|
+
raise UnresolvedDependencyError.new(chain)
|
194
|
+
end
|
195
|
+
|
196
|
+
return chain
|
180
197
|
end
|
181
198
|
end
|
182
199
|
end
|
data/lib/teapot/substitutions.rb
CHANGED
data/lib/teapot/target.rb
CHANGED
@@ -44,9 +44,7 @@ module Teapot
|
|
44
44
|
@build = Proc.new(&block)
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
48
|
-
return unless @build
|
49
|
-
|
47
|
+
def build_environment(configuration)
|
50
48
|
# Reduce the number of keystrokes for good health:
|
51
49
|
context = configuration.context
|
52
50
|
|
@@ -54,9 +52,6 @@ module Teapot
|
|
54
52
|
|
55
53
|
environments = []
|
56
54
|
|
57
|
-
# The base configuration environment:
|
58
|
-
# environments << configuration.environment
|
59
|
-
|
60
55
|
# Calculate the dependency chain's ordered environments:
|
61
56
|
environments += chain.provisions.collect do |provision|
|
62
57
|
Environment.new(&provision.value)
|
@@ -68,7 +63,7 @@ module Teapot
|
|
68
63
|
# Merge all the environments together:
|
69
64
|
environment = Environment.combine(*environments)
|
70
65
|
|
71
|
-
|
66
|
+
environment.merge do
|
72
67
|
default platforms_path configuration.platforms_path
|
73
68
|
default build_prefix {platforms_path + "cache/#{platform_name}-#{variant}"}
|
74
69
|
default install_prefix {platforms_path + "#{platform_name}-#{variant}"}
|
@@ -76,8 +71,14 @@ module Teapot
|
|
76
71
|
append buildflags {"-I#{install_prefix + "include"}"}
|
77
72
|
append linkflags {"-L#{install_prefix + "lib"}"}
|
78
73
|
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def build!(configuration)
|
77
|
+
return unless @build
|
78
|
+
|
79
|
+
local_environment = build_environment(configuration)
|
79
80
|
|
80
|
-
@build.call(
|
81
|
+
@build.call(local_environment)
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
data/lib/teapot/version.rb
CHANGED
data/test/test_dependency.rb
CHANGED
@@ -84,11 +84,11 @@ class TestDependency < Test::Unit::TestCase
|
|
84
84
|
salad.depends 'fruit'
|
85
85
|
salad.provides 'salad'
|
86
86
|
|
87
|
-
chain = Teapot::Dependency::
|
87
|
+
chain = Teapot::Dependency::Chain.new([], ['salad'], [apple, bananna, salad])
|
88
88
|
assert_equal ["fruit", salad], chain.unresolved.first
|
89
89
|
assert_equal({"fruit" => [apple, bananna]}, chain.conflicts)
|
90
90
|
|
91
|
-
chain = Teapot::Dependency::
|
91
|
+
chain = Teapot::Dependency::Chain.new(['apple'], ['salad'], [apple, bananna, salad])
|
92
92
|
assert_equal([], chain.unresolved)
|
93
93
|
assert_equal({}, chain.conflicts)
|
94
94
|
end
|
data/test/test_teapot.rb
CHANGED
@@ -36,7 +36,7 @@ class TestConfig < Test::Unit::TestCase
|
|
36
36
|
# No targets were defined:
|
37
37
|
assert_equal 0, context.targets.count
|
38
38
|
|
39
|
-
default_configuration = context.
|
39
|
+
default_configuration = context.configuration
|
40
40
|
|
41
41
|
# 13 defined packages + 1 implicit package.
|
42
42
|
assert_equal 14, default_configuration.packages.count
|
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: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03
|
11
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|