@@ -28,6 +28,11 @@ struct AWSLambdaPackager: CommandPlugin {
28
28
throw Errors . unknownProduct ( " no appropriate products found to package " )
29
29
}
30
30
31
+ if configuration. products. count > 1 && !configuration. explicitProducts {
32
+ let productNames = configuration. products. map ( \. name)
33
+ print ( " No explicit products named, building all executable products: ' \( productNames. joined ( separator: " ', ' " ) ) ' " )
34
+ }
35
+
31
36
let builtProducts : [ LambdaProduct : Path ]
32
37
if self . isAmazonLinux2 ( ) {
33
38
// build directly on the machine
@@ -85,7 +90,7 @@ struct AWSLambdaPackager: CommandPlugin {
85
90
let buildOutputPathCommand = " swift build -c \( buildConfiguration. rawValue) --show-bin-path "
86
91
let dockerBuildOutputPath = try self . execute (
87
92
executable: dockerToolPath,
88
- arguments: [ " run " , " --rm " , " -v " , " \( packageDirectory. string) :/workspace " , " -w " , " /workspace " , baseImage, " bash " , " -cl " , buildOutputPathCommand] ,
93
+ arguments: [ " run " , " --rm " , " --pull " , " always " , " - v" , " \( packageDirectory. string) :/workspace " , " -w " , " /workspace " , baseImage, " bash " , " -cl " , buildOutputPathCommand] ,
89
94
logLevel: verboseLogging ? . debug : . silent
90
95
)
91
96
let buildOutputPath = Path ( dockerBuildOutputPath. replacingOccurrences ( of: " /workspace " , with: packageDirectory. string) )
@@ -263,6 +268,7 @@ struct AWSLambdaPackager: CommandPlugin {
263
268
private struct Configuration : CustomStringConvertible {
264
269
public let outputDirectory : Path
265
270
public let products : [ Product ]
271
+ public let explicitProducts : Bool
266
272
public let buildConfiguration : PackageManager . BuildConfiguration
267
273
public let verboseLogging : Bool
268
274
public let baseDockerImage : String
@@ -291,7 +297,8 @@ private struct Configuration: CustomStringConvertible {
291
297
self . outputDirectory = context. pluginWorkDirectory. appending ( subpath: " \( AWSLambdaPackager . self) " )
292
298
}
293
299
294
- if !productsArgument. isEmpty {
300
+ self . explicitProducts = !productsArgument. isEmpty
301
+ if self . explicitProducts {
295
302
let products = try context. package . products ( named: productsArgument)
296
303
for product in products {
297
304
guard product is ExecutableProduct else {
0 commit comments