[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

3
NEWS
View File

@@ -11,6 +11,9 @@
* Fixed issue where `vendor_project' with `:static' did not reuse `:cflags'
for the BridgeSupport generation.
* Improved String#to_sym performance. ~40% faster.
* Fixed issue where manually created BridgeSupport metadata files were no
longer being used by the compiler. Now if one exists in the root of the lib
dir, that will be used instead of one in the platform-specific build dir.
= RubyMotion 2.22 =

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