Build pod targets with script phases and integrate them properly

parent 3237d4dd
...@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -30,6 +30,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Build pod targets with script phases and integrate them properly
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7104](https://github.com/CocoaPods/CocoaPods/pull/7104)
* Fix framework and resources paths caching * Fix framework and resources paths caching
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7068](https://github.com/CocoaPods/CocoaPods/pull/7068) [#7068](https://github.com/CocoaPods/CocoaPods/pull/7068)
......
...@@ -180,10 +180,10 @@ module Pod ...@@ -180,10 +180,10 @@ module Pod
end end
def integrate_targets def integrate_targets
pod_targets_with_test_targets = pod_targets.reject { |pt| pt.test_native_targets.empty? } pod_targets_to_integrate = pod_targets.select { |pt| !pt.test_native_targets.empty? || pt.contains_script_phases? }
unless pod_targets_with_test_targets.empty? unless pod_targets_to_integrate.empty?
UI.message '- Integrating targets' do UI.message '- Integrating targets' do
pod_targets_with_test_targets.each do |pod_target| pod_targets_to_integrate.each do |pod_target|
PodTargetIntegrator.new(pod_target).integrate! PodTargetIntegrator.new(pod_target).integrate!
end end
end end
......
...@@ -163,7 +163,7 @@ module Pod ...@@ -163,7 +163,7 @@ module Pod
@should_build = begin @should_build = begin
source_files = file_accessors.flat_map(&:source_files) source_files = file_accessors.flat_map(&:source_files)
source_files -= file_accessors.flat_map(&:headers) source_files -= file_accessors.flat_map(&:headers)
!source_files.empty? !source_files.empty? || contains_script_phases?
end end
end end
...@@ -185,6 +185,12 @@ module Pod ...@@ -185,6 +185,12 @@ module Pod
end end
end end
# @return [Boolean] Whether the target contains any script phases.
#
def contains_script_phases?
!spec_consumers.map(&:script_phases).flatten.empty?
end
# @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value # @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value
# an array of all the test specs associated with this native target. # an array of all the test specs associated with this native target.
# #
......
...@@ -109,6 +109,15 @@ module Pod ...@@ -109,6 +109,15 @@ module Pod
@pod_target.should_build?.should == false @pod_target.should_build?.should == false
end end
it 'builds a pod target if there are no actual source files but there are script phases' do
fa = Sandbox::FileAccessor.new(nil, @pod_target)
fa.stubs(:source_files).returns([Pathname.new('foo.h')])
@pod_target.stubs(:file_accessors).returns([fa])
@pod_target.root_spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
@pod_target.should_build?.should == true
end
end end
describe 'target version' do describe 'target version' do
...@@ -333,6 +342,21 @@ module Pod ...@@ -333,6 +342,21 @@ module Pod
end end
end end
describe 'script phases support' do
before do
@pod_target = fixture_pod_target('coconut-lib/CoconutLib.podspec')
end
it 'returns false if it does not contain test specifications' do
@pod_target.contains_script_phases?.should == false
end
it 'returns true if it contains test specifications' do
@pod_target.root_spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
@pod_target.contains_script_phases?.should == true
end
end
describe 'test spec support' do describe 'test spec support' do
before do before do
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec') @coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
......
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