mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-05-26 15:43:57 +08:00
Generate BridgeSupport for headers at any level. This patch is needed
to ensure all headers of Pods will be included in the BS file, with the current state of the motion-cocoapods repo.
This commit is contained in:
@@ -153,9 +153,9 @@ EOS
|
||||
bs_file = File.expand_path(File.basename(@path) + '.bridgesupport')
|
||||
headers_dir = opts.delete(:headers_dir)
|
||||
if !File.exist?(bs_file) and headers_dir
|
||||
Dir.chdir(headers_dir) do
|
||||
sh "/usr/bin/gen_bridge_metadata --format complete --no-64-bit --cflags \"-I.\" *.h -o \"#{bs_file}\""
|
||||
end
|
||||
project_dir = File.expand_path(@config.project_dir)
|
||||
headers = Dir.glob(File.join(project_dir, headers_dir, '**/*.h'))
|
||||
BridgeSupport.new(headers).save_as(bs_file)
|
||||
end
|
||||
|
||||
@bs_files = Dir.glob('*.bridgesupport').map { |x| File.expand_path(x) }
|
||||
@@ -176,5 +176,24 @@ EOS
|
||||
raise "Invalid vendor project type: #{@type}" unless respond_to?(method)
|
||||
method
|
||||
end
|
||||
|
||||
class BridgeSupport
|
||||
include Rake::DSL if Rake.const_defined?(:DSL)
|
||||
|
||||
attr_reader :headers
|
||||
|
||||
def initialize(headers)
|
||||
@headers = headers
|
||||
end
|
||||
|
||||
def search_paths
|
||||
@headers.map { |header| "-I '#{File.dirname(header)}'" }.uniq
|
||||
end
|
||||
|
||||
def save_as(path)
|
||||
sh %{/usr/bin/gen_bridge_metadata --format complete --no-64-bit --cflags "#{search_paths.join(' ')}" -o '#{path}' '#{headers.join("' '")}'}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end; end
|
||||
|
||||
Reference in New Issue
Block a user