Skip to content

Commit

Permalink
Merge pull request #9153 from dnkoutso/non_library_spec_deployment_ta…
Browse files Browse the repository at this point in the history
…rget_edge_case

Correctly set deployment target for non library specs even if the root spec does not specify one.
  • Loading branch information
dnkoutso committed Sep 10, 2019
2 parents 0f74c99 + a2d748d commit dcc702d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* Correctly set deployment target for non library specs even if the root spec does not specify one.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#9153](https://github.com/CocoaPods/CocoaPods/pull/9153)

* Make `APPLICATION_EXTENSION_API_ONLY` build setting not break when performing a cached incremental install.
[Igor Makarov](https://github.com/igor-makarov)
[#8967](https://github.com/CocoaPods/CocoaPods/issues/8967)
Expand Down
6 changes: 3 additions & 3 deletions lib/cocoapods/target/pod_target.rb
Expand Up @@ -415,12 +415,12 @@ def resource_paths

# @param [Specification] spec The non library spec to calculate the deployment target for.
#
# @return [String] The deployment target to use for the non library spec. If the spec provides one then that is the
# one used otherwise the one for the whole target is used.
# @return [String] The deployment target to use for the non library spec. If the non library spec explicitly
# specifies one then this is the one used otherwise the one that was determined by the analyzer is used.
#
def deployment_target_for_non_library_spec(spec)
raise ArgumentError, 'Must be a non library spec.' unless spec.non_library_specification?
spec.deployment_target(platform.name)
spec.deployment_target(platform.name.to_s) || platform.deployment_target.to_s
end

# Returns the corresponding native product type to use given the test type.
Expand Down
8 changes: 8 additions & 0 deletions spec/unit/target/pod_target_spec.rb
Expand Up @@ -753,6 +753,14 @@ module Pod
@pod_target.deployment_target_for_non_library_spec(@watermelon_spec.test_specs.first).to_s.should == '8.0'
@pod_target.deployment_target_for_non_library_spec(@watermelon_spec.app_specs.first).to_s.should == '8.0'
end

it 'returns the determined deployment target even if the podspec does not explicitly specify one' do
# The coconut spec does not specify a deployment target at all. We expect the deployment target for the non
# library spec to be set with the one by the pod target itself instead.
coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
pod_target = fixture_pod_target(coconut_spec, false, {}, [], Platform.new(:ios, '4.3'))
pod_target.deployment_target_for_non_library_spec(coconut_spec.test_specs.first).to_s.should == '4.3'
end
end

describe 'script phases support' do
Expand Down

0 comments on commit dcc702d

Please sign in to comment.