From 9ccdb9e1abfe91f258678c04ba07470b9fd6e044 Mon Sep 17 00:00:00 2001 From: George Navarro Date: Fri, 18 Apr 2025 12:02:32 -0700 Subject: [PATCH 1/3] Added `customWorkingDirectory` and `useCustomWorkingDirectory` properties to `Scheme.Run` --- Sources/ProjectSpec/Scheme.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/ProjectSpec/Scheme.swift b/Sources/ProjectSpec/Scheme.swift index e417fcf0..2af3f158 100644 --- a/Sources/ProjectSpec/Scheme.swift +++ b/Sources/ProjectSpec/Scheme.swift @@ -132,6 +132,7 @@ public struct Scheme: Equatable { public static let disableThreadPerformanceCheckerDefault = false public static let debugEnabledDefault = true public static let enableGPUValidationModeDefault = true + public static let useCustomWorkingDirectoryDefault = false public var config: String? public var commandLineArguments: [String: Bool] @@ -153,6 +154,8 @@ public struct Scheme: Equatable { public var storeKitConfiguration: String? public var customLLDBInit: String? public var macroExpansion: String? + public var customWorkingDirectory: String? + public var useCustomWorkingDirectory: Bool public init( config: String? = nil, @@ -174,7 +177,9 @@ public struct Scheme: Equatable { simulateLocation: SimulateLocation? = nil, storeKitConfiguration: String? = nil, customLLDBInit: String? = nil, - macroExpansion: String? = nil + macroExpansion: String? = nil, + customWorkingDirectory: String? = nil, + useCustomWorkingDirectory: Bool = useCustomWorkingDirectoryDefault ) { self.config = config self.commandLineArguments = commandLineArguments @@ -195,6 +200,8 @@ public struct Scheme: Equatable { self.storeKitConfiguration = storeKitConfiguration self.customLLDBInit = customLLDBInit self.macroExpansion = macroExpansion + self.customWorkingDirectory = customWorkingDirectory + self.useCustomWorkingDirectory = useCustomWorkingDirectory } } @@ -523,6 +530,8 @@ extension Scheme.Run: JSONObjectConvertible { } customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit") macroExpansion = jsonDictionary.json(atKeyPath: "macroExpansion") + customWorkingDirectory = jsonDictionary.json(atKeyPath: "customWorkingDirectory") + useCustomWorkingDirectory = jsonDictionary.json(atKeyPath: "useCustomWorkingDirectory") ?? Scheme.Run.useCustomWorkingDirectoryDefault } } From 787213d433c4006520d0e36384f2ffbd7405616b Mon Sep 17 00:00:00 2001 From: George Navarro Date: Fri, 18 Apr 2025 12:03:16 -0700 Subject: [PATCH 2/3] Use new `customWorkingDirectory` and `useCustomWorkingDirectory` when generating `XCScheme.LaunchAction` --- Sources/XcodeGenKit/SchemeGenerator.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/XcodeGenKit/SchemeGenerator.swift b/Sources/XcodeGenKit/SchemeGenerator.swift index 69ad80fa..64f2661e 100644 --- a/Sources/XcodeGenKit/SchemeGenerator.swift +++ b/Sources/XcodeGenKit/SchemeGenerator.swift @@ -355,6 +355,8 @@ public class SchemeGenerator { selectedDebuggerIdentifier: selectedDebuggerIdentifier(for: schemeTarget, run: scheme.run), selectedLauncherIdentifier: selectedLauncherIdentifier(for: schemeTarget, run: scheme.run), askForAppToLaunch: scheme.run?.askForAppToLaunch, + customWorkingDirectory: scheme.run?.customWorkingDirectory, + useCustomWorkingDirectory: scheme.run?.useCustomWorkingDirectory ?? Scheme.Run.useCustomWorkingDirectoryDefault, allowLocationSimulation: allowLocationSimulation, locationScenarioReference: locationScenarioReference, enableGPUFrameCaptureMode: scheme.run?.enableGPUFrameCaptureMode ?? XCScheme.LaunchAction.defaultGPUFrameCaptureMode, From 5f3e110cad628f37d3168539478d9d08a142ceab Mon Sep 17 00:00:00 2001 From: George Navarro Date: Fri, 18 Apr 2025 12:03:48 -0700 Subject: [PATCH 3/3] Updated ProjectSpec.md to document new `customWorkingDirectory` and `useCustomWorkingDirectory` properties --- Docs/ProjectSpec.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index 83166e9c..52de6a49 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -1054,6 +1054,8 @@ A multiline script can be written using the various YAML multiline methods, for ### Run Action - [ ] **executable**: **String** - the name of the target to launch as an executable. Defaults to the first runnable build target in the scheme, or the first build target if a runnable build target is not found - [ ] **customLLDBInit**: **String** - the absolute path to the custom `.lldbinit` file +- [ ] **customWorkingDirectory**: **String** - a path to use as the working directory when launching the executable. +- [ ] **useCustomWorkingDirectory**: **Bool** - sets if the custom working directory should be used. This defaults to false. ### Test Action