Skip to content

Commit e34bdb2

Browse files
authored
Merge pull request #2358 from aciidb0mb3r/prefer-parsable
Prefer swiftinterface for PackageDescription
2 parents 6971a84 + 6f86920 commit e34bdb2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,19 @@ public final class ManifestLoader: ManifestLoaderProtocol {
444444
// Pass the fd in arguments.
445445
cmd += ["-fileno", "\(file.fileHandle.fileDescriptor)"]
446446

447+
// Prefer swiftinterface if both swiftmodule and swiftinterface files are present.
448+
//
449+
// This will avoid failures during incremental builds when the
450+
// slate swiftmodule file is still present from the previous
451+
// install. We should be able to remove this after some
452+
// transition period.
453+
var env = ProcessEnv.vars
454+
#if os(macOS)
455+
env["SWIFT_FORCE_MODULE_LOADING"] = "prefer-parseable"
456+
#endif
457+
447458
// Run the command.
448-
let result = try Process.popen(arguments: cmd)
459+
let result = try Process.popen(arguments: cmd, environment: env)
449460
let output = try (result.utf8Output() + result.utf8stderrOutput()).spm_chuzzle()
450461
manifestParseResult.compilerOutput = output
451462

0 commit comments

Comments
 (0)