forked from play-co/native-android
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
70 lines (58 loc) · 1.87 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Mozilla Public License v. 2.0 for more details.
* You should have received a copy of the Mozilla Public License v. 2.0
* along with the Game Closure SDK. If not, see <http://mozilla.org/MPL/2.0/>.
*/
var path = require("path");
var ff = require("ff");
var clc = require("cli-color");
exports.init = function(common) {
console.log("Running install.sh");
common.child("sh", ["install.sh"], {
cwd: __dirname
}, function () {
console.log("Install complete");
});
exports.load(common);
};
exports.load = function(common) {
var defaults = {
"android:keystore": "",
"android:key": "",
"android:keypass": "",
"android:storepass": ""
};
common.config.set("android:root", path.resolve(__dirname))
// check to see the misc keys are at least present
Object.keys(defaults).forEach(function (key) {
if (!common.config.get(key)) {
common.config.set(key, defaults[key]);
}
});
require(common.paths.root('src', 'testapp')).registerTarget("native-android", __dirname);
}
exports.testapp = function(common, opts, next) {
var cwd = process.cwd();
var f = ff(this, function() {
process.chdir(__dirname);
common.child('make', [], {}, f.wait());
}, function() {
common.child('make', ['install'], {}, f.wait());
}, function() {
process.chdir(cwd);
require(common.paths.root('src', 'serve')).cli();
}).error(function(err) {
process.chdir(cwd);
console.log(clc.red("ERROR"), err);
}).cb(function() {
process.chdir(cwd);
next();
});
}