Skip to content
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

Feature: Ability to set executable to Ask to Launch #871

Merged
merged 5 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions Sources/ProjectSpec/Scheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public struct Scheme: Equatable {
public var stopOnEveryMainThreadCheckerIssue: Bool
public var language: String?
public var region: String?
public var askForAppToLaunch: Bool?
public var launchAutomaticallySubstyle: String?
public var debugEnabled: Bool
public var simulateLocation: SimulateLocation?
Expand All @@ -125,6 +126,7 @@ public struct Scheme: Equatable {
stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault,
language: String? = nil,
region: String? = nil,
askForAppToLaunch: Bool? = nil,
launchAutomaticallySubstyle: String? = nil,
debugEnabled: Bool = debugEnabledDefault,
simulateLocation: SimulateLocation? = nil
Expand All @@ -138,6 +140,7 @@ public struct Scheme: Equatable {
self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue
self.language = language
self.region = region
self.askForAppToLaunch = askForAppToLaunch
self.launchAutomaticallySubstyle = launchAutomaticallySubstyle
self.debugEnabled = debugEnabled
self.simulateLocation = simulateLocation
Expand Down Expand Up @@ -364,6 +367,10 @@ extension Scheme.Run: JSONObjectConvertible {
} else if let string: String = jsonDictionary.json(atKeyPath: "launchAutomaticallySubstyle") {
launchAutomaticallySubstyle = string
}

if let askLaunch: Bool = jsonDictionary.json(atKeyPath: "askForAppToLaunch") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about defaulting to false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the key is by default non-existing instead of false

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this value were false, then the property would be nil. Is that what is intended?

askForAppToLaunch = askLaunch
}
}
}

Expand All @@ -377,6 +384,7 @@ extension Scheme.Run: JSONEncodable {
"config": config,
"language": language,
"region": region,
"askForAppToLaunch": askForAppToLaunch,
"launchAutomaticallySubstyle": launchAutomaticallySubstyle,
]

Expand Down
1 change: 1 addition & 0 deletions Sources/XcodeGenKit/SchemeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public class SchemeGenerator {
macroExpansion: shouldExecuteOnLaunch ? nil : buildableReference,
selectedDebuggerIdentifier: (scheme.run?.debugEnabled ?? Scheme.Run.debugEnabledDefault) ? XCScheme.defaultDebugger : "",
selectedLauncherIdentifier: (scheme.run?.debugEnabled ?? Scheme.Run.debugEnabledDefault) ? XCScheme.defaultLauncher : "Xcode.IDEFoundation.Launcher.PosixSpawn",
askForAppToLaunch: scheme.run?.askForAppToLaunch,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would default here, using information from the rest of the target. If you have trouble with that, we can leave the existing behavior as the default for now.

allowLocationSimulation: allowLocationSimulation,
locationScenarioReference: locationScenarioReference,
disableMainThreadChecker: scheme.run?.disableMainThreadChecker ?? Scheme.Run.disableMainThreadCheckerDefault,
Expand Down