From ea5ae664c88a03930034a450e12e2352b37447bd Mon Sep 17 00:00:00 2001 From: Boris Buegling Date: Fri, 16 Dec 2022 18:25:53 -0800 Subject: [PATCH] Disable VFS overlay on Windows 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. --- Sources/PackageLoading/ManifestLoader.swift | 9 ++++++++- Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Sources/PackageLoading/ManifestLoader.swift b/Sources/PackageLoading/ManifestLoader.swift index 479e58107d1..295ac695272 100644 --- a/Sources/PackageLoading/ManifestLoader.swift +++ b/Sources/PackageLoading/ManifestLoader.swift @@ -512,10 +512,17 @@ public final class ManifestLoader: ManifestLoaderProtocol { let manifestTempFilePath = tempDir.appending(component: "manifest.swift") try localFileSystem.writeFileContents(manifestTempFilePath, bytes: ByteString(manifestPreamble.contents + manifestContents)) + #if os(Windows) + // On Windows, we seem to have issues with the VFS overlay, so let's disable it for now. + let effectiveManifestPath = manifestTempFilePath + let vfsOverlayTempFilePath: AbsolutePath? = nil + #else + let effectiveManifestPath = manifestPath let vfsOverlayTempFilePath = tempDir.appending(component: "vfs.yaml") try VFSOverlay(roots: [ VFSOverlay.File(name: manifestPath.pathString, externalContents: manifestTempFilePath.pathString) ]).write(to: vfsOverlayTempFilePath, fileSystem: localFileSystem) + #endif validateImports(manifestPath: manifestTempFilePath, toolsVersion: toolsVersion, callbackQueue: callbackQueue) { result in dispatchPrecondition(condition: .onQueue(callbackQueue)) @@ -524,7 +531,7 @@ public final class ManifestLoader: ManifestLoaderProtocol { try result.get() try self.evaluateManifest( - at: manifestPath, + at: effectiveManifestPath, vfsOverlayPath: vfsOverlayTempFilePath, packageIdentity: packageIdentity, toolsVersion: toolsVersion, diff --git a/Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift b/Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift index a54268bc743..d65ed94b289 100644 --- a/Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift +++ b/Tests/PackageLoadingTests/PD_5_6_LoadingTests.swift @@ -215,6 +215,10 @@ class PackageDescription5_6LoadingTests: PackageDescriptionLoadingTests { /// Tests access to the package's directory contents. func testPackageContextDirectory() throws { + #if os(Windows) + throw XCTSkip("Skipping since this tests does not fully work without the VFS overlay which is currently disabled on Windows") + #endif + let content = """ import PackageDescription import Foundation