Skip to content

Commit dc26b11

Browse files
committed
Ignore prebuilt module cache when building the prebuilt module cache
When building modules for an SDK, we need to ignore any existing prebuilt modules to avoid building a partial prebult module cache. Do so by passing an intentially-bad path for the prebuilt module cache path that's derived from the output path (but not the same as that path). This prohibits the frontend scanning job from adding the default prebuilt module cache path, while ensuring that we find no prebuilt modules. Fixes rdar://131183526.
1 parent ab6d90f commit dc26b11

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ do {
157157
try localFileSystem.createDirectory(mcpPath, recursive: true)
158158
}
159159
}
160+
161+
// When building modules for an SDK, ignore any existing prebuilt modules.
162+
// modules. Do so by passing an intentially-bad path for the prebuilt
163+
// module cache path that's derived from the output path (but not the same
164+
// as that path). This prohibits the frontend scanning job from adding the
165+
// default prebuilt module cache path, while ensuring that we find no
166+
// prebuilt modules during this scan.
167+
args.append("-Xfrontend")
168+
args.append("-prebuilt-module-cache-path")
169+
args.append("-Xfrontend")
170+
args.append(outputDir.appending(component: "__nonexistent__").pathString)
171+
160172
let baselineABIDir = try getArgumentAsPath("-baseline-abi-dir")
161173
var driver = try Driver(args: args,
162174
diagnosticsOutput: .engine(diagnosticsEngine),

0 commit comments

Comments
 (0)