Rework builder features to be returned by Builder#features instead of taken into account by Builder#produces?
This commit is contained in:
1 parent
b7f609b7e8
commit
010607d3b0
6 files changed
+113
-76
No files matched your search
@@ -62,16 +62,18 @@ module Rscons
|
||||
# Return whether this builder object is capable of producing a given target
|
||||
# file name from a given source file name.
|
||||
#
|
||||
# @param options [Hash]
|
||||
# Options.
|
||||
# @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?(options)
|
||||
target, source, env, features = options.values_at(:target, :source, :env, :features)
|
||||
(not features[:shared]) and
|
||||
target.end_with?(*env['OBJSUFFIX']) and
|
||||
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
|
||||
|
||||
@@ -21,6 +21,14 @@ module Rscons
|
||||
}
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
# Create a BuildTarget object for this build target.
|
||||
#
|
||||
# The build target filename is given a platform-dependent suffix if no
|
||||
@@ -61,7 +69,7 @@ module Rscons
|
||||
suffixes = env.expand_varref(["${OBJSUFFIX}", "${LIBSUFFIX}"], vars)
|
||||
# Register builders to build each source to an object file or library.
|
||||
env.register_builds(target, sources, suffixes, vars,
|
||||
features: {shared: true})
|
||||
features: %w[shared])
|
||||
end
|
||||
|
||||
# Run the builder to produce a build target.
|
||||
|
||||
@@ -37,19 +37,29 @@ module Rscons
|
||||
}
|
||||
end
|
||||
|
||||
# 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 options [Hash]
|
||||
# Options.
|
||||
# @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?(options)
|
||||
target, source, env, features = options.values_at(:target, :source, :env, :features)
|
||||
features[:shared] and
|
||||
target.end_with?(*env['OBJSUFFIX']) and
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user