Skip to content

Commit ca73b29

Browse files
authored
Make sure we don't get backslashes in the Prebuilts Manifest (#9112)
We are running into cases where, if the Windows prebuilts build runs last, it's the one producing the prebuilts manifest. Since we're using RelativePath to for the library include paths, it's resulting in Windows paths being used and that fails on the other platforms. This change makes sure we always use forward slashes which will work on all platforms. Note to do this we're copying over the manifest types to the BuildPrebuilts script temporarily to so we don't need to make changes in 6.2.0. We'll revisit this for the next release where we probably should use per platform JSON files.
1 parent add4f13 commit ca73b29

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/Workspace/Workspace+Prebuilts.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extension Workspace {
5454
public let name: String
5555
public var products: [String]
5656
public var cModules: [String]?
57-
public var includePath: [RelativePath]?
57+
public var includePath: [String]?
5858
public var artifacts: [Artifact]?
5959

6060
public var id: String { name }
@@ -81,7 +81,7 @@ extension Workspace {
8181
self.name = name
8282
self.products = products
8383
self.cModules = cModules
84-
self.includePath = includePath
84+
self.includePath = includePath?.map({ $0.pathString.replacingOccurrences(of: "\\", with: "/") })
8585
self.artifacts = artifacts
8686
}
8787
}
@@ -640,7 +640,7 @@ extension Workspace {
640640
path: path,
641641
checkoutPath: checkoutPath,
642642
products: library.products,
643-
includePath: library.includePath,
643+
includePath: try library.includePath?.map({ try RelativePath(validating: $0) }),
644644
cModules: library.cModules ?? []
645645
)
646646
addedPrebuilts.add(managedPrebuilt)

Sources/swift-build-prebuilts/BuildPrebuilts.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Artifact: Codable {
3030
var checksum: String
3131
var libraryName: String?
3232
var products: [String]?
33-
var includePath: [RelativePath]?
33+
var includePath: [String]?
3434
var cModules: [String]? // deprecated, includePath is the way forward
3535
var swiftVersion: String?
3636
}
@@ -222,7 +222,7 @@ struct BuildPrebuilts: AsyncParsableCommand {
222222
checksum: checksum,
223223
libraryName: libraryName,
224224
products: package.products.map(\.name),
225-
includePath: cModules.map({ $0.includeDir.relative(to: repoDir ) }),
225+
includePath: cModules.map({ $0.includeDir.relative(to: repoDir ).pathString.replacingOccurrences(of: "\\", with: "/") }),
226226
swiftVersion: swiftVersion
227227
)
228228

0 commit comments

Comments
 (0)