Improvement 335 - Automation desktop building by grunt

This commit is contained in:
Jean-Baptiste Dominguez 2018-06-19 18:25:05 +02:00
commit 1a28ae6c2b
13 changed files with 247 additions and 76 deletions

View file

@ -7,16 +7,22 @@ module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
curl: {
'./cache/nwjs.zip': 'https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip',
},
unzip: {
'./cache/': './cache/nwjs.zip'
},
pkg: grunt.file.readJSON('package.json'),
exec: {
replaceNWJS: {
command: 'rm -R ./cache/0.19.5/osx64/nwjs.app; cp -R ./cache/nwjs-mas-v0.19.5-osx-x64/nwjs.app ./cache/0.19.5/osx64/'
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'
@ -30,9 +36,6 @@ module.exports = function(grunt) {
cordovaclean: {
command: 'make -C cordova clean'
},
macos: {
command: 'sh webkitbuilds/build-macos.sh sign'
},
coveralls: {
command: 'cat coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
},
@ -71,7 +74,7 @@ module.exports = function(grunt) {
stdin: true,
},
desktopsign: {
cmd: 'gpg -u E0AE67E7 --output webkitbuilds/<%= pkg.title %>-linux.zip.sig --detach-sig webkitbuilds/<%= pkg.title %>-linux.zip ; gpg -u E0AE67E7 --output webkitbuilds/<%= pkg.title %>.exe.sig --detach-sig webkitbuilds/<%= pkg.title %>.exe'
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'
@ -232,43 +235,78 @@ module.exports = function(grunt) {
expand: true,
cwd: 'webkitbuilds/',
src: ['.desktop', '../www/img/app/favicon.ico', '../resources/<%= pkg.name %>/linux/512x512.png'],
dest: 'webkitbuilds/<%= pkg.title %>/linux64/',
dest: 'webkitbuilds/others/<%= pkg.title %>/linux64/',
flatten: true,
filter: 'isFile'
}],
}
},
nwjs: {
options: {
appName: '<%= pkg.title %>',
platforms: ['win64', 'osx64', 'linux64'],
buildDir: './webkitbuilds',
version: '0.19.5',
macIcns: './resources/<%= pkg.name %>/mac/app.icns',
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleIdentifier': 'com.bitcoin.mwallet.mac',
'CFBundleDisplayName': '<%= pkg.title %>',
'CFBundleShortVersionString': '<%= pkg.version %>',
'CFBundleVersion': '<%= pkg.androidVersion %>',
'LSApplicationCategoryType': 'public.app-category.finance',
'CFBundleURLTypes': [
{
'CFBundleURLName': 'URI Handler',
'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
}
]
}
others: {
options: {
appName: '<%= pkg.nameCaseNoSpace %>',
platforms: ['win64', 'linux64'],
buildDir: './webkitbuilds/others',
version: '0.19.5',
exeIco: './www/img/app/logo.ico'
},
src: ['./package.json', './www/**/*']
},
dmg: {
options: {
appName: '<%= pkg.nameCaseNoSpace %>',
platforms: ['osx64'],
buildDir: './webkitbuilds/dmg',
version: '0.19.5',
macIcns: './resources/<%= pkg.name %>/mac/app.icns',
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleDisplayName': '<%= pkg.title %>',
'CFBundleShortVersionString': '<%= pkg.version %>',
'CFBundleVersion': '<%= pkg.androidVersion %>',
'LSApplicationCategoryType': 'public.app-category.finance',
'CFBundleURLTypes': [
{
'CFBundleURLName': 'URI Handler',
'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
}
]
}
},
src: ['./package.json', './www/**/*']
},
pkg: {
options: {
appName: '<%= pkg.nameCaseNoSpace %>',
platforms: ['osx64'],
buildDir: './webkitbuilds/pkg',
version: '0.19.5',
macIcns: './resources/<%= pkg.name %>/mac/pkg/app.icns',
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleIdentifier': 'com.bitcoin.mwallet.mac',
'CFBundleDisplayName': '<%= pkg.title %>',
'CFBundleShortVersionString': '<%= pkg.version %>',
'CFBundleVersion': '<%= pkg.androidVersion %>',
'LSApplicationCategoryType': 'public.app-category.finance',
'CFBundleURLTypes': [
{
'CFBundleURLName': 'URI Handler',
'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
}
]
}
},
src: ['./package.json', './www/**/*']
},
src: ['./package.json', './www/**/*']
},
compress: {
linux: {
options: {
archive: './webkitbuilds/<%= pkg.title %>-linux.zip'
archive: './webkitbuilds/others/<%= pkg.title %>-linux.zip'
},
expand: true,
cwd: './webkitbuilds/<%= pkg.title %>/linux64/',
cwd: './webkitbuilds/others/<%= pkg.title %>/linux64/',
src: ['**/*'],
dest: '<%= pkg.title %>-linux/'
}
@ -287,9 +325,6 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
grunt.registerTask('prod', ['default', 'uglify']);
grunt.registerTask('translate', ['nggettext_extract']);
grunt.registerTask('desktop', ['prod', 'nwjs', 'fix-nwjs-macos', 'nwjs', 'copy:linux', 'compress:linux']);
grunt.registerTask('osx', ['prod', 'nwjs', 'exec:macos', 'exec:osxsign']);
grunt.registerTask('osx-debug', ['default', 'nwjs']);
grunt.registerTask('chrome', ['default','exec:chrome']);
grunt.registerTask('wp', ['prod', 'exec:wp']);
grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
@ -301,7 +336,23 @@ module.exports = function(grunt) {
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']);
grunt.registerTask('fix-nwjs-macos', ['curl', 'unzip', 'exec:replaceNWJS']);
grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);
// Build desktop
grunt.registerTask('desktop-build', ['desktop-others', 'desktop-osx-dmg', 'desktop-osx-pkg']);
// Build desktop win64 & linux64
grunt.registerTask('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']);
// Build desktop osx dmg
grunt.registerTask('desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']);
// Sign desktop
grunt.registerTask('desktop-sign', ['exec:sign_desktop_dist']);
// Release desktop
grunt.registerTask('desktop-release', ['desktop-build', 'desktop-sign']);
};

