mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
upgrade to xcodeproj 0.1.1
This commit is contained in:
@@ -10,12 +10,14 @@ import Foundation
|
||||
import xcodeproj
|
||||
import PathKit
|
||||
import ProjectSpec
|
||||
import Yams
|
||||
import JSONUtilities
|
||||
|
||||
extension ProjectSpec {
|
||||
|
||||
public func getProjectBuildSettings(config: Config) -> BuildSettings {
|
||||
|
||||
let buildSettings: BuildSettings = .empty
|
||||
var buildSettings: BuildSettings = [:]
|
||||
buildSettings += SettingsPresetFile.base.getBuildSettings()
|
||||
|
||||
if let type = config.type {
|
||||
@@ -28,7 +30,7 @@ extension ProjectSpec {
|
||||
}
|
||||
|
||||
public func getTargetBuildSettings(target: Target, config: Config) -> BuildSettings {
|
||||
let buildSettings = BuildSettings()
|
||||
var buildSettings = BuildSettings()
|
||||
|
||||
buildSettings += SettingsPresetFile.platform(target.platform).getBuildSettings()
|
||||
buildSettings += SettingsPresetFile.product(target.type).getBuildSettings()
|
||||
@@ -38,7 +40,7 @@ extension ProjectSpec {
|
||||
}
|
||||
|
||||
public func getBuildSettings(settings: Settings, config: Config) -> BuildSettings {
|
||||
let buildSettings: BuildSettings = .empty
|
||||
var buildSettings: BuildSettings = [:]
|
||||
|
||||
for preset in settings.presets {
|
||||
let presetSettings = settingPresets[preset]!
|
||||
@@ -80,11 +82,23 @@ extension SettingsPresetFile {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let buildSettings = try? BuildSettings(path: settingsPath) else {
|
||||
guard let buildSettings = try? loadSettings(path: settingsPath) else {
|
||||
print("Error parsing \"\(name)\" settings")
|
||||
return nil
|
||||
}
|
||||
buildSettingFiles[path] = buildSettings
|
||||
return buildSettings
|
||||
}
|
||||
|
||||
public func loadSettings(path: Path) throws -> BuildSettings {
|
||||
let content: String = try path.read()
|
||||
if content == "" {
|
||||
return [:]
|
||||
}
|
||||
let yaml = try Yams.load(yaml: content)
|
||||
guard let dictionary = yaml as? JSONDictionary else {
|
||||
throw JSONUtilsError.fileNotAJSONDictionary
|
||||
}
|
||||
return dictionary
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user