delay building targets that depend on builds registered with Environment#register_builds
This commit is contained in:
parent
4ed584701a
commit
e694199f33
@ -39,8 +39,9 @@ module Rscons
|
||||
# when the block returns, the {#process} method is automatically called.
|
||||
def initialize(options = {})
|
||||
@threaded_commands = Set.new
|
||||
@registered_build_dependencies = {}
|
||||
@varset = VarSet.new
|
||||
@job_set = JobSet.new
|
||||
@job_set = JobSet.new(@registered_build_dependencies)
|
||||
@user_deps = {}
|
||||
@builders = {}
|
||||
@build_dirs = []
|
||||
@ -328,7 +329,7 @@ module Rscons
|
||||
|
||||
# Process all completed {ThreadedCommand} objects.
|
||||
completed_tcs.each do |tc|
|
||||
result = builder.finalize(
|
||||
result = tc.build_operation[:builder].finalize(
|
||||
command_status: tc.thread.value,
|
||||
builder_info: tc.builder_info)
|
||||
if result
|
||||
@ -517,6 +518,8 @@ module Rscons
|
||||
#
|
||||
# @since 1.10.0
|
||||
#
|
||||
# @param target [String]
|
||||
# The target that depends on these builds.
|
||||
# @param sources [Array<String>]
|
||||
# List of source file(s) to build.
|
||||
# @param suffixes [Array<String>]
|
||||
@ -526,7 +529,8 @@ module Rscons
|
||||
#
|
||||
# @return [Array<String>]
|
||||
# List of the output file name(s).
|
||||
def register_builds(sources, suffixes, vars)
|
||||
def register_builds(target, sources, suffixes, vars)
|
||||
@registered_build_dependencies[target] ||= Set.new
|
||||
sources.map do |source|
|
||||
if source.end_with?(*suffixes)
|
||||
source
|
||||
@ -540,6 +544,7 @@ module Rscons
|
||||
if builder
|
||||
output_fname = attempt_output_fname
|
||||
self.__send__(builder.name, output_fname, source, vars)
|
||||
@registered_build_dependencies[target] << output_fname
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -5,8 +5,13 @@ module Rscons
|
||||
class JobSet
|
||||
|
||||
# Create a JobSet
|
||||
def initialize
|
||||
#
|
||||
# @param build_dependencies [Hash]
|
||||
# Hash mapping targets to a set of build dependencies. A job will not be
|
||||
# returned as ready to run if any of its dependencies are still building.
|
||||
def initialize(build_dependencies)
|
||||
@jobs = {}
|
||||
@build_dependencies = build_dependencies
|
||||
end
|
||||
|
||||
# Add a job to the JobSet.
|
||||
@ -42,13 +47,10 @@ module Rscons
|
||||
# @return [nil, Hash]
|
||||
# The next job to run.
|
||||
def get_next_job_to_run(targets_still_building)
|
||||
attempted_targets = Set.new
|
||||
|
||||
@jobs.keys.each do |target|
|
||||
attempted_targets << target
|
||||
skip = false
|
||||
@jobs[target][0][:sources].each do |src|
|
||||
if @jobs.include?(src) and not attempted_targets.include?(src)
|
||||
(@jobs[target][0][:sources] + (@build_dependencies[target] || []).to_a).each do |src|
|
||||
if @jobs.include?(src)
|
||||
# Skip this target because it depends on another target later in
|
||||
# the job set.
|
||||
skip = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user