File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -183,4 +183,7 @@ $ SWIFT_EXEC=/path/to/my/built/swiftc swift build
183
183
184
184
SwiftPM computes the path of runtime libraries relative to where it is
185
185
installed. This path can be overridden by setting the environment variable
186
- ` SWIFTPM_PD_LIBS` to a directory containing the libraries.
186
+ ` SWIFTPM_PD_LIBS` to a directory containing the libraries. This can be a list of
187
+ absolute search paths separated by colon (" :" ). SwiftPM will choose the first
188
+ path which exists on disk. If none of the path are present on disk, it will fall
189
+ back to built-in computation.
Original file line number Diff line number Diff line change @@ -240,11 +240,18 @@ public final class UserToolchain: Toolchain {
240
240
] + destination. extraCCFlags
241
241
242
242
// Compute the path of directory containing the PackageDescription libraries.
243
- let pdLibDir : AbsolutePath
244
- if let pdLibDirEnvStr = getenv ( " SWIFTPM_PD_LIBS " ) , let pdLibDirEnv = try ? AbsolutePath ( validating: pdLibDirEnvStr) {
245
- pdLibDir = pdLibDirEnv
246
- } else {
247
- pdLibDir = binDir. parentDirectory. appending ( components: " lib " , " swift " , " pm " )
243
+ var pdLibDir = binDir. parentDirectory. appending ( components: " lib " , " swift " , " pm " )
244
+
245
+ // Look for an override in the env.
246
+ if let pdLibDirEnvStr = getenv ( " SWIFTPM_PD_LIBS " ) {
247
+ // We pick the first path which exists in a colon seperated list.
248
+ let paths = pdLibDirEnvStr. split ( separator: " : " ) . map ( String . init)
249
+ for pathString in paths {
250
+ if let path = try ? AbsolutePath ( validating: pathString) , localFileSystem. exists ( path) {
251
+ pdLibDir = path
252
+ break
253
+ }
254
+ }
248
255
}
249
256
250
257
manifestResources = UserManifestResources (
You can’t perform that action at this time.
0 commit comments