mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Feature/Store Kit Configuration (#964)
* Preemptively fix compilation for latest XcodeProj * Add StoreKitConfiguration to scheme and generator * Add scheme generator test * Fix and add tests * Support StoreKitConfiguration in TargetScheme * Set default type of `storekit` to `.none` * Upgrade XcodeProj to 7.15.0 * Create struct for StoreKitConfiguration * Update tests * Add storekit configuration to test project * Update changelog * Update project spec * Fix xcodeprojs * Fix projects * Capitalize String * Update CHANGELOG.md Co-authored-by: Gemma Barlow <gemmakbarlow@gmail.com> * Refactor StoreKitConfiguration init from json * Change `forWorkspace` to `pathPrefix` and add tests * Replace StoreKitConfiguration struct with string + option * Fix tests * Update project spec * Fixup changelog * Add `See Options` to `storeKitConfiguration` in project spec Co-authored-by: Gemma Barlow <gemmakbarlow@gmail.com>
This commit is contained in:
co-authored by
Gemma Barlow
parent
0ba3cf5888
commit
50aedc4511
@@ -48,16 +48,18 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
$0.it("generates scheme") {
|
||||
let preAction = Scheme.ExecutionAction(name: "Script", script: "echo Starting", settingsTarget: app.name)
|
||||
let simulateLocation = Scheme.SimulateLocation(allow: true, defaultLocation: "New York, NY, USA")
|
||||
let storeKitConfiguration = "Configuration.storekit"
|
||||
let scheme = Scheme(
|
||||
name: "MyScheme",
|
||||
build: Scheme.Build(targets: [buildTarget], preActions: [preAction]),
|
||||
run: Scheme.Run(config: "Debug", askForAppToLaunch: true, launchAutomaticallySubstyle: "2", simulateLocation: simulateLocation, customLLDBInit: "/sample/.lldbinit"),
|
||||
run: Scheme.Run(config: "Debug", askForAppToLaunch: true, launchAutomaticallySubstyle: "2", simulateLocation: simulateLocation, storeKitConfiguration: storeKitConfiguration, customLLDBInit: "/sample/.lldbinit"),
|
||||
test: Scheme.Test(config: "Debug", customLLDBInit: "/test/.lldbinit")
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
targets: [app, framework],
|
||||
schemes: [scheme]
|
||||
schemes: [scheme],
|
||||
options: .init(schemePathPrefix: "../")
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
let target = try unwrap(xcodeProject.pbxproj.nativeTargets
|
||||
@@ -98,6 +100,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
try expect(xcscheme.launchAction?.askForAppToLaunch) == true
|
||||
try expect(xcscheme.launchAction?.launchAutomaticallySubstyle) == "2"
|
||||
try expect(xcscheme.launchAction?.allowLocationSimulation) == true
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../Configuration.storekit"
|
||||
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"
|
||||
@@ -133,17 +136,19 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
name: "MyFramework",
|
||||
type: .application,
|
||||
platform: .iOS,
|
||||
scheme: TargetScheme(testTargets: ["MyFrameworkTests"])
|
||||
scheme: TargetScheme(testTargets: ["MyFrameworkTests"], storeKitConfiguration: "Configuration.storekit")
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
configs: configs,
|
||||
targets: [framework, frameworkTest]
|
||||
targets: [framework, frameworkTest],
|
||||
options: .init(schemePathPrefix: "../../")
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
|
||||
|
||||
try expect(xcscheme.launchAction?.buildConfiguration) == "Debug"
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../../Configuration.storekit"
|
||||
try expect(xcscheme.testAction?.buildConfiguration) == "Debug"
|
||||
try expect(xcscheme.profileAction?.buildConfiguration) == "Release"
|
||||
try expect(xcscheme.analyzeAction?.buildConfiguration) == "Debug"
|
||||
@@ -159,14 +164,15 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
let scheme = Scheme(
|
||||
name: "EnvironmentVariablesScheme",
|
||||
build: Scheme.Build(targets: [buildTarget]),
|
||||
run: Scheme.Run(config: "Debug", environmentVariables: runVariables),
|
||||
run: Scheme.Run(config: "Debug", environmentVariables: runVariables, storeKitConfiguration: "Configuration.storekit"),
|
||||
test: Scheme.Test(config: "Debug"),
|
||||
profile: Scheme.Profile(config: "Debug")
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
targets: [app, framework],
|
||||
schemes: [scheme]
|
||||
schemes: [scheme],
|
||||
options: .init(schemePathPrefix: "../")
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
|
||||
@@ -177,6 +183,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
.contains(where: { $0.name == app.name })
|
||||
).beTrue()
|
||||
try expect(xcscheme.launchAction?.environmentVariables) == runVariables
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../Configuration.storekit"
|
||||
try expect(xcscheme.testAction?.environmentVariables).to.beNil()
|
||||
try expect(xcscheme.profileAction?.environmentVariables).to.beNil()
|
||||
}
|
||||
@@ -231,7 +238,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
let scheme = Scheme(
|
||||
name: "TestScheme",
|
||||
build: Scheme.Build(targets: [buildTarget]),
|
||||
run: Scheme.Run(config: "Debug", debugEnabled: false)
|
||||
run: Scheme.Run(config: "Debug", debugEnabled: false, storeKitConfiguration: "Configuration.storekit")
|
||||
)
|
||||
let project = Project(
|
||||
name: "test",
|
||||
@@ -244,6 +251,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
|
||||
try expect(xcscheme.launchAction?.selectedDebuggerIdentifier) == ""
|
||||
try expect(xcscheme.launchAction?.selectedLauncherIdentifier) == "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../../Configuration.storekit"
|
||||
}
|
||||
|
||||
$0.it("generate scheme without debugger - test") {
|
||||
@@ -375,6 +383,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
$0.it("generates scheme with remote runnable for watch app target") {
|
||||
let xcscheme = try self.makeWatchScheme(appType: .watch2App, extensionType: .watch2Extension)
|
||||
try expect(xcscheme.launchAction?.runnable).beOfType(XCScheme.RemoteRunnable.self)
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../Configuration.storekit"
|
||||
}
|
||||
|
||||
$0.it("generates scheme with host target build action for watch") {
|
||||
@@ -383,6 +392,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
try expect(buildEntries.count) == 2
|
||||
try expect(buildEntries.first?.buildableReference.blueprintName) == "WatchApp"
|
||||
try expect(buildEntries.last?.buildableReference.blueprintName) == "HostApp"
|
||||
try expect(xcscheme.launchAction?.storeKitConfigurationFileReference?.identifier) == "../Configuration.storekit"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -400,7 +410,7 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
type: appType,
|
||||
platform: .watchOS,
|
||||
dependencies: [Dependency(type: .target, reference: watchExtension.name)],
|
||||
scheme: TargetScheme()
|
||||
scheme: TargetScheme(storeKitConfiguration: "Configuration.storekit")
|
||||
)
|
||||
let hostApp = Target(
|
||||
name: "HostApp",
|
||||
@@ -410,7 +420,8 @@ class SchemeGeneratorTests: XCTestCase {
|
||||
)
|
||||
let project = Project(
|
||||
name: "watch_test",
|
||||
targets: [hostApp, watchApp, watchExtension]
|
||||
targets: [hostApp, watchApp, watchExtension],
|
||||
options: .init(schemePathPrefix: "../")
|
||||
)
|
||||
let xcodeProject = try project.generateXcodeProject()
|
||||
return try unwrap(xcodeProject.sharedData?.schemes.first)
|
||||
|
||||
Reference in New Issue
Block a user