Skip to content

Commit b01ec65

Browse files
authored
Do not generate a build parameters file if a custom one has been passed (#3693)
This already works, because it seems like the second `--buildParametersFile` option wins when invoking `xcbuild`, but it seems better to make this more explicit and more clean to not generate a file if the expectation is that it won't be used.
1 parent f6bf6b3 commit b01ec65

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Sources/XCBuildSupport/XcodeBuildSystem.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,15 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
9696
subset.pifTargetName
9797
]
9898

99-
let buildParamsFile = try createBuildParametersFile()
100-
if let buildParamsFile = buildParamsFile {
101-
arguments += ["--buildParametersFile", buildParamsFile.pathString]
99+
let buildParamsFile: AbsolutePath?
100+
// Do not generate a build parameters file if a custom one has been passed.
101+
if !buildParameters.xcbuildFlags.contains("--buildParametersFile") {
102+
buildParamsFile = try createBuildParametersFile()
103+
if let buildParamsFile = buildParamsFile {
104+
arguments += ["--buildParametersFile", buildParamsFile.pathString]
105+
}
106+
} else {
107+
buildParamsFile = nil
102108
}
103109

104110
arguments += buildParameters.xcbuildFlags
@@ -134,7 +140,7 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
134140
}
135141
}
136142

137-
func createBuildParametersFile() throws -> AbsolutePath? {
143+
func createBuildParametersFile() throws -> AbsolutePath {
138144
// Generate the run destination parameters.
139145
let runDestination = XCBBuildParameters.RunDestination(
140146
platform: "macosx",

0 commit comments

Comments
 (0)