mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-10 06:14:38 +03:00
Rename to defaultConfig
This commit is contained in:
parent
b1d739dffa
commit
6f95e57f45
@ -80,7 +80,7 @@ Note that target names can also be changed by adding a `name` property to a targ
|
||||
- [ ] **deploymentTarget**: **[[Platform](#platform): String]** - A project wide deployment target can be specified for each platform otherwise the default SDK version in Xcode will be used. This will be overridden by any custom build settings that set the deployment target eg `IPHONEOS_DEPLOYMENT_TARGET`. Target specific deployment targets can also be set with [Target](#target).deploymentTarget.
|
||||
- [ ] **disabledValidations**: **[String]** - A list of validations that can be disabled if they're too strict for your use case. By default this is set to an empty array. Currently these are the available options:
|
||||
- `missingConfigs`: Disable errors for configurations in yaml files that don't exist in the project itself. This can be useful if you include the same yaml file in different projects
|
||||
- [ ] **defaultConfigurationName**: **String** - The default configuration for command line builds from Xcode. If the configuration provided here doesn't match one in your [configs](#configs) key, XcodeGen will fail. If you don't set this, the first configuration alphabetically will be chosen.
|
||||
- [ ] **defaultConfig**: **String** - The default configuration for command line builds from Xcode. If the configuration provided here doesn't match one in your [configs](#configs) key, XcodeGen will fail. If you don't set this, the first configuration alphabetically will be chosen.
|
||||
|
||||
```yaml
|
||||
options:
|
||||
|
@ -32,7 +32,7 @@ public struct ProjectSpec {
|
||||
public var indentWidth: UInt?
|
||||
public var xcodeVersion: String?
|
||||
public var deploymentTarget: DeploymentTarget
|
||||
public var defaultConfigurationName: String?
|
||||
public var defaultConfig: String?
|
||||
|
||||
public enum SettingPresets: String {
|
||||
case all
|
||||
@ -68,7 +68,7 @@ public struct ProjectSpec {
|
||||
xcodeVersion: String? = nil,
|
||||
deploymentTarget: DeploymentTarget = .init(),
|
||||
disabledValidations: [ValidationType] = [],
|
||||
defaultConfigurationName: String? = nil
|
||||
defaultConfig: String? = nil
|
||||
) {
|
||||
self.carthageBuildPath = carthageBuildPath
|
||||
self.carthageExecutablePath = carthageExecutablePath
|
||||
@ -82,7 +82,7 @@ public struct ProjectSpec {
|
||||
self.xcodeVersion = xcodeVersion
|
||||
self.deploymentTarget = deploymentTarget
|
||||
self.disabledValidations = disabledValidations
|
||||
self.defaultConfigurationName = defaultConfigurationName
|
||||
self.defaultConfig = defaultConfig
|
||||
}
|
||||
|
||||
public static func == (lhs: ProjectSpec.Options, rhs: ProjectSpec.Options) -> Bool {
|
||||
@ -220,6 +220,6 @@ extension ProjectSpec.Options: JSONObjectConvertible {
|
||||
tabWidth = (jsonDictionary.json(atKeyPath: "tabWidth") as Int?).flatMap(UInt.init)
|
||||
deploymentTarget = jsonDictionary.json(atKeyPath: "deploymentTarget") ?? DeploymentTarget()
|
||||
disabledValidations = jsonDictionary.json(atKeyPath: "disabledValidations") ?? []
|
||||
defaultConfigurationName = jsonDictionary.json(atKeyPath: "defaultConfigurationName")
|
||||
defaultConfig = jsonDictionary.json(atKeyPath: "defaultConfig")
|
||||
}
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ extension ProjectSpec {
|
||||
}
|
||||
}
|
||||
|
||||
if let configName = options.defaultConfigurationName {
|
||||
if let configName = options.defaultConfig {
|
||||
if !configs.contains(where: { $0.name == configName }) {
|
||||
errors.append(.missingDefaultConfigurationName(configName: configName))
|
||||
errors.append(.missingDefaultConfig(configName: configName))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public struct SpecValidationError: Error, CustomStringConvertible {
|
||||
case invalidFileGroup(String)
|
||||
case invalidConfigFileConfig(String)
|
||||
case missingConfigForTargetScheme(target: String, configType: ConfigType)
|
||||
case missingDefaultConfigurationName(configName: String)
|
||||
case missingDefaultConfig(configName: String)
|
||||
|
||||
public var description: String {
|
||||
switch self {
|
||||
@ -51,7 +51,7 @@ public struct SpecValidationError: Error, CustomStringConvertible {
|
||||
return "Config file has invalid config \(config.quoted)"
|
||||
case let .missingConfigForTargetScheme(target, configType):
|
||||
return "Target \(target.quoted) is missing a config of type \(configType.rawValue) to generate its scheme"
|
||||
case let .missingDefaultConfigurationName(name):
|
||||
case let .missingDefaultConfig(name):
|
||||
return "Default configuration \(name) doesn't exist"
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class PBXProjGenerator {
|
||||
)
|
||||
}
|
||||
|
||||
let configName = spec.options.defaultConfigurationName ?? buildConfigs.first?.object.name ?? ""
|
||||
let configName = spec.options.defaultConfig ?? buildConfigs.first?.object.name ?? ""
|
||||
let buildConfigList = createObject(
|
||||
id: spec.name,
|
||||
XCConfigurationList(
|
||||
|
@ -98,7 +98,7 @@ func projectGeneratorTests() {
|
||||
}
|
||||
|
||||
$0.it("uses the default configuration name") {
|
||||
let options = ProjectSpec.Options(defaultConfigurationName: "Bconfig")
|
||||
let options = ProjectSpec.Options(defaultConfig: "Bconfig")
|
||||
let spec = ProjectSpec(basePath: "", name: "test", configs: [Config(name: "Aconfig"), Config(name: "Bconfig")], targets: [framework], options: options)
|
||||
let pbxProject = try getPbxProj(spec)
|
||||
|
||||
|
@ -170,8 +170,8 @@ func projectSpecTests() {
|
||||
|
||||
$0.it("validates missing default configurations") {
|
||||
var spec = baseSpec
|
||||
spec.options = ProjectSpec.Options(defaultConfigurationName: "foo")
|
||||
try expectValidationError(spec, .missingDefaultConfigurationName(configName: "foo"))
|
||||
spec.options = ProjectSpec.Options(defaultConfig: "foo")
|
||||
try expectValidationError(spec, .missingDefaultConfig(configName: "foo"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user