mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-11-12 21:48:44 +03:00
Merge pull request #503 from yonaskolb/fix/config_lookup
Don't partial apply exact config matches
This commit is contained in:
commit
f154b4d1cb
@ -12,6 +12,7 @@
|
||||
#### Changed
|
||||
- **BREAKING**: All the paths within `include` files are now relative to that file and not the root spec. This can be disabled with a `relativePaths: false` on the include. See the [documentation](https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#include) for more details [#489](https://github.com/yonaskolb/XcodeGen/pull/489) @ellneal
|
||||
- Updated the Xcode compatibility version from 3.2 to 9.3 [#497](https://github.com/yonaskolb/XcodeGen/pull/497) @yonaskolb
|
||||
- Exact matches to config names in build settings won't partial apply to other configs [#503](https://github.com/yonaskolb/XcodeGen/pull/503) @yonaskolb
|
||||
- UUIDs in the project are standard and don't contain any type prefixes anymore
|
||||
|
||||
#### Fixed
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,15 +176,25 @@ class ProjectGeneratorTests: XCTestCase {
|
||||
let project = Project(
|
||||
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