@@ -51,7 +51,34 @@ struct AWSLambdaBuilder: CommandPlugin {
5151 let crossCompileMethod = crossCompileArgument. first? . lowercased ( )
5252 let crossCompileToolName : String
5353 switch crossCompileMethod {
54- case " swift-static-sdk " : crossCompileToolName = " swift "
54+ case " swift-static-sdk " :
55+ crossCompileToolName = " swift "
56+ // The Static Linux SDK builds without a container, so the docker/container-specific
57+ // options do not apply. Reject them here rather than let them be silently ignored.
58+ // These flags are forwarded verbatim to the helper, so inspect the raw arguments.
59+ let incompatibleWithStaticSDK = [
60+ " --base-docker-image " ,
61+ " --swift-version " ,
62+ " --disable-docker-image-update " ,
63+ " --base-oci-image " ,
64+ ]
65+ for flag in incompatibleWithStaticSDK where arguments. contains ( flag) {
66+ throw BuilderErrors . invalidArgument (
67+ " ' \( flag) ' cannot be used with '--cross-compile swift-static-sdk'; it targets a "
68+ + " container-based build. Remove it, or choose '--cross-compile docker' or 'container'. "
69+ )
70+ }
71+ // The OCI image build requires a container CLI, so it is incompatible too. Match the
72+ // value that follows --archive-format rather than a bare "oci" token anywhere.
73+ if let formatIndex = arguments. firstIndex ( of: " --archive-format " ) ,
74+ arguments. indices. contains ( formatIndex + 1 ) ,
75+ arguments [ formatIndex + 1 ] . lowercased ( ) == " oci "
76+ {
77+ throw BuilderErrors . invalidArgument (
78+ " '--archive-format oci' cannot be used with '--cross-compile swift-static-sdk'; "
79+ + " building an OCI image requires a container CLI. Use '--cross-compile docker' or 'container'. "
80+ )
81+ }
5582 case " container " : crossCompileToolName = " container "
5683 default : crossCompileToolName = " docker "
5784 }
0 commit comments