From ecb3b2391de29bc0eff2ab0e831bd65209ae200f Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 22 Aug 2018 18:17:33 +1200 Subject: [PATCH 01/10] Grunt task for signing. --- Gruntfile.js | 5 ++++- app-template/package-template.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index eb4bb2eb0..58829e2ed 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -69,7 +69,10 @@ module.exports = function(grunt) { 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 ', + // 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" so I have added that prefix to the final apk + // so that its filename shows up in the log output. + 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/android-release-signed-aligned-bitcoin-com-wallet-<%= pkg.fullVersion %>-android.apk', stdin: true, }, desktopsign: { diff --git a/app-template/package-template.json b/app-template/package-template.json index c42ef81b4..f7c067c85 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -119,7 +119,7 @@ "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", + "sign:android": "grunt android-release", "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", From d934a9241ad171889c3fc53d1ffedc54611c7612 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Tue, 4 Sep 2018 15:54:24 +0900 Subject: [PATCH 02/10] Organize the package.json and grunt file. Some optimizations and renaming. --- Gruntfile.js | 27 +++++++++++-- app-template/package-template.json | 64 +++++++++++++++++------------- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 58829e2ed..b191a751f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -51,7 +51,7 @@ module.exports = function(grunt) { command: 'npm run build:ios', }, ios: { - command: 'npm run build:ios-release', + command: 'cordova prepare ios && cordova build ios --release', }, xcode: { command: 'npm run open:ios', @@ -60,7 +60,7 @@ module.exports = function(grunt) { command: 'npm run build:android', }, android: { - command: 'npm run build:android-release', + command: 'cordova prepare android && cordova build android --release', }, androidrun: { command: 'npm run run:android && npm run log:android', @@ -72,7 +72,7 @@ module.exports = function(grunt) { // 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" so I have added that prefix to the final apk // so that its filename shows up in the log output. - 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/android-release-signed-aligned-bitcoin-com-wallet-<%= pkg.fullVersion %>-android.apk', + 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, }, desktopsign: { @@ -357,9 +357,28 @@ module.exports = function(grunt) { grunt.registerTask('cordovaclean', ['exec:cordovaclean']); grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']); grunt.registerTask('android', ['exec:android']); - grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']); grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']); + // Build all + grunt.registerTask('app-release', ['mobile-release', 'desktop-release']); + + /** + * Mobile app + */ + + // Build mobile app + grunt.registerTask('mobile-release', ['ios-release', 'android-release']); + + // Build ios + grunt.registerTask('ios-release', ['prod', 'exec:ios']); + + // Build android + grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']); + + /** + * Desktop app + */ + // Build desktop grunt.registerTask('desktop-build', ['desktop-others', 'desktop-osx-dmg', 'desktop-osx-pkg']); diff --git a/app-template/package-template.json b/app-template/package-template.json index f7c067c85..7b8e2955c 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -88,45 +88,55 @@ }, "scripts": { "postinstall": "bower install", + "watch": "grunt watch", + "log:android": "adb logcat | grep chromium", + "test": "karma start test/karma.conf.js --single-run", + "clean": "trash platforms && trash plugins && cordova prepare", + "unstage-package": "git reset package.json", + "clean-all": "git clean -dfx", + + "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", + "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: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", + "start:ios": "npm run build:www && npm run build:ios", + "start:android": "npm run build:www && npm run build:android", "start:windows": "npm run build:www && npm run build:windows", "start:desktop": "npm start", - "watch": "grunt watch", + + "open:ios": "open platforms/ios/*.xcodeproj", + "open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android", + + "run:android": "cordova run android --device", + "run:android-release": "cordova run android --device --release", + "build:www": "grunt", "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:ios-release": "grunt ios-release", + "build:android-release": "grunt android-release", + "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", + "build:osx-pkg": "grunt desktop-osx-pkg", + "build:osx-dmg": "grunt desktop-osx-dmg", + "build:others": "grunt desktop-others", + + "sign:desktop": "grunt desktop-sign", + "sign:android": "grunt exec:androidsign", + "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": "grunt android-release", - "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", - "unstage-package": "git reset package.json", - "clean-all": "git clean -dfx" + "final:ios": "npm run build:ios-release", + "final:android": "npm run build:android-release", + "final:windows": "npm run build:windows-release", + "final:desktop": "npm run build:desktop-release", + "final:mobile": "npm run build:mobile-release", + "final:app": "npm run build:app-release" }, "devDependencies": { "cordova": "^6.3.1", From 8b505141d7e0e2de91eb93c2728d373c98902cda Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Tue, 4 Sep 2018 16:45:52 +0900 Subject: [PATCH 03/10] renaming, clean up --- Gruntfile.js | 73 ++++++++++++++---------------- app-template/package-template.json | 40 ++++++++-------- 2 files changed, 51 insertions(+), 62 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b191a751f..7aa700729 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -47,43 +47,37 @@ module.exports = function(grunt) { wpcopy: { command: 'make -C cordova wp-copy', }, - iosdebug: { - command: 'npm run build:ios', - }, - ios: { - command: 'cordova prepare ios && cordova build ios --release', - }, xcode: { command: 'npm run open:ios', }, - androiddebug: { - command: 'npm run build:android', + build_ios_debug: { + command: 'npm run build:ios', }, - android: { + build_ios_release: { + command: 'cordova prepare ios && cordova build ios --release', + }, + android_studio: { + 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', }, - androidrun: { - command: 'npm run run:android && npm run log:android', + run_android: { + command: 'cordova run android --device && npm run log:android', }, - androidbuild: { - command: 'cd cordova/project && cordova build android --release', + log_android: { + command: 'adb logcat | grep chromium', }, - androidsign: { + 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" so I have added that prefix to the final apk // so that its filename shows up in the log output. 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, - }, - 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: { options: { @@ -351,49 +345,48 @@ module.exports = function(grunt) { grunt.registerTask('wp', ['prod', 'exec:wp']); grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']); 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('android-debug', ['exec:androiddebug', 'exec:androidrun']); - grunt.registerTask('android', ['exec:android']); - grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']); // Build all - grunt.registerTask('app-release', ['mobile-release', 'desktop-release']); + grunt.registerTask('build-app-release', ['build-mobile-release', 'build-desktop-release']); /** * Mobile app */ // Build mobile app - grunt.registerTask('mobile-release', ['ios-release', 'android-release']); + grunt.registerTask('build-mobile-release', ['build-ios-release', 'build-android-release']); // Build ios - grunt.registerTask('ios-release', ['prod', 'exec:ios']); + grunt.registerTask('start-ios', ['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('android-release', ['prod', 'exec:android', 'exec:androidsign']); + grunt.registerTask('start-android', ['build-android-debug', 'exec:run_android', 'exec:log_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 - 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 - 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 - 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 - 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 - grunt.registerTask('desktop-sign', ['exec:sign_desktop_dist']); + grunt.registerTask('sign-desktop', ['exec:sign_desktop_dist']); // Release desktop - grunt.registerTask('desktop-release', ['desktop-build', 'desktop-sign']); + grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']); }; diff --git a/app-template/package-template.json b/app-template/package-template.json index 7b8e2955c..4d6082b26 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -95,46 +95,42 @@ "unstage-package": "git reset package.json", "clean-all": "git clean -dfx", - "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", "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:ios": "npm run build:www && npm run build:ios", - "start:android": "npm run build:www && npm run build:android", "start:windows": "npm run build:www && npm run build:windows", - "start:desktop": "npm start", - "open:ios": "open platforms/ios/*.xcodeproj", - "open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android", + "open:ios": "grunt exec:xcode", + "open:android": "grunt exec:android_studio", - "run:android": "cordova run android --device", - "run:android-release": "cordova run android --device --release", - "build:www": "grunt", "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:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"", - "build:ios-release": "grunt ios-release", - "build:android-release": "grunt android-release", - "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", + "start:ios": "grunt start-ios", + "build:ios-debug": "grunt build-ios-debug", + "build:ios-release": "grunt build-ios-release", + + "start:android": "grunt start-android", + "build:android-debug": "grunt build-android-debug", + "build:android-release": "grunt build-android-release", + + "build:desktop-release": "grunt build-desktop-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", - "sign:desktop": "grunt desktop-sign", - "sign:android": "grunt exec:androidsign", + "sign:desktop": "grunt sign-desktop", + "sign:android": "grunt sign-android", "final:www": "npm run build:www-release", "final:ios": "npm run build:ios-release", "final:android": "npm run build:android-release", "final:windows": "npm run build:windows-release", - "final:desktop": "npm run build:desktop-release", + "final:desktop": "npm run build:build-desktop-release", "final:mobile": "npm run build:mobile-release", "final:app": "npm run build:app-release" }, From 2121655249f7940e95cb90e152f2f225d9651bbc Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 5 Sep 2018 09:48:42 +1200 Subject: [PATCH 04/10] Grouping scripts in alphabetical order so it is easier to find things, and know what is there. --- app-template/package-template.json | 64 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/app-template/package-template.json b/app-template/package-template.json index 4d6082b26..691fc0a62 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -87,44 +87,24 @@ "bitcoincashjs-fork": "^1.0.3" }, "scripts": { - "postinstall": "bower install", - "watch": "grunt watch", - "log:android": "adb logcat | grep chromium", - "test": "karma start test/karma.conf.js --single-run", - "clean": "trash platforms && trash plugins && cordova prepare", - "unstage-package": "git reset package.json", - "clean-all": "git clean -dfx", - "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\"", - "start:windows": "npm run build:www && npm run build:windows", - - "open:ios": "grunt exec:xcode", - "open:android": "grunt exec:android_studio", - + "build:android-debug": "grunt build-android-debug", + "build:android-release": "grunt build-android-release", + "build:desktop-release": "grunt build-desktop-release", + "build:desktop": "grunt build-desktop", + "build:ios-debug": "grunt build-ios-debug", + "build:ios-release": "grunt build-ios-release", + "build:osx-pkg": "grunt build-desktop-osx-pkg", + "build:osx-dmg": "grunt build-desktop-osx-dmg", + "build:others": "grunt build-desktop-others", "build:www": "grunt", "build:www-release": "grunt prod", "build:windows": "cordova prepare windows && cordova build windows -- --arch=\"ARM\"", "build:windows-release": "cordova prepare windows && cordova build windows --release --arch=\"ARM\"", - "start:ios": "grunt start-ios", - "build:ios-debug": "grunt build-ios-debug", - "build:ios-release": "grunt build-ios-release", - - "start:android": "grunt start-android", - "build:android-debug": "grunt build-android-debug", - "build:android-release": "grunt build-android-release", - - "build:desktop-release": "grunt build-desktop-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", - - "sign:desktop": "grunt sign-desktop", - "sign:android": "grunt sign-android", + "clean": "trash platforms && trash plugins && cordova prepare", + "clean-all": "git clean -dfx", "final:www": "npm run build:www-release", "final:ios": "npm run build:ios-release", @@ -132,7 +112,27 @@ "final:windows": "npm run build:windows-release", "final:desktop": "npm run build:build-desktop-release", "final:mobile": "npm run build:mobile-release", - "final:app": "npm run build:app-release" + "final:app": "npm run build:app-release", + + "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: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", + "watch": "grunt watch" }, "devDependencies": { "cordova": "^6.3.1", From ea23b2679569ab443036210874ffcb83a3cdc336 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 5 Sep 2018 09:56:19 +1200 Subject: [PATCH 05/10] Removed duplicate logging for Android, and created start:android-log. --- Gruntfile.js | 4 ++-- app-template/package-template.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7aa700729..887f77c41 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -66,7 +66,7 @@ module.exports = function(grunt) { command: 'cordova prepare android && cordova build android --release', }, run_android: { - command: 'cordova run android --device && npm run log:android', + command: 'cordova run android --device', }, log_android: { command: 'adb logcat | grep chromium', @@ -363,7 +363,7 @@ module.exports = function(grunt) { grunt.registerTask('build-ios-release', ['prod', 'exec:build_ios_release']); // Build android - grunt.registerTask('start-android', ['build-android-debug', 'exec:run_android', 'exec:log_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']); diff --git a/app-template/package-template.json b/app-template/package-template.json index 691fc0a62..59430637a 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -127,6 +127,7 @@ "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", From 8dedc04fe8695de29944187314511d2dc1a895ee Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 5 Sep 2018 10:03:00 +1200 Subject: [PATCH 06/10] Edited obsolete comment. --- Gruntfile.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 887f77c41..22275d26b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -73,8 +73,7 @@ module.exports = function(grunt) { }, 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" so I have added that prefix to the final apk - // so that its filename shows up in the log output. + // 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, } From ba2fa1f26ea7b301ae5a544b8cdc20b60d92bea0 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 5 Sep 2018 10:33:47 +1200 Subject: [PATCH 07/10] Fixed start:ios and put Grunt tasks in alphabetical order to make it easier to find definitions. --- Gruntfile.js | 104 +++++++++++++++-------------- app-template/package-template.json | 16 ++--- 2 files changed, 63 insertions(+), 57 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 22275d26b..c0161b0e6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,54 +8,9 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), exec: { - 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' - }, - 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: { command: 'node ./util/buildAppConfig.js' }, - externalServices: { - command: 'node ./util/buildExternalServices.js' - }, - clean: { - command: 'rm -Rf bower_components node_modules' - }, - cordovaclean: { - command: 'make -C cordova clean' - }, - coveralls: { - command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js' - }, - chrome: { - command: 'make -C chrome-app ' - }, - wpinit: { - command: 'make -C cordova wp-init', - }, - wpcopy: { - command: 'make -C cordova wp-copy', - }, - xcode: { - command: 'npm run open:ios', - }, - build_ios_debug: { - command: 'npm run build:ios', - }, - build_ios_release: { - command: 'cordova prepare ios && cordova build ios --release', - }, android_studio: { command: ' open -a open -a /Applications/Android\\ Studio.app platforms/android', }, @@ -65,18 +20,69 @@ module.exports = function(grunt) { build_android_release: { command: 'cordova prepare android && cordova build android --release', }, - run_android: { - command: 'cordova run android --device', + 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: { + command: 'rm -Rf bower_components node_modules' + }, + cordovaclean: { + command: 'make -C cordova clean' + }, + coveralls: { + command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js' + }, + create_dmg_dist: { + 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: { + command: 'make -C cordova wp-init', + }, + wpcopy: { + command: 'make -C cordova wp-copy', + }, + xcode: { + command: 'open platforms/ios/*.xcodeproj', + } }, watch: { options: { @@ -357,7 +363,7 @@ module.exports = function(grunt) { grunt.registerTask('build-mobile-release', ['build-ios-release', 'build-android-release']); // Build ios - grunt.registerTask('start-ios', ['ios-debug', 'exec:xcode']); + 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']); diff --git a/app-template/package-template.json b/app-template/package-template.json index 59430637a..845a8d246 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -98,21 +98,21 @@ "build:osx-pkg": "grunt build-desktop-osx-pkg", "build:osx-dmg": "grunt build-desktop-osx-dmg", "build:others": "grunt build-desktop-others", - "build:www": "grunt", - "build:www-release": "grunt prod", "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-release": "grunt prod", + "clean": "trash platforms && trash plugins && cordova prepare", "clean-all": "git clean -dfx", - "final:www": "npm run build:www-release", - "final:ios": "npm run build:ios-release", "final:android": "npm run build:android-release", - "final:windows": "npm run build:windows-release", - "final:desktop": "npm run build:build-desktop-release", - "final:mobile": "npm run build:mobile-release", "final:app": "npm run build:app-release", + "final:desktop": "npm run build:build-desktop-release", + "final:ios": "npm run build:ios-release", + "final:mobile": "npm run build:mobile-release", + "final:windows": "npm run build:windows-release", + "final:www": "npm run build:www-release", "log:android": "adb logcat | grep chromium", From 5c5558fbd45080e384a9a71b712ceeab5c5e0260 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 5 Sep 2018 10:28:01 +0900 Subject: [PATCH 08/10] remove final --- app-template/package-template.json | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app-template/package-template.json b/app-template/package-template.json index 845a8d246..4dbcfd767 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -89,15 +89,21 @@ "scripts": { "apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh", + "build:app-release": "grunt build-app-release", + "build:mobile-release": "grunt build-mobile-release", + "build:desktop-release": "grunt build-desktop-release", + "build:android-debug": "grunt build-android-debug", "build:android-release": "grunt build-android-release", - "build:desktop-release": "grunt build-desktop-release", - "build:desktop": "grunt build-desktop", + "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", @@ -106,14 +112,6 @@ "clean": "trash platforms && trash plugins && cordova prepare", "clean-all": "git clean -dfx", - "final:android": "npm run build:android-release", - "final:app": "npm run build:app-release", - "final:desktop": "npm run build:build-desktop-release", - "final:ios": "npm run build:ios-release", - "final:mobile": "npm run build:mobile-release", - "final:windows": "npm run build:windows-release", - "final:www": "npm run build:www-release", - "log:android": "adb logcat | grep chromium", "open:android": "grunt exec:android_studio", From 9ff9e2ea91f190f9b4fc76632a36461fd2891484 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 5 Sep 2018 10:30:06 +0900 Subject: [PATCH 09/10] tab missing --- app-template/package-template.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app-template/package-template.json b/app-template/package-template.json index 4dbcfd767..200c269f6 100644 --- a/app-template/package-template.json +++ b/app-template/package-template.json @@ -90,7 +90,8 @@ "apply:bitcoincom": "npm i fs-extra && cd app-template && node apply.js bitcoincom && npm i && cordova prepare && cd ../ && ./fix-asn1.sh", "build:app-release": "grunt build-app-release", - "build:mobile-release": "grunt build-mobile-release", + + "build:mobile-release": "grunt build-mobile-release", "build:desktop-release": "grunt build-desktop-release", "build:android-debug": "grunt build-android-debug", From 0d8812509d362116da2a2cb62defe0351825c1d7 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 6 Sep 2018 15:45:20 +1200 Subject: [PATCH 10/10] Updated readme. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 56ae84eab..75ced5808 100644 --- a/README.md +++ b/README.md @@ -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. -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 ```sh npm run clean-all npm run apply:bitcoincom -npm run final:android +npm run build:android-release ``` ### iOS @@ -128,7 +128,7 @@ npm run final:android ```sh npm run clean-all npm run apply:bitcoincom -npm run final:ios +npm run build:ios-release ``` ### Desktop (Linux, macOS, and Windows) @@ -136,7 +136,7 @@ npm run final:ios ```sh npm run clean-all npm run apply:bitcoincom -npm run final:desktop +npm run build:desktop-release ``` ## About The Bitcoin.com Wallet