Skip to content

Commit 3b9b66c

Browse files
authored
Change symlink error to warning (#3558)
Cherrypicked from #3490
1 parent 27bb7db commit 3b9b66c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Sources/Build/BuildOperation.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,18 @@ public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildS
137137
component: buildParameters.configuration.dirname
138138
)
139139
if localFileSystem.exists(oldBuildPath) {
140-
try localFileSystem.removeFileTree(oldBuildPath)
140+
do { try localFileSystem.removeFileTree(oldBuildPath) }
141+
catch {
142+
diagnostics.emit(warning: "unable to delete \(oldBuildPath), skip creating symbolic link: \(error)")
143+
return
144+
}
145+
}
146+
147+
do {
148+
try localFileSystem.createSymbolicLink(oldBuildPath, pointingAt: buildParameters.buildPath, relative: true)
149+
} catch {
150+
diagnostics.emit(warning: "unable to create symbolic link at \(oldBuildPath): \(error)")
141151
}
142-
try localFileSystem.createSymbolicLink(oldBuildPath, pointingAt: buildParameters.buildPath, relative: true)
143152
}
144153

145154
/// Compute the llbuild target name using the given subset.

0 commit comments

Comments
 (0)