Merge branch 'main' into sebsto/new-plugins

This commit is contained in:
Sébastien Stormacq
2025-03-13 16:20:16 +01:00
148 changed files with 2096 additions and 1324 deletions
@@ -201,11 +201,29 @@ struct Builder {
let resourcesDirectoryName = artifactURL.lastPathComponent
let relocatedResourcesDirectory = workingDirectory.appending(path: resourcesDirectoryName)
if FileManager.default.fileExists(atPath: artifactURL.path()) {
try FileManager.default.copyItem(
atPath: artifactURL.path(),
toPath: relocatedResourcesDirectory.path()
)
arguments.append(resourcesDirectoryName)
do {
try FileManager.default.copyItem(
atPath: artifactURL.path(),
toPath: relocatedResourcesDirectory.path()
)
arguments.append(resourcesDirectoryName)
} catch let error as CocoaError {
// On Linux, when the build has been done with Docker,
// the source file are owned by root
// this causes a permission error **after** the files have been copied
// see https://github.com/swift-server/swift-aws-lambda-runtime/issues/449
// see https://forums.swift.org/t/filemanager-copyitem-on-linux-fails-after-copying-the-files/77282
// because this error happens after the files have been copied, we can ignore it
// this code checks if the destination file exists
// if they do, just ignore error, otherwise throw it up to the caller.
if !(error.code == CocoaError.Code.fileWriteNoPermission
&& FileManager.default.fileExists(atPath: relocatedResourcesDirectory.path()))
{
throw error
} // else just ignore it
}
}
}
@@ -231,7 +249,7 @@ struct Builder {
USAGE: swift package --allow-network-connections docker archive
[--help] [--verbose]
[--output-directory <path>]
[--output-path <path>]
[--products <list of products>]
[--configuration debug | release]
[--swift-version <version>]
@@ -241,7 +259,7 @@ struct Builder {
OPTIONS:
--verbose Produce verbose output for debugging.
--output-directory <path> The path of the binary package.
--output-path <path> The path of the binary package.
(default is `.build/plugins/AWSLambdaPackager/outputs/...`)
--products <list> The list of executable targets to build.
(default is taken from Package.swift)