Skip to content

Commit 6231a75

Browse files
authored
Disable VFS overlay on Windows (#5980)
It looks like we're seeing an issue with the use of the VFS overlay on Windows which leads to manifests being loaded from the current working directory instead of the path mapped by the VFS. While we are investigating a solution, disable the use of the overlay on Windows since its intent is having more correct paths in diagnostics which is mostly cosmetic.
1 parent 4d312bd commit 6231a75

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,17 @@ public final class ManifestLoader: ManifestLoaderProtocol {
512512
let manifestTempFilePath = tempDir.appending(component: "manifest.swift")
513513
try localFileSystem.writeFileContents(manifestTempFilePath, bytes: ByteString(manifestPreamble.contents + manifestContents))
514514

515+
#if os(Windows)
516+
// On Windows, we seem to have issues with the VFS overlay, so let's disable it for now.
517+
let effectiveManifestPath = manifestTempFilePath
518+
let vfsOverlayTempFilePath: AbsolutePath? = nil
519+
#else
520+
let effectiveManifestPath = manifestPath
515521
let vfsOverlayTempFilePath = tempDir.appending(component: "vfs.yaml")
516522
try VFSOverlay(roots: [
517523
VFSOverlay.File(name: manifestPath.pathString, externalContents: manifestTempFilePath.pathString)
518524
]).write(to: vfsOverlayTempFilePath, fileSystem: localFileSystem)
525+
#endif
519526

520527
validateImports(manifestPath: manifestTempFilePath, toolsVersion: toolsVersion, callbackQueue: callbackQueue) { result in
521528
dispatchPrecondition(condition: .onQueue(callbackQueue))
@@ -524,7 +531,7 @@ public final class ManifestLoader: ManifestLoaderProtocol {
524531
try result.get()
525532

526533
try self.evaluateManifest(
527-
at: manifestPath,
534+
at: effectiveManifestPath,
528535
vfsOverlayPath: vfsOverlayTempFilePath,
529536
packageIdentity: packageIdentity,
530537
toolsVersion: toolsVersion,

Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class PackageDescription5_6LoadingTests: PackageDescriptionLoadingTests {
215215

216216
/// Tests access to the package's directory contents.
217217
func testPackageContextDirectory() throws {
218+
#if os(Windows)
219+
throw XCTSkip("Skipping since this tests does not fully work without the VFS overlay which is currently disabled on Windows")
220+
#endif
221+
218222
let content = """
219223
import PackageDescription
220224
import Foundation

0 commit comments

Comments
 (0)