View file

@ -11,7 +11,10 @@ var templates = {
'ionic.config.json': '/',
'.desktop': 'webkitbuilds/',
'setup-win.iss': 'webkitbuilds/',
'build-macos.sh': 'webkitbuilds/',
'scripts/create-dmg-dist.sh': 'webkitbuilds/',
'scripts/create-others-dist.sh': 'webkitbuilds/',
'scripts/create-pkg-dist.sh': 'webkitbuilds/',
'scripts/sign-desktop-dist.sh': 'webkitbuilds/',
'manifest.json': 'chrome-app/',
// 'bower.json': '/',
};

View file

@ -15,6 +15,7 @@
],
"main": "www/index.html",
"title": "*USERVISIBLENAME*",
"nameCaseNoSpace": "*NAMECASENOSPACE*",
"window": {
"title": "*USERVISIBLENAME*",
"icon": "www/img/app/icon.png",

View file

@ -1,11 +1,5 @@
#!/bin/bash
SHOULD_SIGN=$1
if [ "$SHOULD_SIGN" ]
then
echo "Will sign the APP"
fi
# by Andy Maloney
# http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/
@ -16,21 +10,25 @@ if [ -d "$dir" ]; then
fi
# set up your app name, architecture, and background image file name
APP_NAME="*USERVISIBLENAME*"
APP_PACKAGE=$1
APP_VERSION=$2
APP_NAME=$3
APP_FULLNAME=$4
rm dmg-background.tiff
ln -s ../resources/*PACKAGENAME*/mac/dmg-background.tiff dmg-background.tiff
ln -s ../resources/bitcoin.com/mac/dmg-background.tiff dmg-background.tiff
rm volume-icon.icns
ln -s ../resources/*PACKAGENAME*/mac/volume-icon.icns volume-icon.icns
ln -s ../resources/bitcoin.com/mac/volume-icon.icns volume-icon.icns
DMG_VOLUME_ICON="volume-icon.icns"
DMG_BACKGROUND_IMG="dmg-background.tiff"
PATH_NAME="${APP_NAME}/osx64/"
PATH_NAME="dmg/${APP_NAME}/osx64/"
# you should not need to change these
APP_EXE="${PATH_NAME}${APP_NAME}.app/Contents/MacOS/nwjs"
VOL_NAME="${APP_NAME}"
DMG_TMP="${VOL_NAME}-temp.dmg"
DMG_FINAL="${VOL_NAME}.dmg"
DMG_TMP="dmg/${VOL_NAME}-temp.dmg"
DMG_FINAL="dmg/${VOL_NAME}.dmg"
STAGING_DIR="tmp"
# Check the background image DPI and convert it if it isn't 72x72
@ -156,31 +154,14 @@ hdiutil detach "${DEVICE}"
echo "Creating compressed image"
hdiutil convert "${DMG_TMP}" -format UDZO -imagekey zlib-level=9 -o "${DMG_FINAL}"
# Sign Code (MATIAS)
if [ $SHOULD_SIGN ]
then
rm entitlements-child.plist
ln -s ../resources/bitcoin.com/mac/entitlements-child.plist entitlements-child.plist
rm entitlements-parent.plist
ln -s ../resources/bitcoin.com/mac/entitlements-parent.plist entitlements-parent.plist
rm build.cfg
ln -s ../resources/bitcoin.com/mac/build.cfg build.cfg
rm build_mas.py
ln -s ../resources/bitcoin.com/mac/build_mas.py build_mas.py
echo "Signing ${APP_NAME}"
export APP_PATH=${STAGING_DIR}/${APP_NAME}.app
python build_mas.py -C build.cfg -I "${APP_PATH}" -P "${APP_NAME}.pkg"
echo "Signing Done"
export DIST_PATH="dist"
if [ ! -d $DIST_PATH ]; then
mkdir $DIST_PATH
fi
cp -vR "${DMG_FINAL}" "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.dmg"
# clean up
rm -rf "${DMG_TMP}"
rm -rf "${STAGING_DIR}"

View file

@ -0,0 +1,54 @@
#!/bin/bash
# make sure we are in the correct dir when we double-click a .command file
dir=${0%/*}
if [ -d "$dir" ]; then
cd "$dir"
fi
# set up your app name, architecture, and background image file name
APP_PACKAGE=$1
APP_VERSION=$2
APP_NAME=$3
APP_FULLNAME=$4
export APP_LINUX_PATH="others/${APP_NAME}/linux64"
export APP_WIN_PATH="others/${APP_NAME}/win64"
export DIST_PATH="dist"
if [ ! -d $DIST_PATH ]; then
mkdir $DIST_PATH
fi
##
# LINUX
echo "Building Linux..."
# Building package
cp -R $APP_LINUX_PATH bitcoin-com-wallet
tar -cvzf "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-linux-x64.tar.gz" bitcoin-com-wallet
# Clean
rm -R bitcoin-com-wallet
echo "Linux Done."
##
# WINDOWS
echo "Building Windows..."
# Building package
cp -R $APP_WIN_PATH bitcoin-com-wallet
zip -r "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-win-x64.zip" bitcoin-com-wallet
# Clean
rm -R bitcoin-com-wallet
echo "Windows Done."
echo "Done."
exit

View file

@ -0,0 +1,45 @@
#!/bin/bash
# make sure we are in the correct dir when we double-click a .command file
dir=${0%/*}
if [ -d "$dir" ]; then
cd "$dir"
fi
# set up your app name, architecture, and background image file name
APP_PACKAGE=$1
APP_VERSION=$2
APP_NAME=$3
APP_FULLNAME=$4
rm entitlements-child.plist
ln -s ../resources/bitcoin.com/mac/pkg/entitlements-child.plist entitlements-child.plist
rm entitlements-parent.plist
ln -s ../resources/bitcoin.com/mac/pkg/entitlements-parent.plist entitlements-parent.plist
rm build.cfg
ln -s ../resources/bitcoin.com/mac/pkg/build.cfg build.cfg
rm build_mas.py
ln -s ../resources/bitcoin.com/mac/pkg/build_mas.py build_mas.py
echo "Signing ${APP_NAME}"
export APP_PATH="pkg/${APP_NAME}/osx64/${APP_NAME}"
export TMP_PATH="tmp"
export DIST_PATH="dist"
rm -rf $TMP_PATH
mkdir $TMP_PATH
if [ ! -d $DIST_PATH ]; then
mkdir $DIST_PATH
fi
python build_mas.py -C build.cfg -O "${TMP_PATH}/${APP_NAME}.app" -I "${APP_PATH}.app" -P "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg"
echo "Signing Done"
echo "Done."
exit

View file

@ -0,0 +1,36 @@
#!/bin/bash
# make sure we are in the correct dir when we double-click a .command file
dir=${0%/*}
if [ -d "$dir" ]; then
cd "$dir"
fi
APP_PACKAGE=$1
APP_VERSION=$2
export DIST_PATH="dist"
##
# LINUX
# Sig tar.gz
gpg --output "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-linux-x64.tar.gz.sig" --detach-sig "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-linux-x64.tar.gz"
gpg --verify "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-linux-x64.tar.gz.sig" "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-linux-x64.tar.gz"
##
# WINDOWS
# Sig zip
gpg --output "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-win-x64.zip.sig" --detach-sig "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-win-x64.zip"
gpg --verify "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-win-x64.zip.sig" "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-win-x64.zip"
##
# OSX
# Sig dmg
gpg --output "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.dmg.sig" --detach-sig "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.dmg"
gpg --verify "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.dmg.sig" "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.dmg"
# Sig pkg
gpg --output "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg.sig" --detach-sig "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg"
gpg --verify "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg.sig" "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg"

Binary file not shown.

Binary file not shown.