Skip to content

Commit ca8cacd

Browse files
committed
Allow empty build settings arrays
In this case: ```swift let linkerSettings: [LinkerSetting] if ProcessInfo.processInfo.environment["SOMETHING"] == nil { linkerSettings = [] } else { linkerSettings = [ .unsafeFlags(["something"]), ] } // pass linkerSettings to a .target below ``` It's useful to be able to pass empty lists here.
1 parent 0d26325 commit ca8cacd

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

Sources/PackageLoading/PackageDescription4Loader.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,7 @@ extension ManifestBuilder {
172172
}
173173

174174
func parseBuildSettings(_ json: JSON, tool: TargetBuildSettingDescription.Tool, settingName: String) throws -> [TargetBuildSettingDescription.Setting] {
175-
176175
let declaredSettings = try json.getArray()
177-
if declaredSettings.isEmpty {
178-
throw ManifestParseError.runtimeManifestErrors(["\(settingName) cannot be an empty array; provide at least one setting or remove it"])
179-
}
180-
181176
return try declaredSettings.map({
182177
try parseBuildSetting($0, tool: tool)
183178
})

Tests/PackageLoadingTests/PD5LoadingTests.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,7 @@ class PackageDescription5LoadingTests: PackageDescriptionLoadingTests {
431431
)
432432
"""
433433

434-
do {
435-
try loadManifestThrowing(stream.bytes) { _ in }
436-
XCTFail("Unexpected success")
437-
} catch ManifestParseError.runtimeManifestErrors(let errors) {
438-
XCTAssertEqual(errors, ["cSettings cannot be an empty array; provide at least one setting or remove it"])
439-
}
434+
try loadManifestThrowing(stream.bytes) { _ in }
440435
}
441436

442437
func testWindowsPlatform() throws {

0 commit comments

Comments
 (0)