@@ -28,7 +28,7 @@ struct AWSLambdaDeployer: CommandPlugin {
28
28
29
29
// gather file paths
30
30
#if swift(>=6.0)
31
- let samDeploymentDescriptorFilePath = " \( context. package . directoryURL) / template.yaml"
31
+ let samDeploymentDescriptorFilePath = " \( context. package . directoryURL. path ( ) ) template.yaml "
32
32
#else
33
33
let samDeploymentDescriptorFilePath = " \( context. package . directory) /template.yaml "
34
34
#endif
@@ -136,7 +136,7 @@ struct AWSLambdaDeployer: CommandPlugin {
136
136
137
137
let _ = try packageManager. build (
138
138
. product( " AWSLambdaDeploymentDescriptor " ) ,
139
- parameters: . init( configuration: . release , echoLogs: true )
139
+ parameters: . init( configuration: . inherit , echoLogs: true )
140
140
)
141
141
}
142
142
@@ -169,10 +169,10 @@ struct AWSLambdaDeployer: CommandPlugin {
169
169
let sharedLibraryName = " AWSLambdaDeploymentDescriptor " // provided by the swift lambda runtime
170
170
var cmd = [
171
171
" \" \( swiftExecutable. path ( ) ) \" " ,
172
- " -L \( projectDirectory. path ( ) ) / .build/\( buildConfiguration) / " ,
173
- " -I \( projectDirectory. path ( ) ) / .build/\( buildConfiguration) / " ,
172
+ " -L \( projectDirectory. path ( ) ) .build/ \( buildConfiguration) / " ,
173
+ " -I \( projectDirectory. path ( ) ) .build/ \( buildConfiguration) /Modules " ,
174
174
" -l \( sharedLibraryName) " ,
175
- " \" \ ( deploymentDescriptorFilePath) \" "
175
+ " \( deploymentDescriptorFilePath) "
176
176
]
177
177
if let archive = archivePath {
178
178
cmd = cmd + [ " --archive-path " , archive]
@@ -186,25 +186,12 @@ struct AWSLambdaDeployer: CommandPlugin {
186
186
print ( " Swift command: \n \n \( helperCmd) \n " )
187
187
}
188
188
189
- // create and execute a plugin helper to run the "swift" command
190
- let helperFilePath = " \( FileManager . default. temporaryDirectory. path) /compile.sh "
191
- FileManager . default. createFile ( atPath: helperFilePath,
192
- contents: helperCmd. data ( using: . utf8) ,
193
- attributes: [ . posixPermissions: 0o755 ] )
194
- defer { try ? FileManager . default. removeItem ( atPath: helperFilePath) }
195
-
196
- // running the swift command directly from the plugin does not work 🤷♂️
197
- // the below launches a bash shell script that will launch the `swift` command
198
- let samDeploymentDescriptor = try Utils . execute (
199
- executable: shellExecutable,
200
- arguments: [ " -c " , helperFilePath] ,
201
- customWorkingDirectory: projectDirectory,
202
- logLevel: verboseLogging ? . debug : . silent)
203
- // let samDeploymentDescriptor = try Utils.execute(
204
- // executable: swiftExecutable,
205
- // arguments: Array(cmd.dropFirst()),
206
- // customWorkingDirectory: projectDirectory,
207
- // logLevel: verboseLogging ? .debug : .silent)
189
+ // launch the command to compile and execute Deploy.swift
190
+ let samDeploymentDescriptor = try Utils . execute (
191
+ executable: swiftExecutable,
192
+ arguments: Array ( cmd. dropFirst ( ) ) ,
193
+ customWorkingDirectory: projectDirectory,
194
+ logLevel: verboseLogging ? . debug : . silent)
208
195
209
196
// write the generated SAM deployment descriptor to disk
210
197
if FileManager . default. fileExists ( atPath: samDeploymentDescriptorFilePath) && !force {
@@ -289,7 +276,7 @@ struct AWSLambdaDeployer: CommandPlugin {
289
276
force: Bool ,
290
277
verboseLogging: Bool ) throws {
291
278
292
- let samConfigFilePath = " \( projetDirectory) / samconfig.toml" // the default value for SAM
279
+ let samConfigFilePath = " \( projetDirectory. path ( ) ) samconfig.toml " // the default value for SAM
293
280
let samConfigTemplate = """
294
281
version = 0.1
295
282
[ \( buildConfiguration) ]
0 commit comments