Update build step accounting to only count within one environment process run
This commit is contained in:
parent
9d14cc7eb0
commit
1e5f1043d5
@ -31,7 +31,6 @@ module Rscons
|
||||
@build_dir = ENV["RSCONS_BUILD_DIR"] || "build"
|
||||
ENV.delete("RSCONS_BUILD_DIR")
|
||||
@n_threads = Util.determine_n_threads
|
||||
@build_step = 0
|
||||
end
|
||||
|
||||
# Run the application.
|
||||
@ -71,25 +70,6 @@ module Rscons
|
||||
end
|
||||
end
|
||||
|
||||
# Get the next build step number.
|
||||
#
|
||||
# This is used internally by the {Environment} class.
|
||||
#
|
||||
# @api private
|
||||
def get_next_build_step
|
||||
@build_step += 1
|
||||
end
|
||||
|
||||
# Get the total number of build steps.
|
||||
#
|
||||
# @return [Integer]
|
||||
# The total number of build steps.
|
||||
def get_total_build_steps
|
||||
Environment.environments.reduce(@build_step) do |result, env|
|
||||
result + env.build_steps_remaining
|
||||
end
|
||||
end
|
||||
|
||||
# Remove all generated files.
|
||||
#
|
||||
# @api private
|
||||
|
@ -285,6 +285,10 @@ module Rscons
|
||||
@process_commands_waiting_to_run = []
|
||||
@process_builder_waits = {}
|
||||
@process_builders_to_run = []
|
||||
@build_step = 0
|
||||
@build_steps = @builder_sets.reduce(0) do |result, builder_set|
|
||||
result + builder_set.build_steps_remaining
|
||||
end
|
||||
begin
|
||||
while @builder_sets.size > 0 or @threads.size > 0 or @process_commands_waiting_to_run.size > 0
|
||||
process_step
|
||||
@ -535,7 +539,7 @@ module Rscons
|
||||
message = short_description if short_description
|
||||
end
|
||||
if message
|
||||
total_build_steps = Rscons.application.get_total_build_steps.to_s
|
||||
total_build_steps = @build_steps.to_s
|
||||
this_build_step = sprintf("%#{total_build_steps.size}d", builder.build_step)
|
||||
progress = "[#{this_build_step}/#{total_build_steps}]"
|
||||
Ansi.write($stdout, *Util.colorize_markup("#{progress} #{message}"), "\n")
|
||||
@ -560,16 +564,6 @@ module Rscons
|
||||
@builder_sets << build_builder_set
|
||||
end
|
||||
|
||||
# Get the number of build steps remaining.
|
||||
#
|
||||
# @return [Integer]
|
||||
# The number of build steps remaining.
|
||||
def build_steps_remaining
|
||||
@builder_sets.reduce(0) do |result, builder_set|
|
||||
result + builder_set.build_steps_remaining
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Build a BuilderSet.
|
||||
@ -580,6 +574,16 @@ module Rscons
|
||||
BuilderSet.new(@registered_build_dependencies, @side_effects)
|
||||
end
|
||||
|
||||
# Get the next build step number.
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
# @return [Integer]
|
||||
# Next build step number.
|
||||
def get_next_build_step
|
||||
@build_step += 1
|
||||
end
|
||||
|
||||
# Run a builder and process its return value.
|
||||
#
|
||||
# @param builder [Builder]
|
||||
@ -587,7 +591,7 @@ module Rscons
|
||||
#
|
||||
# @return [void]
|
||||
def run_builder(builder)
|
||||
builder.build_step ||= Rscons.application.get_next_build_step
|
||||
builder.build_step ||= get_next_build_step
|
||||
case result = builder.run({})
|
||||
when Array
|
||||
result.each do |waititem|
|
||||
|
@ -2641,7 +2641,7 @@ EOF
|
||||
])
|
||||
end
|
||||
|
||||
it "does include install targets in build progress when doing an install" do
|
||||
it "counts install task targets separately from build task targets" do
|
||||
test_dir "typical"
|
||||
|
||||
Dir.mktmpdir do |prefix|
|
||||
@ -2651,25 +2651,25 @@ EOF
|
||||
result = run_rscons(args: %w[-f install.rb install])
|
||||
expect(result.stderr).to eq ""
|
||||
verify_lines(lines(result.stdout), [
|
||||
%r{\[1/9\] Compiling},
|
||||
%r{\[2/9\] Compiling},
|
||||
%r{\[\d/9\] Install},
|
||||
%r{\[1/3\] Compiling},
|
||||
%r{\[2/3\] Compiling},
|
||||
%r{\[\d/6\] Install},
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
it "includes build steps from all environments when showing build progress" do
|
||||
it "separates build steps from each environment when showing build progress" do
|
||||
test_dir "typical"
|
||||
|
||||
result = run_rscons(args: %w[-f multiple_environments.rb])
|
||||
expect(result.stderr).to eq ""
|
||||
verify_lines(lines(result.stdout), [
|
||||
%r{\[1/6\] Compiling},
|
||||
%r{\[2/6\] Compiling},
|
||||
%r{\[3/6\] Linking},
|
||||
%r{\[4/6\] Compiling},
|
||||
%r{\[5/6\] Compiling},
|
||||
%r{\[6/6\] Linking},
|
||||
%r{\[1/3\] Compiling},
|
||||
%r{\[2/3\] Compiling},
|
||||
%r{\[3/3\] Linking},
|
||||
%r{\[1/3\] Compiling},
|
||||
%r{\[2/3\] Compiling},
|
||||
%r{\[3/3\] Linking},
|
||||
])
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user