diff --git a/NEWS b/NEWS index 9935d5d8..e7a378f7 100644 --- a/NEWS +++ b/NEWS @@ -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 = diff --git a/lib/motion/project/vendor.rb b/lib/motion/project/vendor.rb index a4416ef1..a3529591 100644 --- a/lib/motion/project/vendor.rb +++ b/lib/motion/project/vendor.rb @@ -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