mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-20 00:58:04 +03:00
don't partial apply exact config matches
This commit is contained in:
parent
d8e54c507f
commit
d0c257e938
@ -155,7 +155,7 @@ settingGroups:
|
||||
Settings can either be a simple map of build settings `[String:String]`, or can be more advanced with the following properties:
|
||||
|
||||
- [ ] **groups**: **[String]** - List of setting groups to include and merge
|
||||
- [ ] **configs**: **[String:[Settings](#settings)]** - Mapping of config name to a settings spec. These settings will only be applied for that config. Each key will be matched to any configs that contain the key and is case insensitive. So if you had `Staging Debug` and `Staging Release`, you could apply settings to both of them using `staging`.
|
||||
- [ ] **configs**: **[String:[Settings](#settings)]** - Mapping of config name to a settings spec. These settings will only be applied for that config. Each key will be matched to any configs that contain the key and is case insensitive. So if you had `Staging Debug` and `Staging Release`, you could apply settings to both of them using `staging`. However if a config name is an exact match to a config it won't be applied to any others. eg `Release` will be applied to config `Release` but not `Staging Release`
|
||||
- [ ] **base**: **[String:String]** - Used to specify default settings that apply to any config
|
||||
|
||||
```yaml
|
||||
|
@ -81,8 +81,13 @@ extension Project {
|
||||
buildSettings += settings.buildSettings
|
||||
|
||||
for (configVariant, settings) in settings.configSettings {
|
||||
if config.name.lowercased().contains(configVariant.lowercased()) {
|
||||
buildSettings += getBuildSettings(settings: settings, config: config)
|
||||
let isPartialMatch = config.name.lowercased().contains(configVariant.lowercased())
|
||||
if isPartialMatch {
|
||||
let exactConfig = getConfig(configVariant)
|
||||
let matchesExactlyToOtherConfig = exactConfig != nil && exactConfig?.name != config.name
|
||||
if !matchesExactlyToOtherConfig {
|
||||
buildSettings += getBuildSettings(settings: settings, config: config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,15 +179,25 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
basePath: "",
|
||||
name: "test",
|
||||
configs: [
|
||||
Config(name: "Release", type: .release),
|
||||
Config(name: "Staging Debug", type: .debug),
|
||||
Config(name: "Staging Release", type: .release),
|
||||
],
|
||||
settings: Settings(configSettings: ["staging": ["SETTING1": "VALUE1"], "debug": ["SETTING2": "VALUE2"]])
|
||||
settings: Settings(configSettings: [
|
||||
"staging": ["SETTING1": "VALUE1"],
|
||||
"debug": ["SETTING2": "VALUE2"],
|
||||
"Release": ["SETTING3": "VALUE3"],
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
var buildSettings = project.getProjectBuildSettings(config: project.configs.first!)
|
||||
var buildSettings = project.getProjectBuildSettings(config: project.configs[1])
|
||||
try expect(buildSettings["SETTING1"] as? String) == "VALUE1"
|
||||
try expect(buildSettings["SETTING2"] as? String) == "VALUE2"
|
||||
|
||||
// don't apply partial when exact match
|
||||
buildSettings = project.getProjectBuildSettings(config: project.configs[2])
|
||||
try expect(buildSettings["SETTING3"]).beNil()
|
||||
}
|
||||
|
||||
$0.it("sets project SDKROOT if there is only a single platform") {
|
||||
|
Loading…
Reference in New Issue
Block a user