@@ -28,6 +28,11 @@ struct AWSLambdaPackager: CommandPlugin {
2828 throw Errors . unknownProduct ( " no appropriate products found to package " )
2929 }
3030
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+
3136 let builtProducts : [ LambdaProduct : Path ]
3237 if self . isAmazonLinux2 ( ) {
3338 // build directly on the machine
@@ -85,7 +90,7 @@ struct AWSLambdaPackager: CommandPlugin {
8590 let buildOutputPathCommand = " swift build -c \( buildConfiguration. rawValue) --show-bin-path "
8691 let dockerBuildOutputPath = try self . execute (
8792 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] ,
8994 logLevel: verboseLogging ? . debug : . silent
9095 )
9196 let buildOutputPath = Path ( dockerBuildOutputPath. replacingOccurrences ( of: " /workspace " , with: packageDirectory. string) )
@@ -263,6 +268,7 @@ struct AWSLambdaPackager: CommandPlugin {
263268private struct Configuration : CustomStringConvertible {
264269 public let outputDirectory : Path
265270 public let products : [ Product ]
271+ public let explicitProducts : Bool
266272 public let buildConfiguration : PackageManager . BuildConfiguration
267273 public let verboseLogging : Bool
268274 public let baseDockerImage : String
@@ -291,7 +297,8 @@ private struct Configuration: CustomStringConvertible {
291297 self . outputDirectory = context. pluginWorkDirectory. appending ( subpath: " \( AWSLambdaPackager . self) " )
292298 }
293299
294- if !productsArgument. isEmpty {
300+ self . explicitProducts = !productsArgument. isEmpty
301+ if self . explicitProducts {
295302 let products = try context. package . products ( named: productsArgument)
296303 for product in products {
297304 guard product is ExecutableProduct else {
0 commit comments