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. # List of task(s) to execute.
# @param options [Hash] # @param options [Hash]
# Optional parameters. # Optional parameters.
# @option sub_op [Boolean]
# Whether this operation is not the top-level operation.
# #
# @return [Integer] # @return [Integer]
# Process exit code (0 on success). # Process exit code (0 on success).

View File

@ -87,14 +87,6 @@ module Rscons
self.class.name self.class.name
end 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. # Manually record a given build target as depending on the specified files.
# #
# @param user_deps [Array<String>] # @param user_deps [Array<String>]

View File

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

View File

@ -9,22 +9,10 @@ module Rscons
def initialize(*args) def initialize(*args)
super super
@install_builder = self.class.name == "Install" @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 end
# Run the builder to produce a build target. # Run the builder to produce a build target.
def run(options) def run(options)
if @nop
true
else
target_is_dir = (@sources.length > 1) || target_is_dir = (@sources.length > 1) ||
Dir.exists?(@sources.first) || Dir.exists?(@sources.first) ||
Dir.exists?(@target) Dir.exists?(@target)
@ -64,7 +52,6 @@ module Rscons
end end
(target_is_dir ? Dir.exists?(@target) : File.exists?(@target)) ? true : false (target_is_dir ? Dir.exists?(@target) : File.exists?(@target)) ? true : false
end end
end
end end

View File

@ -8,22 +8,10 @@ module Rscons
def initialize(*args) def initialize(*args)
super super
@install_builder = self.class.name == "InstallDirectory" @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 end
# Run the builder to produce a build target. # Run the builder to produce a build target.
def run(options) def run(options)
if @nop
true
else
if File.directory?(@target) if File.directory?(@target)
true true
elsif File.exists?(@target) elsif File.exists?(@target)
@ -35,7 +23,6 @@ module Rscons
true true
end end
end end
end
end end

View File

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