Skip to content
Merged
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
7 changes: 4 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Sources/XcodeProj/Objects/Project/PBXProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,7 @@ extension PBXProject: PlistSerializable {
plistTargetAttributes[reference.value] = value
}

if !plistTargetAttributes.isEmpty {
plistAttributes[PBXProject.targetAttributesKey] = .attributeDictionary(plistTargetAttributes)
}
plistAttributes[PBXProject.targetAttributesKey] = .attributeDictionary(plistTargetAttributes)

dictionary["attributes"] = plistAttributes.plist()

Expand Down
8 changes: 3 additions & 5 deletions Tests/XcodeProjTests/Objects/Project/PBXProjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class PBXProjectTests: XCTestCase {
XCTAssertEqual(attributes, expectedAttributes)
}

func test_plistKeyAndValue_doesntReturnTargetAttributes_when_itsEmpty() throws {
func test_plistKeyAndValue_returnsEmptyTargetAttributes_when_itsEmpty() throws {
// Given
let target = PBXTarget(name: "")
target.reference.fix("app")
Expand All @@ -81,14 +81,12 @@ final class PBXProjectTests: XCTestCase {
minimizedProjectReferenceProxies: nil,
mainGroup: PBXGroup())

project.setTargetAttributes(["custom": "abc", "TestTargetID": .targetReference(testTarget)], target: target)

// When
let plist = try project.plistKeyAndValue(proj: PBXProj(), reference: "")

// Then
let attributes: [CommentedString: PlistValue]? = plist.value.dictionary?["TargetAttributes"]?.dictionary
XCTAssertNil(attributes)
let attributes = plist.value.dictionary?["attributes"]?.dictionary?["TargetAttributes"]?.dictionary
XCTAssertEqual(attributes, [:])
}

func test_addLocalSwiftPackage() throws {
Expand Down
Loading