[ALOY-1210] Alloy: Add support for DIST in the Project Configuration File
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2015-09-30T20:08:25.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Runtime |
Labels | config.json |
Reporter | Fokke Zandbergen |
Assignee | Feon Sua Xin Miao |
Created | 2014-12-18T09:27:55.000+0000 |
Updated | 2015-10-09T00:24:06.000+0000 |
Description
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},
"env:test":{"foo":3},
"env:production":{"foo":4},
"os:ios env:production": {"foo":5},
"os:ios env:development": {"foo":6},
"os:ios env:test": {"foo":7},
"os:android":{"foo":8},
"os:mobileweb":{"foo":9},
"os:ios dist:adhoc": {"foo":10},
"os:ios dist:store": {"foo":10},
"dependencies": {
"com.foo.widget":"1.0"
}
}
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:
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
anddist:store
would need to overrideenv: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).https://github.com/appcelerator/alloy/pull/721
config.json
now supportsdist:adhoc
&dist:store
key.PR merged.
[~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 notdist:adhoc os:ios
. Andenv
is not involved at all. We might have to refactorparseConfig()
this way: * Loop through theconfig.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 inconfig.json
determine what overwrites what instead of our code. This makes perfect sense I think, although we might want to forceglobal
to always come first. Let me know if you need new ticket or can change this PR still.