Skip to content

Commit d5ad20e

Browse files
committed
Improve Podfile Deployment Target unification
1 parent 54316af commit d5ad20e

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Podfile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,42 @@ source 'https://cdn.cocoapods.org/'
33
project 'OHHTTPStubs.xcodeproj'
44
inhibit_all_warnings!
55

6+
DEPLOYMENT_TARGET = {
7+
IPHONEOS: '12.0',
8+
MACOSX: '10.13',
9+
TVOS: '12.0'
10+
}
11+
612
abstract_target 'TestingPods' do
713
pod 'AFNetworking', '~> 3.0'
814

915
target 'OHHTTPStubs iOS Lib Tests' do
10-
platform :ios, '12.0'
16+
platform :ios, DEPLOYMENT_TARGET[:IPHONEOS]
1117
end
1218

1319
target 'OHHTTPStubs iOS Fmk Tests' do
14-
platform :ios, '12.0'
20+
platform :ios, DEPLOYMENT_TARGET[:IPHONEOS]
1521
end
1622

1723
target 'OHHTTPStubs Mac Tests' do
18-
platform :osx, '10.13'
24+
platform :osx, DEPLOYMENT_TARGET[:MACOSX]
1925
end
2026

2127
target 'OHHTTPStubs tvOS Fmk Tests' do
22-
platform :tvos, '12.0'
28+
platform :tvos, DEPLOYMENT_TARGET[:TVOS]
2329
end
2430
end
2531

2632
# Let Pods targets inherit deployment target from the app
2733
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/4859
28-
APP_IOS_DEPLOYMENT_TARGET = Gem::Version.new('12.0')
2934
post_install do |installer|
3035
installer.pods_project.targets.each do |target|
3136
target.build_configurations.each do |configuration|
32-
pod_ios_deployment_target = Gem::Version.new(configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
33-
configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if pod_ios_deployment_target <= APP_IOS_DEPLOYMENT_TARGET
37+
DEPLOYMENT_TARGET.each do |platform, version|
38+
build_setting_name = "#{platform}_DEPLOYMENT_TARGET"
39+
pod_deployment_target = Gem::Version.new(configuration.build_settings[build_setting_name])
40+
configuration.build_settings.delete build_setting_name if pod_deployment_target <= Gem::Version.new(version)
41+
end
3442
end
3543
end
3644
end

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ SPEC REPOS:
2525
SPEC CHECKSUMS:
2626
AFNetworking: cb604b1c2bded0871f5f61f5d53653739e841d6b
2727

28-
PODFILE CHECKSUM: 35a75ba52ccf2d534e2f821cc8e754ab1b4dddc1
28+
PODFILE CHECKSUM: d2e051944f2dab6f9a12a30d3563fe1a48073f7c
2929

3030
COCOAPODS: 1.15.2

Pods/Manifest.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)