Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
### Changed
- Targets in the generated project now follow the declaration order from the source spec (Xcode sidebar, `xcodebuild -list` output). Previously they were always sorted alphabetically. Applies to both YAML and JSON specs. Declaration order is now also preserved for targets whose `platform`/`name` come from a target template and for targets whose key is a `${VARIABLE}`. #1619 @mirkokg

### Fixed
- Preserve nested target attributes such as `SystemCapabilities` as native PBX dictionaries #1643 @TblKBA

### Internal
- Update to XcodeProj 9.14.0 #1629 @philprime

Expand Down
4 changes: 4 additions & 0 deletions Sources/ProjectSpec/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ extension ProjectAttribute {
self = .array(array)
} else if let object = value as? PBXObject {
self = .targetReference(object)
} else if let dictionary = value as? [String: [String: Any]] {
self = .attributeDictionary(
dictionary.mapValues { $0.mapValues { ProjectAttribute(any: $0) } }
)
} else {
self = .string("\(value)")
}
Expand Down
23 changes: 23 additions & 0 deletions Tests/XcodeGenKitTests/PBXProjGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,29 @@ class PBXProjGeneratorTests: XCTestCase {
XCTAssertEqual(pbxProject.attributes[lastUpgradeKey]?.stringValue, lastUpgradeValue)
}
}

func testNestedTargetAttributesAreGeneratedAsDictionaries() throws {
let target = Target(
name: "App",
type: .application,
platform: .iOS,
attributes: [
"SystemCapabilities": [
"com.apple.HealthKit": ["enabled": 1],
],
]
)
let pbxProj = try Project(name: "Test", targets: [target]).generatePbxProj()
let pbxProject = try XCTUnwrap(pbxProj.projects.first)
let pbxTarget = try XCTUnwrap(pbxProject.targets.first)

XCTAssertEqual(
pbxProject.targetAttributes[pbxTarget]?["SystemCapabilities"],
.attributeDictionary([
"com.apple.HealthKit": ["enabled": .string("1")],
])
)
}

func testDefaultLastUpgradeCheckWhenUserDidNotSpecifyValue() throws {
let lastUpgradeKey = "LastUpgradeCheck"
Expand Down