Remove "nop" builders; Install* builders always install

This commit is contained in:
Josh Holtrop 2022-01-25 22:45:39 -05:00
parent dbd764749b
commit fc17a14008
6 changed files with 45 additions and 83 deletions

View File

@ -41,8 +41,6 @@ module Rscons
# List of task(s) to execute.
# @param options [Hash]
# Optional parameters.
# @option sub_op [Boolean]
# Whether this operation is not the top-level operation.
#
# @return [Integer]
# Process exit code (0 on success).

View File

@ -87,14 +87,6 @@ module Rscons
self.class.name
end
# Return whether the builder is a no-op.
#
# @return [Boolean]
# Whether the builder is a no-op.
def nop?
false
end
# Manually record a given build target as depending on the specified files.
#
# @param user_deps [Array<String>]

View File

@ -37,7 +37,7 @@ module Rscons
# The number of remaining build steps.
def build_steps_remaining
self.reduce(0) do |result, (target, builders)|
result + builders.select {|b| not b.nop?}.size
result + builders.size
end
end

View File

@ -9,22 +9,10 @@ module Rscons
def initialize(*args)
super
@install_builder = self.class.name == "Install"
@nop = @install_builder && !Rscons.application.operation("install")
end
# Return whether the builder is a no-op.
#
# @return [Boolean]
# Whether the builder is a no-op.
def nop?
@nop
end
# Run the builder to produce a build target.
def run(options)
if @nop
true
else
target_is_dir = (@sources.length > 1) ||
Dir.exists?(@sources.first) ||
Dir.exists?(@target)
@ -64,7 +52,6 @@ module Rscons
end
(target_is_dir ? Dir.exists?(@target) : File.exists?(@target)) ? true : false
end
end
end

View File

@ -8,22 +8,10 @@ module Rscons
def initialize(*args)
super
@install_builder = self.class.name == "InstallDirectory"
@nop = @install_builder && !Rscons.application.operation("install")
end
# Return whether the builder is a no-op.
#
# @return [Boolean]
# Whether the builder is a no-op.
def nop?
@nop
end
# Run the builder to produce a build target.
def run(options)
if @nop
true
else
if File.directory?(@target)
true
elsif File.exists?(@target)
@ -35,7 +23,6 @@ module Rscons
true
end
end
end
end

View File

@ -586,9 +586,7 @@ module Rscons
#
# @return [void]
def run_builder(builder)
unless builder.nop?
builder.build_step ||= Rscons.application.get_next_build_step
end
case result = builder.run({})
when Array
result.each do |waititem|