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",