[Vendor] When an explicit BS file exists in lib root, use that.

This allows a lib author to override the BS metadata by (manually)
creating and supplying one, which seems to be the case with Joybox.
This commit is contained in:
Eloy Durán
2014-02-10 17:30:40 +01:00
parent ade9fc1f57
commit 8354e398e6
2 changed files with 16 additions and 2 deletions

View File

@@ -131,7 +131,7 @@ EOS
headers = source_files.select { |p| File.extname(p) == '.h' }
bs_files = []
unless headers.empty?
bs_file = File.join(build_dir, File.basename(@path) + '.bridgesupport')
bs_file = bridgesupport_build_path(build_dir)
if !File.exist?(bs_file) or headers.any? { |h| File.mtime(h) > File.mtime(bs_file) }
FileUtils.mkdir_p File.dirname(bs_file)
bs_cflags = (opts.delete(:bridgesupport_cflags) or cflags)
@@ -207,7 +207,7 @@ EOS
end
# Generate the bridgesupport file if we need to.
bs_file = File.join(build_dir, File.basename(@path) + '.bridgesupport')
bs_file = bridgesupport_build_path(build_dir)
headers_dir = opts.delete(:headers_dir)
if headers_dir
project_dir = File.expand_path(@config.project_dir)
@@ -232,5 +232,16 @@ EOS
raise "Invalid vendor project type: #{@type}" unless respond_to?(method)
method
end
# First check if an explicit metadata file exists and, if so, write
# the new file to that same location. Otherwise fall back to the
# platform-specific build dir.
def bridgesupport_build_path(build_dir)
bs_file = File.basename(@path) + '.bridgesupport'
unless File.exist?(bs_file)
bs_file = File.join(build_dir, bs_file)
end
bs_file
end
end
end; end