@@ -149,10 +149,11 @@ extension Plugin {
149
149
// package is the one we'll set the context's `package` property to.
150
150
let context : PluginContext
151
151
let target : Target
152
+ let pluginWorkDirectory : URL
152
153
do {
153
154
var deserializer = PluginContextDeserializer ( wireInput)
154
155
let package = try deserializer. package ( for: rootPackageId)
155
- let pluginWorkDirectory = try deserializer. url ( for: wireInput. pluginWorkDirId)
156
+ pluginWorkDirectory = try deserializer. url ( for: wireInput. pluginWorkDirId)
156
157
let toolSearchDirectories = try wireInput. toolSearchDirIds. map {
157
158
try deserializer. url ( for: $0)
158
159
}
@@ -208,7 +209,8 @@ extension Plugin {
208
209
displayName: displayName,
209
210
executable: executable,
210
211
arguments: arguments,
211
- environment: environment
212
+ environment: environment,
213
+ workingDirectory: pluginWorkDirectory
212
214
)
213
215
let message = PluginToHostMessage . defineBuildCommand (
214
216
configuration: command,
@@ -222,7 +224,8 @@ extension Plugin {
222
224
displayName: displayName,
223
225
executable: executable,
224
226
arguments: arguments,
225
- environment: environment
227
+ environment: environment,
228
+ workingDirectory: pluginWorkDirectory
226
229
)
227
230
let message = PluginToHostMessage . definePrebuildCommand (
228
231
configuration: command,
@@ -248,6 +251,7 @@ extension Plugin {
248
251
249
252
// Deserialize the context from the wire input structures, and create a record for us to pass to the XcodeProjectPlugin library.
250
253
let record : XcodeProjectPluginInvocationRecord
254
+ let pluginWorkDirectory : URL
251
255
do {
252
256
var deserializer = PluginContextDeserializer ( wireInput)
253
257
let xcodeProject = try deserializer. xcodeProject ( for: rootProjectId)
@@ -256,7 +260,7 @@ extension Plugin {
256
260
pluginGeneratedSources: try generatedSources. map { try deserializer. url ( for: $0) } ,
257
261
pluginGeneratedResources: try generatedResources. map { try deserializer. url ( for: $0) }
258
262
)
259
- let pluginWorkDirectory = try deserializer. url ( for: wireInput. pluginWorkDirId)
263
+ pluginWorkDirectory = try deserializer. url ( for: wireInput. pluginWorkDirId)
260
264
let toolSearchDirectories = try wireInput. toolSearchDirIds. map {
261
265
try deserializer. url ( for: $0)
262
266
}
@@ -288,7 +292,7 @@ extension Plugin {
288
292
executable: exec,
289
293
arguments: args,
290
294
environment: env,
291
- workingDirectory: nil )
295
+ workingDirectory: pluginWorkDirectory )
292
296
let message = PluginToHostMessage . defineBuildCommand (
293
297
configuration: command,
294
298
inputFiles: inputs,
@@ -301,7 +305,7 @@ extension Plugin {
301
305
executable: exec,
302
306
arguments: args,
303
307
environment: env,
304
- workingDirectory: nil )
308
+ workingDirectory: pluginWorkDirectory )
305
309
let message = PluginToHostMessage . definePrebuildCommand (
306
310
configuration: command,
307
311
outputFilesDirectory: outdir)
0 commit comments