[ALOY-1235] Alloy: Improve how config.json conditions are handled
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Tooling |
Labels | Alloy.CFG, config.json, theme |
Reporter | Fokke Zandbergen |
Assignee | Tim Poulsen |
Created | 2015-02-01T14:30:29.000+0000 |
Updated | 2015-02-09T16:45:30.000+0000 |
Description
Currently, Alloy does a (shallow) merge of the different sections of the app'sconfig.json
and an optional theme config.json
in the following [hard-coded](https://github.com/appcelerator/alloy/blob/master/Alloy/commands/compile/compilerUtils.js#L765-L846) order:
* global
* env:*
* os:*
* env:* os:*
* os:* env:*
I'd suggest the following change:
Loop the config.json
sections in the order in which they appear in the file and merge them when the conditions are met, just like we do with conditions in TSS and JS.
Example:
{
"global": {
"foo": 1
},
"env:test os:ios": {
"foo": 2
}
}
Would be handles as if you'd do this in a JS file:
var cfg =
if (true) {
_.extend(cfg, { foo: 1 });
}
if (ENV_TEST && OS_IOS) {
_.extend(cfg, { foo: 2 });
}
Use case:
This is more transparent to the developer to see what the value will be if multiple sections are valid for the target environment and platform. It will also make it easier (less code) to introduce a new condition, as requested in ALOY-1210.
Comments
- Fokke Zandbergen 2015-02-01 Sorry, I guess this tickets needs to be moved to TC.
- Mauro Parra-Miranda 2015-02-02 Original Reporter: Fokke Zandbergen
- Tim Poulsen 2015-02-09 This is a duplicate of ALOY-1199
- Fokke Zandbergen 2015-02-09 [~skypanther] please not that this ticket is only duplicate to ALOY-1199 in part. Only the second of the 2 suggested changes is. The first one I'd still like to see implemented as well. What's the correct procedure? Can I just reopen and change the ticket to only be about the first item? Or should you?
- Tim Poulsen 2015-02-09 Yes, please feel free to reopen tickets that you think were resolved incorrectly. Let me know if you don't have permissions to do so. Sorry I missed that only part of this was covered by ALOY-1199.
- Fokke Zandbergen 2015-02-09 Reopening because only part of the ticket duplicates by ALOY-1199. I'll edit and take out the duplicate part.