Merge pull request #293 from Bitcoin-com/wallet/task/555

555 - Include version number in Android apk filename.
This commit is contained in:
Jean-Baptiste Dominguez 2018-09-06 17:16:27 +09:00 committed by GitHub
commit b2e22647e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 122 additions and 96 deletions

View file

@ -8,26 +8,32 @@ module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
exec: { exec: {
get_nwjs_for_pkg: {
command: 'if [ ! -d ./cache/0.19.4/osx64/nwjs.app ]; then mkdir -p ./cache/0.19.4/osx64; curl https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip --output ./cache/nwjs.zip; unzip ./cache/nwjs.zip -d ./cache; cp -R ./cache/nwjs-mas-v0.19.5-osx-x64/nwjs.app ./cache/0.19.4/osx64/; fi'
},
create_others_dist: {
command: 'sh webkitbuilds/create-others-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
create_dmg_dist: {
command: 'sh webkitbuilds/create-dmg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
create_pkg_dist: {
command: 'sh webkitbuilds/create-pkg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
sign_desktop_dist: {
command: 'sh webkitbuilds/sign-desktop-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>"'
},
appConfig: { appConfig: {
command: 'node ./util/buildAppConfig.js' command: 'node ./util/buildAppConfig.js'
}, },
externalServices: { android_studio: {
command: 'node ./util/buildExternalServices.js' command: ' open -a open -a /Applications/Android\\ Studio.app platforms/android',
},
build_android_debug: {
command: 'cordova prepare android && cordova build android --debug',
},
build_android_release: {
command: 'cordova prepare android && cordova build android --release',
},
build_ios_debug: {
command: 'cordova prepare ios && cordova build ios --debug',
options: {
maxBuffer: 3200 * 1024
}
},
build_ios_release: {
command: 'cordova prepare ios && cordova build ios --release',
options: {
maxBuffer: 1600 * 1024
}
},
chrome: {
command: 'make -C chrome-app '
}, },
clean: { clean: {
command: 'rm -Rf bower_components node_modules' command: 'rm -Rf bower_components node_modules'
@ -38,8 +44,35 @@ module.exports = function(grunt) {
coveralls: { coveralls: {
command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js' command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
}, },
chrome: { create_dmg_dist: {
command: 'make -C chrome-app ' command: 'sh webkitbuilds/create-dmg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
create_others_dist: {
command: 'sh webkitbuilds/create-others-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
create_pkg_dist: {
command: 'sh webkitbuilds/create-pkg-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"'
},
externalServices: {
command: 'node ./util/buildExternalServices.js'
},
get_nwjs_for_pkg: {
command: 'if [ ! -d ./cache/0.19.5-pkg/osx64/nwjs.app ]; then cd ./cache; curl https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip --output nwjs.zip; unzip nwjs.zip; mkdir -p ./0.19.5-pkg/osx64; cp -R ./nwjs-mas-v0.19.5-osx-x64/nwjs.app ./0.19.5-pkg/osx64/; fi'
},
log_android: {
command: 'adb logcat | grep chromium',
},
run_android: {
command: 'cordova run android --device',
},
sign_android: {
// When the build log outputs "Built the following apk(s):", it seems to need the filename to start with "android-release".
// It looks like it simply lists all apk files starting with "android-release"
command: 'rm -f platforms/android/build/outputs/apk/android-release-signed-*.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/bitcoin-com-wallet-<%= pkg.fullVersion %>-android-signed-aligned.apk',
stdin: true,
},
sign_desktop_dist: {
command: 'sh webkitbuilds/sign-desktop-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>"'
}, },
wpinit: { wpinit: {
command: 'make -C cordova wp-init', command: 'make -C cordova wp-init',
@ -47,40 +80,9 @@ module.exports = function(grunt) {
wpcopy: { wpcopy: {
command: 'make -C cordova wp-copy', command: 'make -C cordova wp-copy',
}, },
iosdebug: {
command: 'npm run build:ios',
},
ios: {
command: 'npm run build:ios-release',
},
xcode: { xcode: {
command: 'npm run open:ios', command: 'open platforms/ios/*.xcodeproj',
}, }
androiddebug: {
command: 'npm run build:android',
},
android: {
command: 'npm run build:android-release',
},
androidrun: {
command: 'npm run run:android && npm run log:android',
},
androidbuild: {
command: 'cd cordova/project && cordova build android --release',
},
androidsign: {
command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && ../android-sdk-macosx/build-tools/27.0.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
stdin: true,
},
desktopsign: {
cmd: 'gpg -u E0AE67E7 --output webkitbuilds/others/<%= pkg.title %>-linux.zip.sig --detach-sig webkitbuilds/others/<%= pkg.title %>-linux.zip ; gpg -u E0AE67E7 --output webkitbuilds/others/<%= pkg.title %>.exe.sig --detach-sig webkitbuilds/others/<%= pkg.title %>.exe'
},
desktopverify: {
cmd: 'gpg --verify webkitbuilds/<%= pkg.title %>-linux.zip.sig webkitbuilds/<%= pkg.title %>-linux.zip; gpg --verify webkitbuilds/<%= pkg.title %>.exe.sig webkitbuilds/<%= pkg.title %>.exe'
},
osxsign: {
cmd: 'gpg -u E0AE67E7 --output webkitbuilds/<%= pkg.title %>.dmg.sig --detach-sig webkitbuilds/<%= pkg.title %>.dmg'
},
}, },
watch: { watch: {
options: { options: {
@ -348,30 +350,48 @@ module.exports = function(grunt) {
grunt.registerTask('wp', ['prod', 'exec:wp']); grunt.registerTask('wp', ['prod', 'exec:wp']);
grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']); grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
grunt.registerTask('wp-init', ['default', 'exec:wpinit']); grunt.registerTask('wp-init', ['default', 'exec:wpinit']);
grunt.registerTask('ios', ['exec:ios']);
grunt.registerTask('ios-debug', ['exec:iosdebug']);
grunt.registerTask('ios-run', ['exec:xcode']);
grunt.registerTask('cordovaclean', ['exec:cordovaclean']); grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']);
grunt.registerTask('android', ['exec:android']); // Build all
grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']); grunt.registerTask('build-app-release', ['build-mobile-release', 'build-desktop-release']);
grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);
/**
* Mobile app
*/
// Build mobile app
grunt.registerTask('build-mobile-release', ['build-ios-release', 'build-android-release']);
// Build ios
grunt.registerTask('start-ios', ['exec:build_ios_debug', 'exec:xcode']);
grunt.registerTask('build-ios-debug', ['exec:build_ios_debug']);
grunt.registerTask('build-ios-release', ['prod', 'exec:build_ios_release']);
// Build android
grunt.registerTask('start-android', ['build-android-debug', 'exec:run_android']);
grunt.registerTask('build-android-debug', ['exec:build_android_debug']);
grunt.registerTask('build-android-release', ['prod', 'exec:build_android_release', 'sign-android']);
grunt.registerTask('sign-android', ['exec:sign_android']);
/**
* Desktop app
*/
// Build desktop // Build desktop
grunt.registerTask('desktop-build', ['desktop-others', 'desktop-osx-dmg', 'desktop-osx-pkg']); grunt.registerTask('build-desktop', ['build-desktop-others', 'build-desktop-osx-dmg', 'build-desktop-osx-pkg']);
// Build desktop win64 & linux64 // Build desktop win64 & linux64
grunt.registerTask('desktop-others', ['prod', 'nwjs:others', 'copy:linux', 'exec:create_others_dist']); grunt.registerTask('build-desktop-others', ['prod', 'nwjs:others', 'copy:linux', 'exec:create_others_dist']);
// Build desktop osx pkg // Build desktop osx pkg
grunt.registerTask('desktop-osx-pkg', ['prod', 'exec:get_nwjs_for_pkg', 'nwjs:pkg', 'exec:create_pkg_dist']); grunt.registerTask('build-desktop-osx-pkg', ['prod', 'exec:get_nwjs_for_pkg', 'nwjs:pkg', 'exec:create_pkg_dist']);
// Build desktop osx dmg // Build desktop osx dmg
grunt.registerTask('desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']); grunt.registerTask('build-desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']);
// Sign desktop // Sign desktop
grunt.registerTask('desktop-sign', ['exec:sign_desktop_dist']); grunt.registerTask('sign-desktop', ['exec:sign_desktop_dist']);
// Release desktop // Release desktop
grunt.registerTask('desktop-release', ['desktop-build', 'desktop-sign']); grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']);
}; };

View file

@ -113,14 +113,14 @@ npm run start:desktop
Before building the release version for a platform, run the `clean-all` command to delete any untracked files in your current working directory. (Be sure to stash any uncommited changes you've made.) This guarantees consistency across builds for the current state of this repository. Before building the release version for a platform, run the `clean-all` command to delete any untracked files in your current working directory. (Be sure to stash any uncommited changes you've made.) This guarantees consistency across builds for the current state of this repository.
The `final` commands build the production version of the app, and bundle it with the release version of the platform being built. The `build:*-release` commands build the production version of the app, and bundle it with the release version of the platform being built.
### Android ### Android
```sh ```sh
npm run clean-all npm run clean-all
npm run apply:bitcoincom npm run apply:bitcoincom
npm run final:android npm run build:android-release
``` ```
### iOS ### iOS
@ -128,7 +128,7 @@ npm run final:android
```sh ```sh
npm run clean-all npm run clean-all
npm run apply:bitcoincom npm run apply:bitcoincom
npm run final:ios npm run build:ios-release
``` ```
### Desktop (Linux, macOS, and Windows) ### Desktop (Linux, macOS, and Windows)
@ -136,7 +136,7 @@ npm run final:ios
```sh ```sh
npm run clean-all npm run clean-all
npm run apply:bitcoincom npm run apply:bitcoincom
npm run final:desktop npm run build:desktop-release
``` ```
## About The Bitcoin.com Wallet ## About The Bitcoin.com Wallet

View file

@ -87,46 +87,52 @@
"bitcoincashjs-fork": "^1.0.3" "bitcoincashjs-fork": "^1.0.3"
}, },
"scripts": { "scripts": {
"postinstall": "bower install", "apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh",
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0",
"start:chrome": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0 --browser \"google chrome\"", "build:app-release": "grunt build-app-release",
"start:ios": "npm run build:www && npm run build:ios && npm run open:ios",
"start:android": "npm run build:www && npm run build:android && npm run run:android", "build:mobile-release": "grunt build-mobile-release",
"start:windows": "npm run build:www && npm run build:windows", "build:desktop-release": "grunt build-desktop-release",
"start:desktop": "npm start",
"watch": "grunt watch", "build:android-debug": "grunt build-android-debug",
"build:android-release": "grunt build-android-release",
"build:ios-debug": "grunt build-ios-debug",
"build:ios-release": "grunt build-ios-release",
"build:desktop": "grunt build-desktop",
"build:osx-pkg": "grunt build-desktop-osx-pkg",
"build:osx-dmg": "grunt build-desktop-osx-dmg",
"build:others": "grunt build-desktop-others",
"build:windows": "cordova prepare windows && cordova build windows -- --arch=\"ARM\"",
"build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"",
"build:www": "grunt", "build:www": "grunt",
"build:www-release": "grunt prod", "build:www-release": "grunt prod",
"build:ios": "cordova prepare ios && cordova build ios --debug",
"build:android": "cordova prepare android && cordova build android --debug",
"build:windows": "cordova prepare windows && cordova build windows -- --arch=\"ARM\"",
"build:ios-release": "cordova prepare ios && cordova build ios --release",
"build:android-release": "cordova prepare android && cordova build android --release",
"build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"",
"build:desktop-release": "grunt desktop-release",
"build:desktop": "grunt desktop-build",
"build:osx-pkg": "grunt desktop-osx-pkg",
"build:osx-dmg": "grunt desktop-osx-dmg",
"build:others": "grunt desktop-others",
"sign:desktop": "grunt desktop-sign",
"open:ios": "open platforms/ios/*.xcodeproj",
"open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android",
"final:www": "npm run build:www-release",
"final:ios": "npm run final:www && npm run build:ios-release && npm run open:ios",
"final:android": "npm run final:www && npm run build:android-release && npm run sign:android && npm run run:android-release",
"final:windows": "npm run final:www && npm run build:windows-release",
"final:desktop": "npm run final:www && npm run build:desktop-release",
"run:android": "cordova run android --device",
"run:android-release": "cordova run android --device --release",
"log:android": "adb logcat | grep chromium",
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../bitcoin-com-release-key.jks -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk bitcoin-com && zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
"apply:copay": "npm i fs-extra && cd app-template && node apply.js copay && npm i && cordova prepare",
"apply:bitpay": "npm i fs-extra && cd app-template && node apply.js bitpay && npm i && cordova prepare",
"apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh",
"test": "karma start test/karma.conf.js --single-run",
"clean": "trash platforms && trash plugins && cordova prepare", "clean": "trash platforms && trash plugins && cordova prepare",
"clean-all": "git clean -dfx",
"log:android": "adb logcat | grep chromium",
"open:android": "grunt exec:android_studio",
"open:ios": "grunt exec:xcode",
"postinstall": "bower install",
"sign:android": "grunt sign-android",
"sign:desktop": "grunt sign-desktop",
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0",
"start:chrome": "npm run build:www && ionic serve --nolivereload --nogulp -s --address 0.0.0.0 --browser \"google chrome\"",
"start:android": "grunt start-android",
"start:android-log": "grunt start-android && npm run log:android",
"start:ios": "grunt start-ios",
"start:windows": "npm run build:www && npm run build:windows",
"test": "karma start test/karma.conf.js --single-run",
"unstage-package": "git reset package.json", "unstage-package": "git reset package.json",
"clean-all": "git clean -dfx" "watch": "grunt watch"
}, },
"devDependencies": { "devDependencies": {
"cordova": "^6.3.1", "cordova": "^6.3.1",