mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Add custom lldinit for a scheme (#929)
* Add customLLDBInit * Add changelog info to a valid bucket * Update PR number * Add fixture tests Co-authored-by: Bartosz Polaczyk <bartoszp@spotify.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#### Added
|
||||
- Add `Scheme.Test.TestTarget.skipped` to allow skipping of an entire test target. [#916](https://github.com/yonaskolb/XcodeGen/pull/916) @codeman9
|
||||
- Added ability to set custom LLDBInit scripts for launch and test schemes [#929](https://github.com/yonaskolb/XcodeGen/pull/929) @polac24
|
||||
|
||||
#### Fixed
|
||||
- Allow SDK dependencies to be embedded. [#922](https://github.com/yonaskolb/XcodeGen/pull/922) @k-thorat
|
||||
|
||||
@@ -782,12 +782,14 @@ 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 build target in the scheme
|
||||
- [ ] **customLLDBInit**: **String** - the absolute path to the custom `.lldbinit` file
|
||||
|
||||
### Test Action
|
||||
|
||||
- [ ] **gatherCoverageData**: **Bool** - a boolean that indicates if this scheme should gather coverage data. This defaults to false
|
||||
- [ ] **coverageTargets**: **[String]** - a list of targets to gather code coverage. Each entry can either be a simple string, or a string using [Project Reference](#project-reference)
|
||||
- [ ] **targets**: **[[Test Target](#test-target)]** - a list of targets to test. Each entry can either be a simple string, or a [Test Target](#test-target)
|
||||
- [ ] **customLLDBInit**: **String** - the absolute path to the custom `.lldbinit` file
|
||||
|
||||
#### Test Target
|
||||
- [x] **name**: **String** - The name of the target
|
||||
|
||||
@@ -113,6 +113,7 @@ public struct Scheme: Equatable {
|
||||
public var debugEnabled: Bool
|
||||
public var simulateLocation: SimulateLocation?
|
||||
public var executable: String?
|
||||
public var customLLDBInit: String?
|
||||
|
||||
public init(
|
||||
config: String,
|
||||
@@ -128,7 +129,8 @@ public struct Scheme: Equatable {
|
||||
askForAppToLaunch: Bool? = nil,
|
||||
launchAutomaticallySubstyle: String? = nil,
|
||||
debugEnabled: Bool = debugEnabledDefault,
|
||||
simulateLocation: SimulateLocation? = nil
|
||||
simulateLocation: SimulateLocation? = nil,
|
||||
customLLDBInit: String? = nil
|
||||
) {
|
||||
self.config = config
|
||||
self.commandLineArguments = commandLineArguments
|
||||
@@ -143,6 +145,7 @@ public struct Scheme: Equatable {
|
||||
self.launchAutomaticallySubstyle = launchAutomaticallySubstyle
|
||||
self.debugEnabled = debugEnabled
|
||||
self.simulateLocation = simulateLocation
|
||||
self.customLLDBInit = customLLDBInit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +166,7 @@ public struct Scheme: Equatable {
|
||||
public var language: String?
|
||||
public var region: String?
|
||||
public var debugEnabled: Bool
|
||||
public var customLLDBInit: String?
|
||||
|
||||
public struct TestTarget: Equatable, ExpressibleByStringLiteral {
|
||||
public static let randomExecutionOrderDefault = false
|
||||
@@ -216,7 +220,8 @@ public struct Scheme: Equatable {
|
||||
environmentVariables: [XCScheme.EnvironmentVariable] = [],
|
||||
language: String? = nil,
|
||||
region: String? = nil,
|
||||
debugEnabled: Bool = debugEnabledDefault
|
||||
debugEnabled: Bool = debugEnabledDefault,
|
||||
customLLDBInit: String? = nil
|
||||
) {
|
||||
self.config = config
|
||||
self.gatherCoverageData = gatherCoverageData
|
||||
@@ -230,6 +235,7 @@ public struct Scheme: Equatable {
|
||||
self.language = language
|
||||
self.region = region
|
||||
self.debugEnabled = debugEnabled
|
||||
self.customLLDBInit = customLLDBInit
|
||||
}
|
||||
|
||||
public var shouldUseLaunchSchemeArgsEnv: Bool {
|
||||
@@ -375,6 +381,7 @@ extension Scheme.Run: JSONObjectConvertible {
|
||||
if let askLaunch: Bool = jsonDictionary.json(atKeyPath: "askForAppToLaunch") {
|
||||
askForAppToLaunch = askLaunch
|
||||
}
|
||||
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,6 +415,9 @@ extension Scheme.Run: JSONEncodable {
|
||||
if let simulateLocation = simulateLocation {
|
||||
dict["simulateLocation"] = simulateLocation.toJSONValue()
|
||||
}
|
||||
if let customLLDBInit = customLLDBInit {
|
||||
dict["customLLDBInit"] = customLLDBInit
|
||||
}
|
||||
return dict
|
||||
}
|
||||
}
|
||||
@@ -439,6 +449,7 @@ extension Scheme.Test: JSONObjectConvertible {
|
||||
language = jsonDictionary.json(atKeyPath: "language")
|
||||
region = jsonDictionary.json(atKeyPath: "region")
|
||||
debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Test.debugEnabledDefault
|
||||
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,6 +479,10 @@ extension Scheme.Test: JSONEncodable {
|
||||
dict["debugEnabled"] = debugEnabled
|
||||
}
|
||||
|
||||
if let customLLDBInit = customLLDBInit {
|
||||
dict["customLLDBInit"] = customLLDBInit
|
||||
}
|
||||
|
||||
return dict
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +219,8 @@ public class SchemeGenerator {
|
||||
commandlineArguments: testCommandLineArgs,
|
||||
environmentVariables: testVariables,
|
||||
language: scheme.test?.language,
|
||||
region: scheme.test?.region
|
||||
region: scheme.test?.region,
|
||||
customLLDBInitFile: scheme.test?.customLLDBInit
|
||||
)
|
||||
|
||||
let allowLocationSimulation = scheme.run?.simulateLocation?.allow ?? true
|
||||
@@ -250,7 +251,8 @@ public class SchemeGenerator {
|
||||
environmentVariables: launchVariables,
|
||||
language: scheme.run?.language,
|
||||
region: scheme.run?.region,
|
||||
launchAutomaticallySubstyle: scheme.run?.launchAutomaticallySubstyle
|
||||
launchAutomaticallySubstyle: scheme.run?.launchAutomaticallySubstyle,
|
||||
customLLDBInitFile: scheme.run?.customLLDBInit
|
||||
)
|
||||
|
||||
let profileAction = XCScheme.ProfileAction(
|
||||
|
||||
+4
-2
@@ -28,7 +28,8 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
codeCoverageEnabled = "YES"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
customLLDBInitFile = "${SRCROOT}/.lldbinit">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@@ -74,7 +75,8 @@
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
allowLocationSimulation = "YES"
|
||||
customLLDBInitFile = "${SRCROOT}/.lldbinit">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
|
||||
@@ -311,6 +311,7 @@ schemes:
|
||||
simulateLocation:
|
||||
allow: true
|
||||
defaultLocation: Honolulu, HI, USA
|
||||
customLLDBInit: ${SRCROOT}/.lldbinit
|
||||
test:
|
||||
gatherCoverageData: true
|
||||
targets:
|
||||
@@ -318,6 +319,7 @@ schemes:
|
||||
- name: App_iOS_Tests
|
||||
parallelizable: true
|
||||
randomExecutionOrder: true
|
||||
customLLDBInit: ${SRCROOT}/.lldbinit
|
||||
targetTemplates:
|
||||
MyTemplate:
|
||||
scheme: {}
|
||||
|
||||
@@ -51,7 +51,8 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
let scheme = Scheme(
|
||||
name: "MyScheme",
|
||||
build: Scheme.Build(targets: [buildTarget], preActions: [preAction]),
|
||||
run: Scheme.Run(config: "Debug", askForAppToLaunch: true, launchAutomaticallySubstyle: "2", simulateLocation: simulateLocation)
|
||||
run: Scheme.Run(config: "Debug", askForAppToLaunch: true, launchAutomaticallySubstyle: "2", simulateLocation: simulateLocation, customLLDBInit: "/sample/.lldbinit"),
|
||||
test: Scheme.Test(config: "Debug", customLLDBInit: "/test/.lldbinit")
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
@@ -99,6 +100,8 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
try expect(xcscheme.launchAction?.allowLocationSimulation) == true
|
||||
try expect(xcscheme.launchAction?.locationScenarioReference?.referenceType) == Scheme.SimulateLocation.ReferenceType.predefined.rawValue
|
||||
try expect(xcscheme.launchAction?.locationScenarioReference?.identifier) == "New York, NY, USA"
|
||||
try expect(xcscheme.launchAction?.customLLDBInitFile) == "/sample/.lldbinit"
|
||||
try expect(xcscheme.testAction?.customLLDBInitFile) == "/test/.lldbinit"
|
||||
}
|
||||
|
||||
$0.it("generates scheme with multiple configs") {
|
||||
|
||||
Reference in New Issue
Block a user