Skip to content

Commit d81a101

Browse files
committed
Added build for Android Play store bundle.
1 parent a6dc085 commit d81a101

File tree

14 files changed

+1122
-303
lines changed

14 files changed

+1122
-303
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ debug/
1414
release/
1515
testresults/
1616
.eslintcache
17+
cordova/bundle.keystore
1718

1819
# OSX
1920
.DS_store

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ stages:
8686
displayName: 'Install Node.js 10.16.3'
8787
- script: yarn install
8888
displayName: 'Run yarn install'
89-
- script: yarn gulp release --android
89+
- script: yarn gulp debug-release --android
9090
displayName: 'Run yarn release for android'
9191
- task: PublishPipelineArtifact@1
9292
displayName: 'Publish Android release'

cordova/build.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

cordova/build_template.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"android": {
3+
"debug": {
4+
"keystore": "debug.keystore",
5+
"storePassword": "betaflight_debug",
6+
"alias": "betaflight_debug",
7+
"password": "password",
8+
"packageType": "apk"
9+
},
10+
"release": {
11+
"keystore": "bundle.keystore",
12+
"storePassword": "[INJECTED_BY_GULPFILE]",
13+
"alias": "betaflight",
14+
"password": "password",
15+
"packageType": "bundle"
16+
}
17+
}
18+
}

cordova/config_template.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<preference name="SplashMaintainAspectRatio" value="true"/>
3838
<preference name="SplashShowOnlyFirstTime" value="true"/>
3939
<preference name="android-minSdkVersion" value="19"/>
40+
<preference name="android-targetSdkVersion" value="30" />
4041
<config-file parent="/manifest/application/activity" target="AndroidManifest.xml">
4142
<intent-filter>
4243
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>

cordova/debug.keystore

2.4 KB
Binary file not shown.

cordova/release.keystore

-2.19 KB
Binary file not shown.

gulpfile.js

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function debug(done) {
466466
buildNWAppsWrapper(platforms, 'sdk', DEBUG_DIR, done);
467467
}
468468

