mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-28 12:45:36 +08:00
[iOS] Do not strip symbols from host that a framework requires.
Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-701.
This commit is contained in:
@@ -96,9 +96,20 @@ PLIST
|
||||
File.basename(framework_path)
|
||||
end
|
||||
|
||||
# Indicates wether to load the framework at runtime or not
|
||||
# Indicates whether to load the framework at runtime or not
|
||||
def load?
|
||||
@opts[:load]
|
||||
end
|
||||
|
||||
# @return [Array<String>] A list of symbols that the framework requires the
|
||||
# host application or extension to provide and should not strip.
|
||||
#
|
||||
def required_symbols
|
||||
executable_filename = File.basename(framework_path, '.framework')
|
||||
executable = File.join(framework_path, executable_filename)
|
||||
cmd = "/usr/bin/nm -ju '#{executable}' | /usr/bin/grep -E '^_(rb|vm)_'"
|
||||
puts cmd if App::VERBOSE
|
||||
`#{cmd}`.strip.split("\n")
|
||||
end
|
||||
end
|
||||
end;end
|
||||
|
||||
@@ -583,7 +583,6 @@ EOS
|
||||
|
||||
attr_accessor :targets
|
||||
|
||||
|
||||
# App Extensions are required to include a 64-bit slice for App Store
|
||||
# submission, so do not exclude `arm64` by default.
|
||||
#
|
||||
@@ -631,5 +630,28 @@ EOS
|
||||
App.fail("Unsupported target type '#{type}'")
|
||||
end
|
||||
end
|
||||
|
||||
# Creates a temporary file that lists all the symbols that the application
|
||||
# (or extension) should not strip.
|
||||
#
|
||||
# At the moment these are only symbols that an iOS framework depends on.
|
||||
#
|
||||
# @return [String] Extra arguments for the `strip` command.
|
||||
#
|
||||
def strip_args
|
||||
args = super
|
||||
|
||||
frameworks = targets.select { |t| t.type == :framework }
|
||||
required_symbols = frameworks.map(&:required_symbols).flatten.uniq.sort
|
||||
unless required_symbols.empty?
|
||||
require 'tempfile'
|
||||
required_symbols_file = Tempfile.new('required-framework-symbols')
|
||||
required_symbols.each { |symbol| required_symbols_file.puts(symbol) }
|
||||
required_symbols_file.close
|
||||
args << " -s '#{required_symbols_file.path}'"
|
||||
end
|
||||
|
||||
args
|
||||
end
|
||||
end
|
||||
end; end
|
||||
|
||||
Reference in New Issue
Block a user