remove SharedObject special handling in Environment#get_build_fname - close #96

This commit is contained in:
Josh Holtrop 2019-04-14 12:41:12 -04:00
parent ea2b1e73d1
commit c23426c5aa
3 changed files with 18 additions and 1 deletions

View File

@ -8,6 +8,15 @@ module Rscons
class Builder class Builder
class << self class << self
# Return a String specifying an extra path component used to
# differentiate build targets built by this builder from others.
#
# @return [String, nil]
# Extra path component used to differentiate build targets built by
# this builder from others.
def extra_path
end
# Return the name of the builder. # Return the name of the builder.
# #
# If not overridden this defaults to the last component of the class name. # If not overridden this defaults to the last component of the class name.

View File

@ -5,6 +5,12 @@ module Rscons
# source files. # source files.
class SharedObject < Builder class SharedObject < Builder
include Mixins::Object include Mixins::Object
class << self
def extra_path
"_shared"
end
end
end end
end end
end end

View File

@ -245,7 +245,9 @@ module Rscons
# @return [String] # @return [String]
# The file name to be built from +source_fname+ with suffix +suffix+. # The file name to be built from +source_fname+ with suffix +suffix+.
def get_build_fname(source_fname, suffix, builder_class) def get_build_fname(source_fname, suffix, builder_class)
extra_path = builder_class == Builders::SharedObject ? "/_shared" : "" if extra_path = builder_class.extra_path
extra_path = "/#{extra_path}"
end
"#{@build_root}#{extra_path}/#{Util.make_relative_path(Rscons.set_suffix(source_fname, suffix))}".gsub("\\", "/") "#{@build_root}#{extra_path}/#{Util.make_relative_path(Rscons.set_suffix(source_fname, suffix))}".gsub("\\", "/")
end end