Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1235] Alloy: Improve how config.json conditions are handled

GitHub Issuen/a
Affected Version/sn/a
Fix Version/sn/a
LabelsAlloy.CFG, config.json, theme
ReporterFokke Zandbergen
AssigneeTim Poulsen


Currently, Alloy does a (shallow) merge of the different sections of the app's config.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.


  1. Fokke Zandbergen 2015-02-01

    Sorry, I guess this tickets needs to be moved to TC.
  2. Mauro Parra-Miranda 2015-02-02

    Original Reporter: Fokke Zandbergen
  3. Tim Poulsen 2015-02-09

    This is a duplicate of ALOY-1199
  4. 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?
  5. 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.
  6. 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.

JSON Source