mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
set project attributes
This commit is contained in:
@@ -21,6 +21,7 @@ public struct ProjectSpec {
|
||||
public var configs: [Config]
|
||||
public var schemes: [Scheme]
|
||||
public var options: Options
|
||||
public var attributes: [String: Any]
|
||||
|
||||
public struct Options {
|
||||
public var carthageBuildPath: String?
|
||||
@@ -30,7 +31,7 @@ public struct ProjectSpec {
|
||||
}
|
||||
}
|
||||
|
||||
public init(name: String, configs: [Config] = [], targets: [Target] = [], settings: Settings = .empty, settingGroups: [String: Settings] = [:], schemes: [Scheme] = [], options: Options = Options()) {
|
||||
public init(name: String, configs: [Config] = [], targets: [Target] = [], settings: Settings = .empty, settingGroups: [String: Settings] = [:], schemes: [Scheme] = [], options: Options = Options(), attributes: [String: Any] = [:]) {
|
||||
self.name = name
|
||||
self.targets = targets
|
||||
self.configs = configs
|
||||
@@ -38,6 +39,7 @@ public struct ProjectSpec {
|
||||
self.settingGroups = settingGroups
|
||||
self.schemes = schemes
|
||||
self.options = options
|
||||
self.attributes = attributes
|
||||
}
|
||||
|
||||
public func getTarget(_ targetName: String) -> Target? {
|
||||
@@ -79,6 +81,7 @@ extension ProjectSpec: JSONObjectConvertible {
|
||||
self.configs = configs.map { Config(name: $0, type: ConfigType(rawValue: $1)) }
|
||||
targets = try Target.decodeTargets(jsonDictionary: jsonDictionary)
|
||||
schemes = try jsonDictionary.json(atKeyPath: "schemes")
|
||||
attributes = jsonDictionary.json(atKeyPath: "attributes") ?? [:]
|
||||
if jsonDictionary["options"] != nil {
|
||||
options = try jsonDictionary.json(atKeyPath: "options")
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,7 @@ public class PBXProjGenerator {
|
||||
|
||||
let spec: ProjectSpec
|
||||
let basePath: Path
|
||||
let currentXcodeVersion = "0830"
|
||||
|
||||
var fileReferencesByPath: [Path: String] = [:]
|
||||
var groupsByPath: [Path: PBXGroup] = [:]
|
||||
@@ -133,7 +134,15 @@ public class PBXProjGenerator {
|
||||
addObject(mainGroup)
|
||||
|
||||
let knownRegions: [String] = ["en", "Base"]
|
||||
let root = PBXProject(reference: project.rootObject, buildConfigurationList: buildConfigList.reference, compatibilityVersion: "Xcode 3.2", mainGroup: mainGroup.reference, developmentRegion: "English", knownRegions: knownRegions, targets: targets.referenceList)
|
||||
let projectAttributes: [String: Any] = spec.attributes.isEmpty ? ["LastUpgradeCheck": currentXcodeVersion] : spec.attributes
|
||||
let root = PBXProject(reference: project.rootObject,
|
||||
buildConfigurationList: buildConfigList.reference,
|
||||
compatibilityVersion: "Xcode 3.2",
|
||||
mainGroup: mainGroup.reference,
|
||||
developmentRegion: "English",
|
||||
knownRegions: knownRegions,
|
||||
targets: targets.referenceList,
|
||||
attributes: projectAttributes)
|
||||
project.projects.append(root)
|
||||
|
||||
return project
|
||||
|
||||
@@ -27,6 +27,7 @@ Required properties are marked 🔵 and optional properties with ⚪️.
|
||||
- 🔵 **name**: `String` - Name of the generated project
|
||||
- ⚪️ **include**: `[String]` - The paths to other specs. They will be merged in order and then the current spec will be merged on top
|
||||
- ⚪️ **options**: [Options](#options) - Various options to override default behaviour
|
||||
- ⚪️ **attributes**: `map` - The PBXProject attributes. This is for advanced use. Defaults to ``{"LastUpgradeCheck": "0830"}``
|
||||
- ⚪️ **configs**: [Configs](#configs) - Project build configurations. Defaults to `Debug` and `Release` configs
|
||||
- ⚪️ **settings**: [Settings](#settings) - Project specific settings. Default base and config type settings will be applied first before any settings defined here
|
||||
- ⚪️ **settingGroups**: [Setting Groups](#setting-groups) - Setting groups mapped by name
|
||||
|
||||
Reference in New Issue
Block a user