mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-11 12:56:03 +03: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:
parent
0ba3cf5888
commit
50aedc4511
@ -5,6 +5,7 @@
|
||||
#### Added
|
||||
- Support for building and running on Linux platforms. Tested for compatibility with Swift 5.3+ and Ubuntu 18.04. [#988](https://github.com/yonaskolb/XcodeGen/pull/988) @elliottwilliams
|
||||
- Add `useBaseInternationalization` to Project Spec Options to opt out of Base Internationalization. [#961](https://github.com/yonaskolb/XcodeGen/pull/961) @liamnichols
|
||||
- Add `storeKitConfiguration` to allow specifying StoreKit Configuration in Scheme and TargetScheme, supporting either xcodeproj or xcworkspace via `schemePathPrefix` option. [#964](https://github.com/yonaskolb/XcodeGen/pull/964) @jcolicchio
|
||||
- More detailed error message with method arguments. [#990](https://github.com/yonaskolb/XcodeGen/pull/990) @bannzai
|
||||
- Added `basedOnDependencyAnalysis` to Project Spec Build Script to be able to choose not to skip the script. [#992](https://github.com/yonaskolb/XcodeGen/pull/992) @myihsan
|
||||
- Add `BuildRule.runOncePerArchitecture` to allow running build rules once per architecture. [#950](https://github.com/yonaskolb/XcodeGen/pull/950) @sascha
|
||||
|
@ -128,6 +128,7 @@ Note that target names can also be changed by adding a `name` property to a targ
|
||||
- [ ] **preGenCommand**: **String** - A bash command to run before the project has been generated. If the project isn't generated due to no changes when using the cache then this won't run. This is useful for running things like generating resources files before the project is regenerated.
|
||||
- [ ] **postGenCommand**: **String** - A bash command to run after the project has been generated. If the project isn't generated due to no changes when using the cache then this won't run. This is useful for running things like `pod install` only if the project is actually regenerated.
|
||||
- [ ] **useBaseInternationalization**: **Bool** If this is `false` and your project does not include resources located in a **Base.lproj** directory then `Base` will not be included in the projects 'known regions'. The default value is `true`.
|
||||
- [ ] **schemePathPrefix**: **String** - A path prefix for relative paths in schemes, such as StoreKitConfiguration. The default is `"../../"`, which is suitable for non-workspace projects. For use in workspaces, use `"../"`.
|
||||
|
||||
```yaml
|
||||
options:
|
||||
@ -639,6 +640,7 @@ This is a convenience used to automatically generate schemes for a target based
|
||||
- [ ] **environmentVariables**: **[[Environment Variable](#environment-variable)]** or **[String:String]** - environment variables for Run, Test and Profile scheme actions. When passing a dictionary, every key-value entry maps to a corresponding variable that is enabled.
|
||||
- [ ] **preActions**: **[[Execution Action](#execution-action)]** - Scripts that are run *before* the build action
|
||||
- [ ] **postActions**: **[[Execution Action](#execution-action)]** - Scripts that are run *after* the build action
|
||||
- [ ] **storeKitConfiguration**: **String** - specify storekit configuration to use during run. See [Options](#options).
|
||||
|
||||
For example, the spec below would create 3 schemes called:
|
||||
|
||||
@ -775,6 +777,7 @@ The different actions share some properties:
|
||||
- [ ] **simulateLocation**: **[Simulate Location](#simulate-location)** - `run` action can define a simulated location
|
||||
- [ ] **askForAppToLaunch**: **Bool** - `run` action can define the executable set to ask to launch. This defaults to false.
|
||||
- [ ] **launchAutomaticallySubstyle**: **String** - `run` action can define the launch automatically substyle ('2' for extensions).
|
||||
- [ ] **storeKitConfiguration**: **String** - `run` action can specify a storekit configuration. See [Options](#options).
|
||||
|
||||
### Execution Action
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
"repositoryURL": "https://github.com/SwiftDocOrg/GraphViz.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "c4746cb3ff6f5e7c5d5540c40b98555521c3ee43",
|
||||
"version": "0.1.3"
|
||||
"revision": "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038",
|
||||
"version": "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -87,8 +87,8 @@
|
||||
"repositoryURL": "https://github.com/jpsim/Yams.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "88caa2e6fffdbef2e91c2022d038576062042907",
|
||||
"version": "4.0.0"
|
||||
"revision": "138cf1b701cf825233b92ceac919152d5aba8a3f",
|
||||
"version": "4.0.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -110,5 +110,6 @@ extension FileType {
|
||||
"xcfilelist": FileType(buildPhase: BuildPhaseSpec.none),
|
||||
"apns": FileType(buildPhase: BuildPhaseSpec.none),
|
||||
"pch": FileType(buildPhase: BuildPhaseSpec.none),
|
||||
"storekit": FileType(buildPhase: BuildPhaseSpec.none),
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Foundation
|
||||
import JSONUtilities
|
||||
import PathKit
|
||||
import XcodeProj
|
||||
|
||||
public typealias BuildType = XCScheme.BuildAction.Entry.BuildFor
|
||||
@ -113,6 +114,7 @@ public struct Scheme: Equatable {
|
||||
public var debugEnabled: Bool
|
||||
public var simulateLocation: SimulateLocation?
|
||||
public var executable: String?
|
||||
public var storeKitConfiguration: String?
|
||||
public var customLLDBInit: String?
|
||||
|
||||
public init(
|
||||
@ -130,6 +132,7 @@ public struct Scheme: Equatable {
|
||||
launchAutomaticallySubstyle: String? = nil,
|
||||
debugEnabled: Bool = debugEnabledDefault,
|
||||
simulateLocation: SimulateLocation? = nil,
|
||||
storeKitConfiguration: String? = nil,
|
||||
customLLDBInit: String? = nil
|
||||
) {
|
||||
self.config = config
|
||||
@ -145,6 +148,7 @@ public struct Scheme: Equatable {
|
||||
self.launchAutomaticallySubstyle = launchAutomaticallySubstyle
|
||||
self.debugEnabled = debugEnabled
|
||||
self.simulateLocation = simulateLocation
|
||||
self.storeKitConfiguration = storeKitConfiguration
|
||||
self.customLLDBInit = customLLDBInit
|
||||
}
|
||||
}
|
||||
@ -368,6 +372,7 @@ extension Scheme.Run: JSONObjectConvertible {
|
||||
region = jsonDictionary.json(atKeyPath: "region")
|
||||
debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Run.debugEnabledDefault
|
||||
simulateLocation = jsonDictionary.json(atKeyPath: "simulateLocation")
|
||||
storeKitConfiguration = jsonDictionary.json(atKeyPath: "storeKitConfiguration")
|
||||
executable = jsonDictionary.json(atKeyPath: "executable")
|
||||
|
||||
// launchAutomaticallySubstyle is defined as a String in XcodeProj but its value is often
|
||||
@ -415,6 +420,9 @@ extension Scheme.Run: JSONEncodable {
|
||||
if let simulateLocation = simulateLocation {
|
||||
dict["simulateLocation"] = simulateLocation.toJSONValue()
|
||||
}
|
||||
if let storeKitConfiguration = storeKitConfiguration {
|
||||
dict["storeKitConfiguration"] = storeKitConfiguration
|
||||
}
|
||||
if let customLLDBInit = customLLDBInit {
|
||||
dict["customLLDBInit"] = customLLDBInit
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ public struct SpecOptions: Equatable {
|
||||
public static let generateEmptyDirectoriesDefault = false
|
||||
public static let findCarthageFrameworksDefault = false
|
||||
public static let useBaseInternationalizationDefault = true
|
||||
public static let schemePathPrefixDefault = "../../"
|
||||
|
||||
public var minimumXcodeGenVersion: Version?
|
||||
public var carthageBuildPath: String?
|
||||
@ -35,6 +36,7 @@ public struct SpecOptions: Equatable {
|
||||
public var preGenCommand: String?
|
||||
public var postGenCommand: String?
|
||||
public var useBaseInternationalization: Bool
|
||||
public var schemePathPrefix: String
|
||||
|
||||
public enum ValidationType: String {
|
||||
case missingConfigs
|
||||
@ -96,7 +98,8 @@ public struct SpecOptions: Equatable {
|
||||
localPackagesGroup: String? = nil,
|
||||
preGenCommand: String? = nil,
|
||||
postGenCommand: String? = nil,
|
||||
useBaseInternationalization: Bool = useBaseInternationalizationDefault
|
||||
useBaseInternationalization: Bool = useBaseInternationalizationDefault,
|
||||
schemePathPrefix: String = schemePathPrefixDefault
|
||||
) {
|
||||
self.minimumXcodeGenVersion = minimumXcodeGenVersion
|
||||
self.carthageBuildPath = carthageBuildPath
|
||||
@ -122,6 +125,7 @@ public struct SpecOptions: Equatable {
|
||||
self.preGenCommand = preGenCommand
|
||||
self.postGenCommand = postGenCommand
|
||||
self.useBaseInternationalization = useBaseInternationalization
|
||||
self.schemePathPrefix = schemePathPrefix
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,6 +158,7 @@ extension SpecOptions: JSONObjectConvertible {
|
||||
preGenCommand = jsonDictionary.json(atKeyPath: "preGenCommand")
|
||||
postGenCommand = jsonDictionary.json(atKeyPath: "postGenCommand")
|
||||
useBaseInternationalization = jsonDictionary.json(atKeyPath: "useBaseInternationalization") ?? SpecOptions.useBaseInternationalizationDefault
|
||||
schemePathPrefix = jsonDictionary.json(atKeyPath: "schemePathPrefix") ?? SpecOptions.schemePathPrefixDefault
|
||||
if jsonDictionary["fileTypes"] != nil {
|
||||
fileTypes = try jsonDictionary.json(atKeyPath: "fileTypes")
|
||||
} else {
|
||||
@ -200,6 +205,9 @@ extension SpecOptions: JSONEncodable {
|
||||
if useBaseInternationalization != SpecOptions.useBaseInternationalizationDefault {
|
||||
dict["useBaseInternationalization"] = useBaseInternationalization
|
||||
}
|
||||
if schemePathPrefix != SpecOptions.schemePathPrefixDefault {
|
||||
dict["schemePathPrefix"] = schemePathPrefix
|
||||
}
|
||||
|
||||
return dict
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ public struct TargetScheme: Equatable {
|
||||
public var testTargets: [Scheme.Test.TestTarget]
|
||||
public var configVariants: [String]
|
||||
public var gatherCoverageData: Bool
|
||||
public var storeKitConfiguration: String?
|
||||
public var language: String?
|
||||
public var region: String?
|
||||
public var disableMainThreadChecker: Bool
|
||||
@ -25,6 +26,7 @@ public struct TargetScheme: Equatable {
|
||||
testTargets: [Scheme.Test.TestTarget] = [],
|
||||
configVariants: [String] = [],
|
||||
gatherCoverageData: Bool = gatherCoverageDataDefault,
|
||||
storeKitConfiguration: String? = nil,
|
||||
language: String? = nil,
|
||||
region: String? = nil,
|
||||
disableMainThreadChecker: Bool = disableMainThreadCheckerDefault,
|
||||
@ -38,6 +40,7 @@ public struct TargetScheme: Equatable {
|
||||
self.testTargets = testTargets
|
||||
self.configVariants = configVariants
|
||||
self.gatherCoverageData = gatherCoverageData
|
||||
self.storeKitConfiguration = storeKitConfiguration
|
||||
self.language = language
|
||||
self.region = region
|
||||
self.disableMainThreadChecker = disableMainThreadChecker
|
||||
@ -68,6 +71,7 @@ extension TargetScheme: JSONObjectConvertible {
|
||||
}
|
||||
configVariants = jsonDictionary.json(atKeyPath: "configVariants") ?? []
|
||||
gatherCoverageData = jsonDictionary.json(atKeyPath: "gatherCoverageData") ?? TargetScheme.gatherCoverageDataDefault
|
||||
storeKitConfiguration = jsonDictionary.json(atKeyPath: "storeKitConfiguration")
|
||||
language = jsonDictionary.json(atKeyPath: "language")
|
||||
region = jsonDictionary.json(atKeyPath: "region")
|
||||
disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? TargetScheme.disableMainThreadCheckerDefault
|
||||
@ -95,6 +99,10 @@ extension TargetScheme: JSONEncodable {
|
||||
dict["gatherCoverageData"] = gatherCoverageData
|
||||
}
|
||||
|
||||
if let storeKitConfiguration = storeKitConfiguration {
|
||||
dict["storeKitConfiguration"] = storeKitConfiguration
|
||||
}
|
||||
|
||||
if disableMainThreadChecker != TargetScheme.disableMainThreadCheckerDefault {
|
||||
dict["disableMainThreadChecker"] = disableMainThreadChecker
|
||||
}
|
||||
|
@ -235,6 +235,12 @@ public class SchemeGenerator {
|
||||
locationScenarioReference = XCScheme.LocationScenarioReference(identifier: identifier, referenceType: referenceType.rawValue)
|
||||
}
|
||||
|
||||
var storeKitConfigurationFileReference: XCScheme.StoreKitConfigurationFileReference?
|
||||
if let storeKitConfiguration = scheme.run?.storeKitConfiguration {
|
||||
let storeKitConfigurationPath = Path(components: [project.options.schemePathPrefix, storeKitConfiguration]).simplifyingParentDirectoryReferences()
|
||||
storeKitConfigurationFileReference = XCScheme.StoreKitConfigurationFileReference(identifier: storeKitConfigurationPath.string)
|
||||
}
|
||||
|
||||
let launchAction = XCScheme.LaunchAction(
|
||||
runnable: shouldExecuteOnLaunch ? runnables.launch : nil,
|
||||
buildConfiguration: scheme.run?.config ?? defaultDebugConfig.name,
|
||||
@ -253,6 +259,7 @@ public class SchemeGenerator {
|
||||
language: scheme.run?.language,
|
||||
region: scheme.run?.region,
|
||||
launchAutomaticallySubstyle: scheme.run?.launchAutomaticallySubstyle ?? launchAutomaticallySubstyle(for: schemeTarget),
|
||||
storeKitConfigurationFileReference: storeKitConfigurationFileReference,
|
||||
customLLDBInitFile: scheme.run?.customLLDBInit
|
||||
)
|
||||
|
||||
@ -362,7 +369,8 @@ extension Scheme {
|
||||
disableMainThreadChecker: targetScheme.disableMainThreadChecker,
|
||||
stopOnEveryMainThreadCheckerIssue: targetScheme.stopOnEveryMainThreadCheckerIssue,
|
||||
language: targetScheme.language,
|
||||
region: targetScheme.region
|
||||
region: targetScheme.region,
|
||||
storeKitConfiguration: targetScheme.storeKitConfiguration
|
||||
),
|
||||
test: .init(
|
||||
config: debugConfig,
|
||||
|
29
Tests/Fixtures/TestProject/App_iOS/Configuration.storekit
Normal file
29
Tests/Fixtures/TestProject/App_iOS/Configuration.storekit
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"products" : [
|
||||
{
|
||||
"displayPrice" : "0.00",
|
||||
"familyShareable" : false,
|
||||
"internalID" : "6D7919A3",
|
||||
"localizations" : [
|
||||
{
|
||||
"description" : "",
|
||||
"displayName" : "",
|
||||
"locale" : "en_US"
|
||||
}
|
||||
],
|
||||
"productID" : "com.xcodegen.0",
|
||||
"referenceName" : null,
|
||||
"type" : "Consumable"
|
||||
}
|
||||
],
|
||||
"settings" : {
|
||||
|
||||
},
|
||||
"subscriptionGroups" : [
|
||||
|
||||
],
|
||||
"version" : {
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
@ -656,6 +656,7 @@
|
||||
8D88C6BF7355702B74396791 /* TestProjectUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestProjectUITests.swift; sourceTree = "<group>"; };
|
||||
93C033648A37D95027845BD3 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
9A87A926D563773658FB87FE /* iMessageApp.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = iMessageApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9D4AB3FCF725428EFB56F542 /* Configuration.storekit */ = {isa = PBXFileReference; path = Configuration.storekit; sourceTree = "<group>"; };
|
||||
9F27382DD66E26C059E26EFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
A0DC40025AB59B688E758829 /* Framework2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A220DE4EB3CB2E598D034D9D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
@ -854,6 +855,7 @@
|
||||
F0D48A913C087D049C8EDDD7 /* App.entitlements */,
|
||||
7F1A2F579A6F79C62DDA0571 /* AppDelegate.swift */,
|
||||
3797E591F302ECC0AA2FC607 /* Assets.xcassets */,
|
||||
9D4AB3FCF725428EFB56F542 /* Configuration.storekit */,
|
||||
C9DDE1B06BCC1CDE0ECF1589 /* Info.plist */,
|
||||
AAA49985DFFE797EE8416887 /* inputList.xcfilelist */,
|
||||
CE1F06D99242F4223D081F0D /* LaunchScreen.storyboard */,
|
||||
|
@ -93,6 +93,9 @@
|
||||
</LocationScenarioReference>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
<StoreKitConfigurationFileReference
|
||||
identifier = "../../App_iOS/Configuration.storekit">
|
||||
</StoreKitConfigurationFileReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Production Release"
|
||||
|
@ -104,6 +104,9 @@
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<StoreKitConfigurationFileReference
|
||||
identifier = "../../App_iOS/Configuration.storekit">
|
||||
</StoreKitConfigurationFileReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Production Release"
|
||||
|
@ -104,6 +104,9 @@
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<StoreKitConfigurationFileReference
|
||||
identifier = "../../App_iOS/Configuration.storekit">
|
||||
</StoreKitConfigurationFileReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Staging Release"
|
||||
|
@ -104,6 +104,9 @@
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<StoreKitConfigurationFileReference
|
||||
identifier = "../../App_iOS/Configuration.storekit">
|
||||
</StoreKitConfigurationFileReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Test Release"
|
||||
|
@ -140,6 +140,7 @@ targets:
|
||||
commandLineArguments:
|
||||
MyEnabledArgument: true
|
||||
MyDisabledArgument: false
|
||||
storeKitConfiguration: "App_iOS/Configuration.storekit"
|
||||
postbuildScripts:
|
||||
- path: scripts/strip-frameworks.sh
|
||||
name: Strip Unused Architectures from Frameworks
|
||||
@ -352,6 +353,7 @@ schemes:
|
||||
allow: true
|
||||
defaultLocation: Honolulu, HI, USA
|
||||
customLLDBInit: ${SRCROOT}/.lldbinit
|
||||
storeKitConfiguration: "App_iOS/Configuration.storekit"
|
||||
test:
|
||||
gatherCoverageData: true
|
||||
targets:
|
||||
|
@ -18,6 +18,7 @@ extension Project {
|
||||
testTargets: [],
|
||||
configVariants: ["Test", "Staging", "Prod"],
|
||||
gatherCoverageData: true,
|
||||
storeKitConfiguration: "Configuration.storekit",
|
||||
disableMainThreadChecker: true,
|
||||
stopOnEveryMainThreadCheckerIssue: false,
|
||||
commandLineArguments: [
|
||||
|
@ -427,6 +427,7 @@ class ProjectSpecTests: XCTestCase {
|
||||
parallelizable: false)],
|
||||
configVariants: ["foo"],
|
||||
gatherCoverageData: true,
|
||||
storeKitConfiguration: "Configuration.storekit",
|
||||
disableMainThreadChecker: true,
|
||||
stopOnEveryMainThreadCheckerIssue: false,
|
||||
commandLineArguments: ["foo": true],
|
||||
@ -511,7 +512,8 @@ class ProjectSpecTests: XCTestCase {
|
||||
environmentVariables: [XCScheme.EnvironmentVariable(variable: "foo",
|
||||
value: "bar",
|
||||
enabled: false)],
|
||||
launchAutomaticallySubstyle: "2"),
|
||||
launchAutomaticallySubstyle: "2",
|
||||
storeKitConfiguration: "Configuration.storekit"),
|
||||
test: Scheme.Test(config: "Config",
|
||||
gatherCoverageData: true,
|
||||
disableMainThreadChecker: true,
|
||||
|
@ -709,6 +709,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
"ENV1": true,
|
||||
],
|
||||
"gatherCoverageData": true,
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
"language": "en",
|
||||
"region": "US",
|
||||
"disableMainThreadChecker": true,
|
||||
@ -736,6 +737,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
testTargets: ["t1", "t2"],
|
||||
configVariants: ["dev", "app-store"],
|
||||
gatherCoverageData: true,
|
||||
storeKitConfiguration: "Configuration.storekit",
|
||||
language: "en",
|
||||
region: "US",
|
||||
disableMainThreadChecker: true,
|
||||
@ -774,6 +776,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
"run": [
|
||||
"config": "debug",
|
||||
"launchAutomaticallySubstyle": 2,
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
],
|
||||
"test": [
|
||||
"config": "debug",
|
||||
@ -813,7 +816,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
|
||||
let expectedRun = Scheme.Run(
|
||||
config: "debug",
|
||||
launchAutomaticallySubstyle: "2"
|
||||
launchAutomaticallySubstyle: "2",
|
||||
storeKitConfiguration: "Configuration.storekit"
|
||||
)
|
||||
try expect(scheme.run) == expectedRun
|
||||
|
||||
@ -848,6 +852,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
["variable": "OTHER_ENV_VAR", "value": "VAL", "isEnabled": false],
|
||||
],
|
||||
"launchAutomaticallySubstyle": "2",
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
],
|
||||
"test": [
|
||||
"environmentVariables": [
|
||||
@ -878,6 +883,7 @@ class SpecLoadingTests: XCTestCase {
|
||||
|
||||
try expect(scheme.run?.environmentVariables) == expectedRunVariables
|
||||
try expect(scheme.run?.launchAutomaticallySubstyle) == "2"
|
||||
try expect(scheme.run?.storeKitConfiguration) == "Configuration.storekit"
|
||||
try expect(scheme.test?.environmentVariables) == expectedTestVariables
|
||||
try expect(scheme.profile?.config) == "Release"
|
||||
try expect(scheme.profile?.environmentVariables.isEmpty) == true
|
||||
@ -890,11 +896,13 @@ class SpecLoadingTests: XCTestCase {
|
||||
],
|
||||
"run": [
|
||||
"launchAutomaticallySubstyle": 2, // Both integer and string supported
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
],
|
||||
]
|
||||
|
||||
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
|
||||
try expect(scheme.run?.launchAutomaticallySubstyle) == "2"
|
||||
try expect(scheme.run?.storeKitConfiguration) == "Configuration.storekit"
|
||||
}
|
||||
|
||||
$0.it("parses scheme templates") {
|
||||
@ -949,6 +957,9 @@ class SpecLoadingTests: XCTestCase {
|
||||
],
|
||||
],
|
||||
],
|
||||
"run": [
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
],
|
||||
"test": [
|
||||
"config": "debug",
|
||||
"targets": [
|
||||
@ -996,6 +1007,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
try expect(scheme.build.parallelizeBuild) == false
|
||||
try expect(scheme.build.buildImplicitDependencies) == false
|
||||
|
||||
try expect(scheme.run?.storeKitConfiguration) == "Configuration.storekit"
|
||||
|
||||
let expectedTest = Scheme.Test(
|
||||
config: "debug",
|
||||
gatherCoverageData: true,
|
||||
@ -1124,7 +1137,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
compilerFlags: ["c1", "c2"])],
|
||||
findCarthageFrameworks: true,
|
||||
preGenCommand: "swiftgen",
|
||||
postGenCommand: "pod install"
|
||||
postGenCommand: "pod install",
|
||||
schemePathPrefix: "../"
|
||||
)
|
||||
let expected = Project(name: "test", options: options)
|
||||
let dictionary: [String: Any] = ["options": [
|
||||
@ -1143,7 +1157,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
"attributes": ["a1", "a2"],
|
||||
"resourceTags": ["r1", "r2"],
|
||||
"compilerFlags": ["c1", "c2"],
|
||||
]]
|
||||
]],
|
||||
"schemePathPrefix": "../",
|
||||
]]
|
||||
let parsedSpec = try getProjectSpec(dictionary)
|
||||
try expect(parsedSpec) == expected
|
||||
@ -1201,6 +1216,41 @@ class SpecLoadingTests: XCTestCase {
|
||||
let parsedSpec = try getProjectSpec(dictionary)
|
||||
try expect(parsedSpec) == project
|
||||
}
|
||||
|
||||
$0.it("parses TargetScheme storeKitConfiguration as string") {
|
||||
var targetDictionary = validTarget
|
||||
targetDictionary["scheme"] = [
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
]
|
||||
|
||||
let target = try Target(name: "test", jsonDictionary: targetDictionary)
|
||||
|
||||
let scheme = TargetScheme(
|
||||
storeKitConfiguration: "Configuration.storekit"
|
||||
)
|
||||
|
||||
try expect(target.scheme) == scheme
|
||||
}
|
||||
|
||||
$0.it("parses Scheme.Run storeKitConfiguration as string") {
|
||||
let schemeDictionary: [String: Any] = [
|
||||
"build": [
|
||||
"targets": [:],
|
||||
],
|
||||
"run": [
|
||||
"config": "debug",
|
||||
"storeKitConfiguration": "Configuration.storekit",
|
||||
],
|
||||
]
|
||||
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
|
||||
|
||||
let runAction = Scheme.Run(
|
||||
config: "debug",
|
||||
storeKitConfiguration: "Configuration.storekit"
|
||||
)
|
||||
|
||||
try expect(scheme.run) == runAction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user