|
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 |
|
13 | 13 | import SystemPackage |
| 14 | +import Foundation |
14 | 15 |
|
15 | 16 | extension SwiftSDKGenerator { |
16 | 17 | func copyTargetSwiftFromDocker( |
@@ -109,16 +110,20 @@ extension SwiftSDKGenerator { |
109 | 110 | func copyTargetSwift(from distributionPath: FilePath, sdkDirPath: FilePath) async throws { |
110 | 111 | logger.info("Copying Swift core libraries for the target triple into Swift SDK bundle...") |
111 | 112 |
|
112 | | - for (pathWithinPackage, pathWithinSwiftSDK, ignoreIfMissing) in [ |
| 113 | + for (pathWithinPackage, pathWithinSwiftSDK, isOptional) in [ |
113 | 114 | ("lib/swift", sdkDirPath.appending("usr/lib"), false), |
114 | 115 | ("lib/swift_static", sdkDirPath.appending("usr/lib"), false), |
115 | 116 | ("lib/clang", sdkDirPath.appending("usr/lib"), true), |
116 | 117 | ("include", sdkDirPath.appending("usr"), false), |
117 | 118 | ] { |
118 | | - try await rsync( |
119 | | - from: distributionPath.appending(pathWithinPackage), |
120 | | - to: pathWithinSwiftSDK, ignoreIfMissing: ignoreIfMissing |
121 | | - ) |
| 119 | + let fromPath = distributionPath.appending(pathWithinPackage) |
| 120 | + |
| 121 | + if isOptional && !doesFileExist(at: fromPath) { |
| 122 | + logger.debug("Optional package path ignored since it does not exist", metadata: ["packagePath": .string(fromPath.string)]) |
| 123 | + continue |
| 124 | + } |
| 125 | + |
| 126 | + try await rsync(from: fromPath, to: pathWithinSwiftSDK) |
122 | 127 | } |
123 | 128 | } |
124 | 129 | } |
|
0 commit comments