42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/teapot/command/build.rb', line 42
def invoke(parent)
context = parent.context
if @targets.any?
selection = context.select(@targets)
else
selection = context.select(context.configuration.targets[:build])
end
chain = selection.chain
ordered = chain.ordered
if @options[:only]
ordered = selection.direct_targets(ordered)
end
controller = ::Build::Controller.new(logger: parent.logger, limit: @options[:limit]) do |controller|
ordered.each do |resolution|
target = resolution.provider
if target.build
environment = target.environment(selection.configuration, chain)
controller.add_target(target, environment.flatten, self.argv)
end
end
end
walker = nil
begin
controller.run do |walker|
unless @options[:continuous]
if walker.failed?
raise BuildFailedError.new("Failed to build all nodes successfully!")
end
break
end
end
rescue Interrupt
if walker && walker.failed?
raise BuildFailedError.new("Failed to build all nodes successfully!")
end
end
return chain, ordered
end
|