remove Builder.features and Builder.produces?

This commit is contained in:
josh committed 2019-03-16 21:54:20 -04:00
1 parent ac1fc6d106
commit 3ff09978f4
11 files changed
+69 -199

No files matched your search

+7 -2
View File
@@ -7,8 +7,13 @@ module Rscons
def initialize(options)
super(options)
suffixes = @env.expand_varref(["${OBJSUFFIX}", "${LIBSUFFIX}"], @vars)
# Register builders to build each source to an object file or library.
@objects = @env.register_builds(@target, @sources, suffixes, @vars)
@objects = @sources.map do |source|
if source.end_with?(*suffixes)
source
else
@env.register_dependency_build(@target, source, suffixes.first, @vars, Object)
end
end
end
# Run the builder to produce a build target.
-22
View File
@@ -12,28 +12,6 @@ module Rscons
"DC" => "DSUFFIX",
}
class << self
# Return whether this builder object is capable of producing a given target
# file name from a given source file name.
#
# @param target [String]
# The target file name.
# @param source [String]
# The source file name.
# @param env [Environment]
# The Environment.
#
# @return [Boolean]
# Whether this builder object is capable of producing a given target
# file name from a given source file name.
def produces?(target, source, env)
target.end_with?(*env['OBJSUFFIX']) and
KNOWN_SUFFIXES.find do |compiler, suffix_var|
source.end_with?(*env[suffix_var])
end
end
end
# Run the builder to produce a build target.
def run(options)
if @command
+7 -2
View File
@@ -22,8 +22,13 @@ module Rscons
@target += @env.expand_varref("${PROGSUFFIX}", @vars)
end
suffixes = @env.expand_varref(["${OBJSUFFIX}", "${LIBSUFFIX}"], @vars)
# Register builders to build each source to an object file or library.
@objects = @env.register_builds(@target, @sources, suffixes, @vars)
@objects = @sources.map do |source|
if source.end_with?(*suffixes)
source
else
@env.register_dependency_build(@target, source, suffixes.first, @vars, Object)
end
end
end
# Run the builder to produce a build target.
+7 -13
View File
@@ -4,16 +4,6 @@ module Rscons
# shared library.
class SharedLibrary < Builder
class << self
# Return a set of build features that this builder provides.
#
# @return [Array<String>]
# Set of build features that this builder provides.
def features
%w[shared]
end
end
# Create an instance of the Builder to build a target.
def initialize(options)
super(options)
@@ -25,9 +15,13 @@ module Rscons
@target += @env.expand_varref("${SHLIBSUFFIX}", @vars)
end
suffixes = @env.expand_varref(["${OBJSUFFIX}", "${LIBSUFFIX}"], @vars)
# Register builders to build each source to an object file or library.
@objects = @env.register_builds(@target, @sources, suffixes, @vars,
features: %w[shared])
@objects = @sources.map do |source|
if source.end_with?(*suffixes)
source
else
@env.register_dependency_build(@target, source, suffixes.first, @vars, SharedObject)
end
end
end
# Run the builder to produce a build target.
-30
View File
@@ -13,36 +13,6 @@ module Rscons
"SHDC" => "DSUFFIX",
}
class << self
# Return a set of build features that this builder provides.
#
# @return [Array<String>]
# Set of build features that this builder provides.
def features
%w[shared]
end
# Return whether this builder object is capable of producing a given target
# file name from a given source file name.
#
# @param target [String]
# The target file name.
# @param source [String]
# The source file name.
# @param env [Environment]
# The Environment.
#
# @return [Boolean]
# Whether this builder object is capable of producing a given target
# file name from a given source file name.
def produces?(target, source, env)
target.end_with?(*env['OBJSUFFIX']) and
KNOWN_SUFFIXES.find do |compiler, suffix_var|
source.end_with?(*env[suffix_var])
end
end
end
# Run the builder to produce a build target.
def run(options)
if @command