checking build setting existence checks xcconfig files too

This commit is contained in:
Yonas Kolb
2017-09-23 21:31:36 +02:00
parent 4cf9e9b399
commit a20885e6b4
2 changed files with 24 additions and 4 deletions
+3 -4
View File
@@ -167,10 +167,9 @@ public class PBXProjGenerator {
var buildSettings = spec.getTargetBuildSettings(target: target, config: config)
// automatically set INFOPLIST_FILE path
if buildSettings["INFOPLIST_FILE"] == nil {
if let plistPath = infoPlists.first {
buildSettings["INFOPLIST_FILE"] = plistPath.byRemovingBase(path: basePath)
}
if let plistPath = infoPlists.first,
!spec.targetHasBuildSetting("INFOPLIST_FILE", basePath: basePath, target: target, config: config, includeProject: false) {
buildSettings["INFOPLIST_FILE"] = plistPath.byRemovingBase(path: basePath)
}
// set Carthage search paths
+21
View File
@@ -56,6 +56,27 @@ extension ProjectSpec {
return buildSettings
}
// combines all levels of a target's settings
public func getCombinedBuildSettings(basePath: Path, target: Target, config: Config, includeProject: Bool) -> BuildSettings {
var buildSettings: BuildSettings = [:]
if includeProject {
buildSettings += getProjectBuildSettings(config: config)
}
if let configFilePath = target.configFiles[config.name] {
let path = basePath + configFilePath
if let configFile = try? XCConfig(path: path) {
buildSettings += configFile.flattenedBuildSettings()
}
}
buildSettings += getTargetBuildSettings(target: target, config: config)
return buildSettings
}
public func targetHasBuildSetting(_ setting: String, basePath: Path, target: Target, config: Config, includeProject: Bool) -> Bool {
let buildSettings = getCombinedBuildSettings(basePath: basePath, target: target, config: config, includeProject: includeProject)
return buildSettings[setting] != nil
}
}
private var buildSettingFiles: [String: BuildSettings] = [:]