JobSet#get_next_job_to_run: take into account targets still building
This commit is contained in:
parent
9cc59a35f0
commit
5de52620e4
@ -286,9 +286,10 @@ module Rscons
|
||||
begin
|
||||
while @job_set.size > 0
|
||||
|
||||
# TODO: get_next_job_to_run needs to take into account targets still
|
||||
# being processed.
|
||||
job = @job_set.get_next_job_to_run
|
||||
targets_still_building = @threaded_commands.map do |tc|
|
||||
tc.build_operation[:target]
|
||||
end
|
||||
job = @job_set.get_next_job_to_run(targets_still_building)
|
||||
|
||||
# TODO: have Cache determine when checksums may be invalid based on
|
||||
# file size and/or timestamp.
|
||||
|
@ -34,18 +34,34 @@ module Rscons
|
||||
#
|
||||
# This method will remove the job from the JobSet.
|
||||
#
|
||||
# @param targets_still_building [Array<String>]
|
||||
# Targets that are not finished building. This is used to avoid returning
|
||||
# a job as available to run if it depends on one of the targets that are
|
||||
# still building as a source.
|
||||
#
|
||||
# @return [nil, Hash]
|
||||
# The next job to run.
|
||||
def get_next_job_to_run
|
||||
if @jobs.size > 0
|
||||
evaluated_targets = Set.new
|
||||
attempt = lambda do |target|
|
||||
evaluated_targets << target
|
||||
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 evaluated_targets.include?(src)
|
||||
return attempt[src]
|
||||
if @jobs.include?(src) and not attempted_targets.include?(src)
|
||||
# Skip this target because it depends on another target later in
|
||||
# the job set.
|
||||
skip = true
|
||||
break
|
||||
end
|
||||
if targets_still_building.include?(src)
|
||||
# Skip this target because it depends on another target that is
|
||||
# still being built.
|
||||
skip = true
|
||||
break
|
||||
end
|
||||
end
|
||||
next if skip
|
||||
job = @jobs[target][0]
|
||||
if @jobs[target].size > 1
|
||||
@jobs[target].slice!(0)
|
||||
@ -54,8 +70,8 @@ module Rscons
|
||||
end
|
||||
return job
|
||||
end
|
||||
attempt[@jobs.first.first]
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
# Remove all jobs from the JobSet.
|
||||
|
Loading…
x
Reference in New Issue
Block a user