JobSet only stores builders instead of build info hashes
This commit is contained in:
parent
016bf5eac7
commit
d047a1bf29
@ -264,25 +264,22 @@ module Rscons
|
|||||||
|
|
||||||
if failure
|
if failure
|
||||||
@job_set.clear!
|
@job_set.clear!
|
||||||
job = nil
|
builder = nil
|
||||||
else
|
else
|
||||||
targets_still_building = @threaded_commands.map do |tc|
|
targets_still_building = @threaded_commands.map do |tc|
|
||||||
tc.builder.target
|
tc.builder.target
|
||||||
end
|
end
|
||||||
job = @job_set.get_next_job_to_run(targets_still_building)
|
builder = @job_set.get_next_job_to_run(targets_still_building)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: have Cache determine when checksums may be invalid based on
|
# TODO: have Cache determine when checksums may be invalid based on
|
||||||
# file size and/or timestamp.
|
# file size and/or timestamp.
|
||||||
cache.clear_checksum_cache!
|
cache.clear_checksum_cache!
|
||||||
|
|
||||||
if job
|
if builder
|
||||||
result = run_builder(job[:builder],
|
result = run_builder(builder, cache)
|
||||||
job[:target],
|
|
||||||
job[:sources],
|
|
||||||
cache)
|
|
||||||
unless result
|
unless result
|
||||||
failure = "Failed to build #{job[:target]}"
|
failure = "Failed to build #{builder.target}"
|
||||||
Ansi.write($stderr, :red, failure, :reset, "\n")
|
Ansi.write($stderr, :red, failure, :reset, "\n")
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
@ -297,7 +294,7 @@ module Rscons
|
|||||||
|
|
||||||
# If needed, do a blocking wait.
|
# If needed, do a blocking wait.
|
||||||
if (@threaded_commands.size > 0) and
|
if (@threaded_commands.size > 0) and
|
||||||
((completed_tcs.empty? and job.nil?) or (@threaded_commands.size >= n_threads))
|
((completed_tcs.empty? and builder.nil?) or (@threaded_commands.size >= n_threads))
|
||||||
completed_tcs << wait_for_threaded_commands
|
completed_tcs << wait_for_threaded_commands
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -359,7 +356,7 @@ module Rscons
|
|||||||
cache: Cache.instance,
|
cache: Cache.instance,
|
||||||
env: self,
|
env: self,
|
||||||
vars: vars)
|
vars: vars)
|
||||||
add_target(builder.target, builder, sources, vars)
|
@job_set.add_job(builder)
|
||||||
builder
|
builder
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
@ -511,20 +508,15 @@ module Rscons
|
|||||||
# Invoke a builder to build the given target based on the given sources.
|
# Invoke a builder to build the given target based on the given sources.
|
||||||
#
|
#
|
||||||
# @param builder [Builder] The Builder to use.
|
# @param builder [Builder] The Builder to use.
|
||||||
# @param target [String] The target output file.
|
|
||||||
# @param sources [Array<String>] List of source files.
|
|
||||||
# @param cache [Cache] The Cache.
|
# @param cache [Cache] The Cache.
|
||||||
# @param options [Hash]
|
|
||||||
# @since 1.10.0
|
|
||||||
# Options.
|
|
||||||
#
|
#
|
||||||
# @return [String,false] Return value from the {Builder}'s +run+ method.
|
# @return [String,false] Return value from the {Builder}'s +run+ method.
|
||||||
def run_builder(builder, target, sources, cache, options = {})
|
def run_builder(builder, cache)
|
||||||
builder.vars = @varset.merge(builder.vars)
|
builder.vars = @varset.merge(builder.vars)
|
||||||
build_operation = {
|
build_operation = {
|
||||||
builder: builder,
|
builder: builder,
|
||||||
target: target,
|
target: builder.target,
|
||||||
sources: sources,
|
sources: builder.sources,
|
||||||
cache: cache,
|
cache: cache,
|
||||||
env: self,
|
env: self,
|
||||||
vars: builder.vars,
|
vars: builder.vars,
|
||||||
@ -651,22 +643,6 @@ module Rscons
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Add a build target.
|
|
||||||
#
|
|
||||||
# @param target [String] Build target file name.
|
|
||||||
# @param builder [Builder] The {Builder} to use to build the target.
|
|
||||||
# @param sources [Array<String>] Source file name(s).
|
|
||||||
# @param vars [Hash] Construction variable overrides.
|
|
||||||
#
|
|
||||||
# @return [void]
|
|
||||||
def add_target(target, builder, sources, vars)
|
|
||||||
@job_set.add_job(
|
|
||||||
builder: builder,
|
|
||||||
target: target,
|
|
||||||
sources: sources,
|
|
||||||
vars: vars)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Start a threaded command in a new thread.
|
# Start a threaded command in a new thread.
|
||||||
#
|
#
|
||||||
# @param tc [ThreadedCommand]
|
# @param tc [ThreadedCommand]
|
||||||
|
@ -21,23 +21,15 @@ module Rscons
|
|||||||
|
|
||||||
# Add a job to the JobSet.
|
# Add a job to the JobSet.
|
||||||
#
|
#
|
||||||
# @param options [Hash]
|
# @param builder [Builder]
|
||||||
# Options.
|
# The {Builder} that will produce the target.
|
||||||
# @option options [Symbol, String] :target
|
def add_job(builder)
|
||||||
# Build target name.
|
|
||||||
# @option options [Builder] :builder
|
|
||||||
# The {Builder} to use to build the target.
|
|
||||||
# @option options [Array<String>] :sources
|
|
||||||
# Source file name(s).
|
|
||||||
# @option options [Hash] :vars
|
|
||||||
# Construction variable overrides.
|
|
||||||
def add_job(options)
|
|
||||||
# We allow multiple jobs to be registered per target for cases like:
|
# We allow multiple jobs to be registered per target for cases like:
|
||||||
# env.Directory("dest")
|
# env.Directory("dest")
|
||||||
# env.Install("dest", "bin")
|
# env.Install("dest", "bin")
|
||||||
# env.Install("dest", "share")
|
# env.Install("dest", "share")
|
||||||
@jobs[options[:target]] ||= []
|
@jobs[builder.target] ||= []
|
||||||
@jobs[options[:target]] << options
|
@jobs[builder.target] << builder
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the next job that is ready to run from the JobSet.
|
# Get the next job that is ready to run from the JobSet.
|
||||||
@ -60,7 +52,7 @@ module Rscons
|
|||||||
|
|
||||||
@jobs.keys.each do |target|
|
@jobs.keys.each do |target|
|
||||||
skip = false
|
skip = false
|
||||||
(@jobs[target][0][:sources] + (@build_dependencies[target] || []).to_a).each do |src|
|
(@jobs[target][0].sources + (@build_dependencies[target] || []).to_a).each do |src|
|
||||||
if targets_not_built_yet.include?(src)
|
if targets_not_built_yet.include?(src)
|
||||||
skip = true
|
skip = true
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user