Skip to content

Allow empty build settings arrays #2880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
5 changes: 0 additions & 5 deletions Sources/PackageLoading/PackageDescription4Loader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,7 @@ extension ManifestBuilder {
}

func parseBuildSettings(_ json: JSON, tool: TargetBuildSettingDescription.Tool, settingName: String) throws -> [TargetBuildSettingDescription.Setting] {

let declaredSettings = try json.getArray()
if declaredSettings.isEmpty {
throw ManifestParseError.runtimeManifestErrors(["\(settingName) cannot be an empty array; provide at least one setting or remove it"])
}

return try declaredSettings.map({
try parseBuildSetting($0, tool: tool)
})
Expand Down
7 changes: 1 addition & 6 deletions Tests/PackageLoadingTests/PD5LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,7 @@ class PackageDescription5LoadingTests: PackageDescriptionLoadingTests {
)
"""

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

func testWindowsPlatform() throws {
Expand Down