mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
checking build setting existence checks xcconfig files too
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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] = [:]
|
||||
|
||||
Reference in New Issue
Block a user