lib/cocoapods-binary/rome/build_framework.rb in cocoapods-binary-0.2 vs lib/cocoapods-binary/rome/build_framework.rb in cocoapods-binary-0.2.1
- old
+ new
@@ -9,17 +9,22 @@
# Build specific target to framework file
# @param [PodTarget] target
# a specific pod target
#
-def build_for_iosish_platform(sandbox, build_dir, target, device, simulator)
+def build_for_iosish_platform(sandbox, build_dir, target, device, simulator, bitcode_enabled)
deployment_target = target.platform.deployment_target.to_s
target_label = target.label
Pod::UI.puts "Prebuilding #{target_label}..."
- xcodebuild(sandbox, target_label, device, deployment_target)
- xcodebuild(sandbox, target_label, simulator, deployment_target)
+
+ other_options = []
+ if bitcode_enabled
+ other_options += ['OTHER_CFLAGS="-fembed-bitcode"']
+ end
+ xcodebuild(sandbox, target_label, device, deployment_target, other_options)
+ xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])
root_name = target.pod_name
module_name = target.product_module_name
executable_path = "#{build_dir}/#{root_name}"
@@ -36,14 +41,15 @@
FileUtils.mv device_framework_lib, build_dir, :force => true
FileUtils.rm simulator_lib if File.file?(simulator_lib)
FileUtils.rm device_lib if File.file?(device_lib)
end
-def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil)
- args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk})
+def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_options=[])
+ args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk} )
platform = PLATFORMS[sdk]
args += Fourflusher::SimControl.new.destination(:oldest, platform, deployment_target) unless platform.nil?
+ args += other_options
Pod::Executable.execute_command 'xcodebuild', args, true
end
@@ -59,11 +65,11 @@
# output path for generated frameworks
#
# [Array<PodTarget>] targets
# The pod targets to build
#
- def self.build(sandbox_root_path, output_path, targets)
+ def self.build(sandbox_root_path, output_path, targets, bitcode_enabled = false)
return unless not targets.empty?
sandbox_root = Pathname(sandbox_root_path)
sandbox = Pod::Sandbox.new(sandbox_root)
@@ -76,10 +82,10 @@
Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
targets.each do |target|
case target.platform.name
- when :ios then build_for_iosish_platform(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator')
+ when :ios then build_for_iosish_platform(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator', bitcode_enabled)
when :osx then xcodebuild(sandbox, target.label)
when :tvos then nil
when :watchos then nil
# when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
# when :watchos then build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator')