Skip to content

Commit 97b129e

Browse files
committed
[PrebuiltModuleGen] Ensure the dependency scanner always ignores existing prebuilt modules
1 parent 4b5ffac commit 97b129e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Sources/swift-build-sdk-interfaces/main.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ do {
169169
args.append("-Xfrontend")
170170
args.append(outputDir.appending(component: "__nonexistent__").pathString)
171171

172+
// If the compiler/scanner supports it, instruct it to ignore any existing prebuilt
173+
// modules for which a textual interface is discovered, ensuring that modules
174+
// always build from interface when one is available.
175+
if let supportedFlagsTestDriver = try? Driver(args: ["swiftc", "-v"],
176+
executor: executor,
177+
compilerExecutableDir: swiftcPath.parentDirectory),
178+
supportedFlagsTestDriver.isFrontendArgSupported(.moduleLoadMode) {
179+
args.append("-Xfrontend")
180+
args.append("-module-load-mode")
181+
args.append("-Xfrontend")
182+
args.append("only-interface")
183+
}
184+
172185
let baselineABIDir = try getArgumentAsPath("-baseline-abi-dir")
173186
var driver = try Driver(args: args,
174187
diagnosticsOutput: .engine(diagnosticsEngine),

0 commit comments

Comments
 (0)