From d4cf96f3fa9404700718fa900b9a67cf23ac03ef Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 10 Jul 2023 16:27:01 -0700 Subject: [PATCH] PackageLoading: enable the manifest VFS on Windows Ensure that the path string is escaped when emitting the paths. The VFS paths are serialised as either JSON or YAML, both of which require the path string be escaped. --- Sources/PackageLoading/ManifestLoader.swift | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Sources/PackageLoading/ManifestLoader.swift b/Sources/PackageLoading/ManifestLoader.swift index b935c1e31b5..bb51f2f5076 100644 --- a/Sources/PackageLoading/ManifestLoader.swift +++ b/Sources/PackageLoading/ManifestLoader.swift @@ -538,17 +538,11 @@ public final class ManifestLoader: ManifestLoaderProtocol { let manifestTempFilePath = tempDir.appending("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("vfs.yaml") try VFSOverlay(roots: [ - VFSOverlay.File(name: manifestPath.pathString, externalContents: manifestTempFilePath.pathString) + VFSOverlay.File(name: manifestPath._nativePathString(escaped: true), + externalContents: manifestTempFilePath._nativePathString(escaped: true)) ]).write(to: vfsOverlayTempFilePath, fileSystem: localFileSystem) - #endif validateImports(manifestPath: manifestTempFilePath, toolsVersion: toolsVersion, callbackQueue: callbackQueue) { result in dispatchPrecondition(condition: .onQueue(callbackQueue)) @@ -557,7 +551,7 @@ public final class ManifestLoader: ManifestLoaderProtocol { try result.get() try self.evaluateManifest( - at: effectiveManifestPath, + at: manifestPath, vfsOverlayPath: vfsOverlayTempFilePath, packageIdentity: packageIdentity, toolsVersion: toolsVersion,