class Build::Controller
Attributes
logger[R]
nodes[R]
walker[R]
Public Class Methods
new(logger: Console.logger, limit: nil) { |self| ... }
click to toggle source
# File lib/build/controller.rb, line 37 def initialize(logger: Console.logger, limit: nil) @module = Module.new @logger = logger # Top level nodes, for sanity this is a static list. @nodes = [] yield self @nodes.freeze @group = Process::Group.new(limit: limit) # The task class is captured as we traverse all the top level targets: @task_class = nil @walker = Graph::Walker.new(logger: @logger, &self.method(:step)) end
Public Instance Methods
add_chain(chain, arguments = [], environment)
click to toggle source
Add a build environment to the controller.
# File lib/build/controller.rb, line 74 def add_chain(chain, arguments = [], environment) @nodes << ChainNode.new(chain, arguments, environment) end
failed?()
click to toggle source
# File lib/build/controller.rb, line 69 def failed? @walker.failed? end
run() { |walker| ... }
click to toggle source
The entry point for running the walker over the build graph.
# File lib/build/controller.rb, line 88 def run @walker.run do self.update yield @walker if block_given? end end
step(walker, node, parent_task = nil)
click to toggle source
# File lib/build/controller.rb, line 60 def step(walker, node, parent_task = nil) task_class = node.task_class(parent_task) || Task task = task_class.new(walker, node, @group, logger: @logger) task.visit do task.update end end
update()
click to toggle source
# File lib/build/controller.rb, line 78 def update @nodes.each do |node| # We wait for all processes to complete within each node. The result is that we don't execute top level nodes concurrently, but we do execute within each node concurrently where possible. Ideally, some node could be executed concurrently, but right now expressing non-file dependencies between nodes is not possible. @group.wait do @walker.call(node) end end end