Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1210] Alloy: Add support for DIST in the Project Configuration File

GitHub Issuen/a
Resolution Date2015-09-30T20:08:25.000+0000
Affected Version/sn/a
Fix Version/sn/a
ReporterFokke Zandbergen
AssigneeFeon Sua Xin Miao


Recently, in Alloy 1.4.0 DIST_ADHOC and DIST_STORE were added the options for [conditional code in controllers](http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Controllers-section-34636384_AlloyControllers-ConditionalCode). I'd like to also have support the same conditions in config.json. The use case would be to have different endpoints, keys or other configuration variables for production ad-hoc builds and production store-builds. Example:
 "global": {"foo":1},
 "env:development": {"foo":2},
 "os:ios env:production": {"foo":5},
 "os:ios env:development": {"foo":6},
 "os:ios env:test": {"foo":7},
 "os:ios dist:adhoc": {"foo":10},
 "os:ios dist:store": {"foo":10},
 "dependencies": {


  1. Tim Poulsen 2015-08-25

    We use different endpoints for AdHoc builds (Installr/TestFlight beta builds) vs our production releases. Currently, we have to manually copy & paste the contents of the config.json file to support such builds. This has resulted in mistakes. While we can use external tooling, like a grunt script, to manipulate the files, it would be best if Alloy itself supported something like:
           "env:development": {"url":"https://dev.example.com"},
    Given that we need this support for both iOS and Android, the key can't be env:adhoc or something iOS-specific. In the above proposal, dist:adhoc and dist:store would need to override env:production. And yes, I realize that natively Android doesn't have a notion of "adhoc" builds. But, I need a signed APK (with our company certificate) that points to our testing endpoints for Installr beta releases...that's exactly what I need for iOS (for Testflight/Installr builds).
  2. Feon Sua Xin Miao 2015-09-03

    https://github.com/appcelerator/alloy/pull/721 config.json now supports dist:adhoc & dist:store key.
           "env:development": {"url":"https://dev.example.com"},
  3. Feon Sua Xin Miao 2015-09-30

    PR merged.
  4. Fokke Zandbergen 2015-10-01

    [~fmiao] Looking at https://github.com/appcelerator/alloy/blob/8d32fa1aa0629473ec0eb7ea5c0ca0be32da58da/Alloy/commands/compile/compilerUtils.js#L867-L868 it will only work for os:ios dist:adhoc and not dist:adhoc os:ios. And env is not involved at all. We might have to refactor parseConfig() this way: * Loop through the config.json keys * Split on space * When all <type>:<value> conditions are true, extend the config object with it This means that the order of the keys in config.json determine what overwrites what instead of our code. This makes perfect sense I think, although we might want to force global to always come first. Let me know if you need new ticket or can change this PR still.

JSON Source