Skip to content

Commit b2ef58c

Browse files
committed
add API for custom_build_option
1 parent 7965225 commit b2ef58c

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

lib/cocoapods-binary/Main.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,32 @@ def keep_source_code_for_prebuilt_frameworks!
2424
DSL.dont_remove_source_code = true
2525
end
2626

27+
# Add custom xcodebuild option to the prebuiling aciton
28+
#
29+
# You may use this for your special demands. For example: the default archs in dSYMs
30+
# of prebuilt frameworks is 'arm64 armv7 x86_64', and no 'i386' for 32bit simulator.
31+
# It may generate a warning when building for a 32bit simulator. You may add following
32+
# to your podfile
33+
#
34+
# ` set_custom_xcodebuild_options_for_prebuilt_frameworks :simulator => "ARCHS=$(ARCHS_STANDARD)" `
35+
#
36+
# @options String or Hash
37+
#
38+
# If is a String, it will apply for device and simulator. Use it just like in the commandline.
39+
# If is a Hash, it should be like this: { :device => "XXXXX", :simulator => "XXXXX" }
40+
#
41+
def set_custom_xcodebuild_options_for_prebuilt_frameworks(options)
42+
if options.kind_of? Hash
43+
DSL.custom_build_options = [ options[:device] ] unless options[:device].nil?
44+
DSL.custom_build_options_simulator = [ options[:simulator] ] unless options[:simulator].nil?
45+
elsif options.kind_of? String
46+
DSL.custom_build_options = [options]
47+
DSL.custom_build_options_simulator = [options]
48+
else
49+
raise "Wrong type."
50+
end
51+
end
52+
2753
private
2854
class_attr_accessor :prebuild_all
2955
prebuild_all = false
@@ -33,6 +59,11 @@ def keep_source_code_for_prebuilt_frameworks!
3359

3460
class_attr_accessor :dont_remove_source_code
3561
dont_remove_source_code = false
62+
63+
class_attr_accessor :custom_build_options
64+
class_attr_accessor :custom_build_options_simulator
65+
self.custom_build_options = []
66+
self.custom_build_options_simulator = []
3667
end
3768
end
3869
end

lib/cocoapods-binary/Prebuild.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def prebuild_frameworks!
120120

121121
output_path = sandbox.framework_folder_path_for_pod_name(target.name)
122122
output_path.mkpath unless output_path.exist?
123-
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled)
123+
Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)
124124

125125
# save the resource paths for later installing
126126
if target.static_framework? and !target.resource_paths.empty?

lib/cocoapods-binary/rome/build_framework.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def build_for_iosish_platform(sandbox,
1616
device,
1717
simulator,
1818
bitcode_enabled,
19-
custom_build_options = [], # Array<string>
20-
custom_build_options_simulator = [] # Array<string>
19+
custom_build_options = [], # Array<String>
20+
custom_build_options_simulator = [] # Array<String>
2121
)
2222

2323
deployment_target = target.platform.deployment_target.to_s

0 commit comments

Comments
 (0)