diff --git a/CHANGELOG.md b/CHANGELOG.md index b581d2e6..703be4cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Added - Added `missingConfigFiles` to `options.disabledValidations` to optionally skip checking for the existence of config files. - Added ability to automatically include Carthage related dependencies via `includeRelated: true` [#506](https://github.com/yonaskolb/XcodeGen/pull/506) @rpassis +- Added ability to customize deployment target for Multi Platform targets. [#510](https://github.com/yonaskolb/XcodeGen/pull/510) @ainopara #### Fixed - Sources outside a project spec's directory will be correctly referenced as relative paths in the project file. [#524](https://github.com/yonaskolb/XcodeGen/pull/524) diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index 7ac7c672..4347b750 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -256,6 +256,7 @@ This will provide default build settings for a certain platform. It can be any o **Multi Platform targets** You can also specify an array of platforms. This will generate a target for each platform. +If deployment target is specified, it will be used for these targets. Or else deplyment target specified in [Options](#options) will be used. If you reference the string `$platform` anywhere within the target spec, that will be replaced with the platform. The generated targets by default will have a suffix of `_$platform` applied, you can change this by specifying a `platformSuffix` or `platformPrefix`. @@ -267,6 +268,9 @@ targets: MyFramework: sources: MyFramework platform: [iOS, tvOS] + deploymentTarget: + iOS: 9.0 + tvOS: 10.0 type: framework settings: base: diff --git a/Sources/ProjectSpec/Target.swift b/Sources/ProjectSpec/Target.swift index c9f4d572..5beb82b2 100644 --- a/Sources/ProjectSpec/Target.swift +++ b/Sources/ProjectSpec/Target.swift @@ -194,6 +194,9 @@ extension Target { } platformTarget["productName"] = targetName platformTarget["settings"] = settings + if let deploymentTargets = target["deploymentTarget"] as? [String: Any] { + platformTarget["deploymentTarget"] = deploymentTargets[platform] + } crossPlatformTargets[newTargetName] = platformTarget } } else { diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift index c6d199eb..b4cdd4b9 100644 --- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift +++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift @@ -310,6 +310,7 @@ class SpecLoadingTests: XCTestCase { $0.it("parses cross platform targets") { let targetDictionary: [String: Any] = [ "platform": ["iOS", "tvOS"], + "deploymentTarget": ["iOS": 9.0, "tvOS": "10.0"], "type": "framework", "sources": ["Framework", "Framework $platform"], "settings": ["SETTING": "value_$platform"], @@ -323,6 +324,8 @@ class SpecLoadingTests: XCTestCase { target_tvOS.sources = ["Framework", "Framework tvOS"] target_iOS.settings = ["PRODUCT_NAME": "Framework", "SETTING": "value_iOS"] target_tvOS.settings = ["PRODUCT_NAME": "Framework", "SETTING": "value_tvOS"] + target_iOS.deploymentTarget = Version(major: 9, minor: 0, patch: 0) + target_tvOS.deploymentTarget = Version(major: 10, minor: 0, patch: 0) try expect(project.targets.count) == 2 try expect(project.targets) == [target_iOS, target_tvOS]