Skip to content

Feature: Custom Working Directory #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Docs/ProjectSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion Sources/ProjectSpec/Scheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -195,6 +200,8 @@ public struct Scheme: Equatable {
self.storeKitConfiguration = storeKitConfiguration
self.customLLDBInit = customLLDBInit
self.macroExpansion = macroExpansion
self.customWorkingDirectory = customWorkingDirectory
self.useCustomWorkingDirectory = useCustomWorkingDirectory
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down
2 changes: 2 additions & 0 deletions Sources/XcodeGenKit/SchemeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down