469-
function injectARMCache(flavor, callback) {
469+
function injectARMCache(flavor, done) {
470470
const flavorPostfix = `-${flavor}`;
471471
const flavorDownloadPostfix = flavor !== 'normal' ? `-${flavor}` : '';
472472
clean_cache().then(function() {
@@ -529,7 +529,7 @@ function injectARMCache(flavor, callback) {
529529
clean_debug();
530530
process.exit(1);
531531
}
532-
callback();
532+
done();
533533
}
534534
);
535535
}
@@ -593,10 +593,10 @@ function buildNWApps(platforms, flavor, dir, done) {
593593

594594
function getGitRevision(done, callback, isReleaseBuild) {
595595
let gitRevision = 'norevision';
596-
git.diff([ '--shortstat' ], function (err, diff) {
597-
if (!err && !diff) {
598-
git.log([ '-1', '--pretty=format:%h' ], function (err, rev) {
599-
if (!err) {
596+
git.diff([ '--shortstat' ], function (err1, diff) {
597+
if (!err1 && !diff) {
598+
git.log([ '-1', '--pretty=format:%h' ], function (err2, rev) {
599+
if (!err2) {
600600
gitRevision = rev.latest.hash;
601601
}
602602

@@ -990,7 +990,7 @@ function cordova_packagejson() {
990990
}
991991

992992
function cordova_configxml_internal() {
993-
let androidName = metadata.packageId.replace(NAME_REGEX, '_');
993+
const androidName = metadata.packageId.replace(NAME_REGEX, '_');
994994

995995
return gulp.src([`${CORDOVA_DIST_DIR}config.xml`])
996996
.pipe(xmlTransformer([
@@ -1009,7 +1009,7 @@ function cordova_debug_configxml() {
10091009
return cordova_configxml_internal();
10101010
}
10111011

1012-
function cordova_configxml(callback) {
1012+
function cordova_configxml(done) {
10131013
return gulp.series(function version_prompt() {
10141014
return gulp.src('.')
10151015
.pipe(prompt.prompt({
@@ -1021,7 +1021,7 @@ function cordova_configxml(callback) {
10211021
metadata.version = res.version;
10221022
}
10231023
}));
1024-
}, cordova_configxml_internal)(callback);
1024+
}, cordova_configxml_internal)(done);
10251025
}
10261026

10271027
function cordova_rename_build_json() {
@@ -1030,7 +1030,7 @@ function cordova_rename_build_json() {
10301030
.pipe(gulp.dest(CORDOVA_DIST_DIR));
10311031
}
10321032

1033-
function cordova_browserify(callback) {
1033+
function cordova_browserify(done) {
10341034
const readFile = function(file) {
10351035
return new Promise(function(resolve) {
10361036
if (!file.includes("node_modules")) {
@@ -1048,7 +1048,7 @@ function cordova_browserify(callback) {
10481048
glob(`${CORDOVA_DIST_DIR}www/**/*.js`, {}, function (err, files) {
10491049
const readLoop = function() {
10501050
if (files.length === 0) {
1051-
callback();
1051+
done();
10521052
} else {
10531053
const file = files.pop();
10541054
readFile(file).then(function() {
@@ -1087,7 +1087,7 @@ function cordova_debug() {
10871087
cordova.run();
10881088
}
10891089

1090-
function cordova_debug_build(cb) {
1090+
function cordova_debug_build(done) {
10911091
cordova.build({
10921092
'platforms': ['android'],
10931093
'options': {
@@ -1096,13 +1096,14 @@ function cordova_debug_build(cb) {
10961096
},
10971097
}).then(function() {
10981098
process.chdir('../');
1099-
cb();
1100-
});
11011099

1102-
console.log('APK will be generated at dist_cordova/platforms/android/app/build/outputs/apk/release/app-release.apk');
1100+
console.log('APK has been generated at dist_cordova/platforms/android/app/build/outputs/apk/release/app-release.apk');
1101+
1102+
done();
1103+
});
11031104
}
11041105

1105-
function cordova_build(callback) {
1106+
function cordova_build(done) {
11061107
let storePassword = '';
11071108
return gulp.series(function password_prompt() {
11081109
return gulp.src('.')
@@ -1119,11 +1120,11 @@ function cordova_build(callback) {
11191120
'android': {
11201121
'release' : {
11211122
'storePassword': storePassword,
1122-
}
1123-
}
1123+
},
1124+
},
11241125
}))
11251126
.pipe(gulp.dest('./'));
1126-
}, function build(cb) {
1127+
}, function build(done) {
11271128
return cordova.build({
11281129
'platforms': ['android'],
11291130
'options': {
@@ -1134,24 +1135,28 @@ function cordova_build(callback) {
11341135
// Delete the file containing the store password
11351136
del(['build.json'], { force: true });
11361137
process.chdir('../');
1137-
cb();
1138-
});
1139-
})(callback);
11401138

1141-
console.log('AAB will be generated at dist_cordova/platforms/android/app/build/outputs/bundle/release/app.aab');
1139+
console.log('AAB has been generated at dist_cordova/platforms/android/app/build/outputs/bundle/release/app.aab');
1140+
done();
1141+
});
1142+
})(done);
11421143
}
11431144

11441145
async function cordova_debug_release() {
1145-
const filename = await getReleaseFilename('android', 'apk');
1146+
const filename = getReleaseFilename('android', 'apk');
1147+
11461148
console.log(`Release APK : release/${filename}`);
1149+
11471150
return gulp.src(`${CORDOVA_DIST_DIR}platforms/android/app/build/outputs/apk/debug/app-debug.apk`)
11481151
.pipe(rename(filename))
11491152
.pipe(gulp.dest(RELEASE_DIR));
11501153
}
11511154

11521155
async function cordova_release() {
1153-
const filename = await getReleaseFilename('android', 'aab');
1156+
const filename = getReleaseFilename('android', 'aab');
1157+
11541158
console.log(`Release AAB : release/${filename}`);
1159+
11551160
return gulp.src(`${CORDOVA_DIST_DIR}platforms/android/app/build/outputs/bundle/release/app.aab`)
11561161
.pipe(rename(filename))
11571162
.pipe(gulp.dest(RELEASE_DIR));

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"browserify": "^17.0.0",
8484
"chai": "^4.2.0",
8585
"command-exists": "^1.2.8",
86-
"cordova-lib": "^9.0.1",
86+
"cordova-lib": "^10.0.0",
8787
"del": "^5.0.0",
8888
"eslint": "^7.16.0",
8989
"eslint-plugin-vue": "^7.3.0",
@@ -94,6 +94,7 @@
9494
"gulp-concat": "~2.6.1",
9595
"gulp-debian": "~0.1.8",
9696
"gulp-json-editor": "^2.5.4",
97+
"gulp-prompt": "^1.2.0",
9798
"gulp-rename": "^2.0.0",
9899
"gulp-replace": "^1.0.0",
99100
"gulp-xml-transformer": "^3.0.0",

src/js/backup_restore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
function configuration_backup(callback) {
66
let activeProfile = null;
77

8-
let version = CONFIGURATOR.getConfiguratorVersion();
8+
let version = CONFIGURATOR.version;
99

1010
if (version.indexOf(".") === -1) {
1111
version = version + ".0.0";

0 commit comments

Comments
 (0)