Commit f71d6ee3 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3489 from CocoaPods/mr-fix-3440

[TargetIntegrator] Only embed application and unit test bundle targets
parents bfcacb51 5c4f6166
......@@ -4,6 +4,15 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
To install release candidates run `[sudo] gem install cocoapods --pre`
## Master
##### Bug Fixes
* Only add the "Embed Pods Frameworks" script for application and unit test targets.
[Marius Rackwitz](https://github.com/mrackwitz)
[#3440](https://github.com/CocoaPods/CocoaPods/issues/3440)
## 0.37.0
For more details, see 📝 [CocoaPods 0.37](http://blog.cocoapods.org/CocoaPods-0.37/) on our blog.
......
......@@ -9,6 +9,11 @@ module Pod
class TargetIntegrator
autoload :XCConfigIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
# @return [Array<Symbol>] the symbol types, which require that the pod
# frameworks are embedded in the output directory / product bundle.
#
EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle].freeze
# @return [Target] the target that should be integrated.
#
attr_reader :target
......@@ -136,7 +141,10 @@ module Pod
#
def add_embed_frameworks_script_phase
phase_name = 'Embed Pods Frameworks'
native_targets_to_integrate.each do |native_target|
targets_to_embed_in = native_targets_to_integrate.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
targets_to_embed_in.each do |native_target|
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name == phase_name }
unless embed_build_phase.present?
UI.message("Adding Build Phase '#{phase_name}' to project.")
......
......@@ -115,6 +115,25 @@ module Pod
phase.nil?.should == true
end
it 'does not add an embed frameworks build phase if the target to integrate is a framework' do
target = @target_integrator.send(:native_targets).first
target.stubs(:symbol_type).returns(:framework)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == true
end
it 'removes existing embed frameworks build phases from integrated framework targets' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
@pod_bundle.stubs(:requires_frameworks? => false)
target = @target_integrator.send(:native_targets).first
target.stubs(:symbol_type).returns(:framework)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == true
end
it 'removes existing embed frameworks build phases if frameworks are not used anymore' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment