Skip to content

Commit e745c49

Browse files
Merge pull request tidev#329 from appcelerator/ALOY-680
[ALOY-680] add DIST_ADHOC and DIST_STORE
2 parents 27669f7 + 6116c24 commit e745c49

6 files changed

Lines changed: 51 additions & 5 deletions

File tree

Alloy/commands/compile/ast/compress.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ exports.process = function(ast, config) {
1111
_.each(CONST.DEPLOY_TYPES, function(d) {
1212
defines[d.key] = config.deploytype === d.value;
1313
});
14+
_.each(CONST.DIST_TYPES, function(d) {
15+
defines[d.key] = _.contains(d.value, config.target);
16+
});
1417
_.each(CONST.PLATFORMS, function(p) {
1518
defines['OS_' + p.toUpperCase()] = config.platform === p;
1619
});

Alloy/common/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ exports.DEPLOY_TYPES = [
7171
{ key: 'ENV_PROD', value: 'production' },
7272
{ key: 'ENV_PRODUCTION', value: 'production' }
7373
];
74+
exports.DIST_TYPES = [
75+
{ key: 'DIST_ADHOC', value: ['dist-adhoc'] },
76+
{ key: 'DIST_STORE', value: ['dist-appstore', 'dist-playstore'] }
77+
];
7478

7579
// mappings of file extensions and folders for each file type
7680
exports.FILE_EXT = {

hooks/alloy.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exports.init = function (logger, config, cli, appc) {
1818
spawn = require('child_process').spawn,
1919
parallel = appc.async.parallel;
2020

21-
function run(deviceFamily, deployType, finished) {
21+
function run(deviceFamily, deployType, target, finished) {
2222
var appDir = path.join(cli.argv['project-dir'], 'app');
2323
if (!afs.exists(appDir)) {
2424
logger.info(__('Project not an Alloy app, continuing'));
@@ -41,7 +41,8 @@ exports.init = function (logger, config, cli, appc) {
4141
version: '0',
4242
simtype: 'none',
4343
devicefamily: /(?:iphone|ios)/.test(cli.argv.platform) ? deviceFamily : 'none',
44-
deploytype: deployType || cli.argv['deploy-type'] || 'development'
44+
deploytype: deployType || cli.argv['deploy-type'] || 'development',
45+
target: target
4546
};
4647

4748
config = Object.keys(config).map(function (c) {
@@ -154,8 +155,10 @@ exports.init = function (logger, config, cli, appc) {
154155
cli.addHook('build.pre.compile', function (build, finished) {
155156
// TODO: Remove this workaround when the CLI reports the right deploy type for android
156157
var deployType = build.deployType;
158+
var target = build.target;
159+
157160
if (cli.argv.platform === 'android') {
158-
switch(cli.argv.target) {
161+
switch(target) {
159162
case 'dist-playstore':
160163
deployType = 'production';
161164
break;
@@ -168,10 +171,10 @@ exports.init = function (logger, config, cli, appc) {
168171
break;
169172
}
170173
}
171-
run(build.deviceFamily, deployType, finished);
174+
run(build.deviceFamily, deployType, target, finished);
172175
});
173176

174177
cli.addHook('codeprocessor.pre.run', function (build, finished) {
175-
run('none', 'development', finished);
178+
run('none', 'development', undefined, finished);
176179
});
177180
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var deployType, dist;
2+
if (ENV_DEV) {
3+
deployType = 'development';
4+
} else if (ENV_TEST) {
5+
deployType = 'test';
6+
} else if (ENV_PROD) {
7+
deployType = 'production';
8+
}
9+
10+
if (DIST_ADHOC) {
11+
dist = 'adhoc';
12+
} else if (DIST_STORE) {
13+
dist = 'store';
14+
}
15+
16+
$.build.text = deployType + (dist ? ':' + dist : '');
17+
18+
$.index.open();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'#index': {
2+
backgroundColor: '#fff',
3+
fullscreen: false,
4+
exitOnClose: true
5+
}
6+
7+
'#build': {
8+
font: {
9+
fontSize: '24dp',
10+
fontWeight: 'bold'
11+
},
12+
color: '#27ae60'
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Alloy>
2+
<Window>
3+
<Label id="build"/>
4+
</Window>
5+
</Alloy>

0 commit comments

Comments
 (0)