mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-20 00:58:04 +03:00
Merge pull request #541 from yonaskolb/fix/multi-platform_templates
Fix multi-platform target templates
This commit is contained in:
commit
2643312519
@ -18,6 +18,7 @@
|
||||
- Fixed error when `optional` path is missing [#527](https://github.com/yonaskolb/XcodeGen/pull/527) @yonaskolb
|
||||
- Fixed excludes within included spec [#535](https://github.com/yonaskolb/XcodeGen/pull/535) @yonaskolb
|
||||
- Fixed paths in target templates within included files not being relative [#537](https://github.com/yonaskolb/XcodeGen/pull/537) @yonaskolb
|
||||
- Fix multi-platform target templates [#541](https://github.com/yonaskolb/XcodeGen/pull/541) @yonaskolb
|
||||
|
||||
## 2.2.0
|
||||
|
||||
|
@ -171,8 +171,13 @@ extension Project {
|
||||
|
||||
static func resolveProject(jsonDictionary: JSONDictionary) throws -> JSONDictionary {
|
||||
var jsonDictionary = jsonDictionary
|
||||
|
||||
// resolve multiple times so that we support both multi-platform templates,
|
||||
// as well as platform specific templates in multi-platform targets
|
||||
jsonDictionary = try Target.resolveMultiplatformTargets(jsonDictionary: jsonDictionary)
|
||||
jsonDictionary = try Target.resolveTargetTemplates(jsonDictionary: jsonDictionary)
|
||||
jsonDictionary = try Target.resolveMultiplatformTargets(jsonDictionary: jsonDictionary)
|
||||
|
||||
return jsonDictionary
|
||||
}
|
||||
}
|
||||
|
@ -590,6 +590,54 @@ class SpecLoadingTests: XCTestCase {
|
||||
try expect(target.sources) == ["nestedTemplateSource2", "nestedTemplateSource1", "templateSource", "targetSource"] // merges array in order
|
||||
try expect(target.configFiles["debug"]) == "Configs/Framework/debug.xcconfig" // replaces $target_name
|
||||
}
|
||||
|
||||
$0.it("parses cross platform target templates") {
|
||||
|
||||
let project = try getProjectSpec([
|
||||
"targets": [
|
||||
"Framework": [
|
||||
"type": "framework",
|
||||
"templates": ["temp"],
|
||||
]
|
||||
],
|
||||
"targetTemplates": [
|
||||
"temp": [
|
||||
"platform": ["iOS", "tvOS"],
|
||||
]
|
||||
],
|
||||
])
|
||||
|
||||
let iOSTarget = project.targets.first { $0.platform == .iOS }
|
||||
let tvOSTarget = project.targets.first { $0.platform == .tvOS }
|
||||
try expect(iOSTarget?.type) == .framework
|
||||
try expect(tvOSTarget?.type) == .framework
|
||||
}
|
||||
|
||||
$0.it("parses platform specific templates") {
|
||||
|
||||
let project = try getProjectSpec([
|
||||
"targets": [
|
||||
"Framework": [
|
||||
"type": "framework",
|
||||
"platform": ["iOS", "tvOS"],
|
||||
"templates": ["$platform"],
|
||||
]
|
||||
],
|
||||
"targetTemplates": [
|
||||
"iOS": [
|
||||
"sources": "A",
|
||||
],
|
||||
"tvOS": [
|
||||
"sources": "B",
|
||||
]
|
||||
],
|
||||
])
|
||||
|
||||
let iOSTarget = project.targets.first { $0.platform == .iOS }
|
||||
let tvOSTarget = project.targets.first { $0.platform == .tvOS }
|
||||
try expect(iOSTarget?.sources) == ["A"]
|
||||
try expect(tvOSTarget?.sources) == ["B"]
|
||||
}
|
||||
|
||||
$0.it("parses aggregate targets") {
|
||||
let dictionary: [String: Any] = [
|
||||
|
Loading…
Reference in New Issue
Block a user