From ba257e2d405581d0a73f069d26472fab3dbf457b Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Mon, 19 Nov 2018 09:46:42 -0800 Subject: [PATCH] More build script tweaking --- src/main.cpp | 2 ++ src/mainwindow.cpp | 3 +-- src/scripts/dobuild.ps1 | 28 ++++++++++++++++++++++++++-- src/scripts/mkmacdmg.sh | 22 +++++++++++++++------- src/scripts/mkrelease.sh | 2 +- src/version.h | 1 + zec-qt-wallet.pro | 6 +----- 7 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 src/version.h diff --git a/src/main.cpp b/src/main.cpp index d564a2d..8e27a72 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,8 @@ #include "settings.h" #include "turnstile.h" +#include "version.h" + #include "precompiled.h" int main(int argc, char *argv[]) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a88bb65..ea4584e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -11,12 +11,11 @@ #include "rpc.h" #include "balancestablemodel.h" #include "settings.h" - +#include "version.h" #include "turnstile.h" #include "senttxstore.h" #include "connection.h" - using json = nlohmann::json; MainWindow::MainWindow(QWidget *parent) : diff --git a/src/scripts/dobuild.ps1 b/src/scripts/dobuild.ps1 index 0d862d5..bbf2c94 100644 --- a/src/scripts/dobuild.ps1 +++ b/src/scripts/dobuild.ps1 @@ -2,7 +2,8 @@ param ( [Parameter(Mandatory=$true)][string]$version, [Parameter(Mandatory=$true)][string]$prev, - [Parameter(Mandatory=$true)][string]$server + [Parameter(Mandatory=$true)][string]$server, + [Parameter(Mandatory=$true)][string]$macserver ) Write-Host "[Initializing]" @@ -15,6 +16,28 @@ Remove-Item -Recurse -Force -ErrorAction Ignore ./bin Remove-Item -Recurse -Force -ErrorAction Ignore ./debug Remove-Item -Recurse -Force -ErrorAction Ignore ./release +# Create the version.h file +echo "#define APP_VERSION `"$version`"" > src/version.h +echo "" + + +echo "[Building on Mac]" +Write-Host -NoNewline "Copying files.........." +ssh $macserver "rm -rf /tmp/zqwbuild" +ssh $macserver "mkdir /tmp/zqwbuild" +scp -r * ${macserver}:/tmp/zqwbuild | Out-Null +Write-Host "[OK]" +ssh $macserver "cd /tmp/zqwbuild && APP_VERSION=$version QT_PATH=~/Qt/5.11.2/clang_64/ ZCASH_DIR=~/github/zcash bash src/scripts/mkmacdmg.sh" +if (!$?) { + Write-Output "[Error]" + exit 1; +} +New-Item artifacts -itemtype directory -Force | Out-Null +scp ${macserver}:/tmp/zqwbuild/artifacts/* artifacts/ | Out-Null +Write-Host "" + + +echo "[Building Linux/Windows]" Write-Host -NoNewline "Copying files.........." ssh $server "rm -rf /tmp/zqwbuild" ssh $server "mkdir /tmp/zqwbuild" @@ -45,7 +68,8 @@ Write-Host -NoNewline "Checking Build........." if (! (Test-Path ./artifacts/linux-zec-qt-wallet-v$version.tar.gz) -or ! (Test-Path ./artifacts/Windows-zec-qt-wallet-v$version.zip) -or ! (Test-Path ./artifacts/zec-qt-wallet-v$version.deb) -or - ! (Test-Path ./artifacts/zec-qt-wallet-v$version.msi)) { + ! (Test-Path ./artifacts/zec-qt-wallet-v$version.msi) -or + ! (Test-Path ./artifacts/zec-qt-wallet-v$version.dmg) ) { Write-Host "[Error]" exit 1; } diff --git a/src/scripts/mkmacdmg.sh b/src/scripts/mkmacdmg.sh index 51def29..ca64043 100755 --- a/src/scripts/mkmacdmg.sh +++ b/src/scripts/mkmacdmg.sh @@ -5,40 +5,48 @@ if [ -z $QT_PATH ]; then exit 1; fi +if [ -z $ZCASH_DIR ]; then + echo "ZCASH_PATH is not set. Please set it to the base directory of a compiled zcashd"; + exit 1; +fi + if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set. Please set it to the current release version of the app"; exit 1; fi -if [ ! -f ../zcash/src/zcashd ]; then - echo "Could not find compiled zcashd in ../zcash/src/."; +if [ ! -f $ZCASH_DIR/src/zcashd ]; then + echo "Could not find compiled zcashd in $ZCASH_DIR/src/."; exit 1; fi +export PATH=$PATH:/usr/local/bin + #Clean -echo -n "Cleaning............" +echo -n "Cleaning..............." make distclean >/dev/null 2>&1 rm -f artifacts/zec-qt-wallet-v$APP_VERSION.dmg echo "[OK]" -echo -n "Building............" +echo -n "Building..............." # Build $QT_PATH/bin/qmake zec-qt-wallet.pro CONFIG+=release >/dev/null make -j4 >/dev/null echo "[OK]" #Qt deploy -echo -n "Deploying..........." +echo -n "Deploying.............." mkdir artifacts >/dev/null 2>&1 rm -f artifcats/zec-qt-wallet.dmg >/dev/null 2>&1 rm -f artifacts/rw* >/dev/null 2>&1 -cp ../zcash/src/zcashd zec-qt-wallet.app/Contents/MacOS/ +cp $ZCASH_DIR/src/zcashd zec-qt-wallet.app/Contents/MacOS/ +cp $ZCASH_DIR/src/zcash-cli zec-qt-wallet.app/Contents/MacOS/ $QT_PATH/bin/macdeployqt zec-qt-wallet.app echo "[OK]" -echo -n "Building dmg........" +echo -n "Building dmg..........." # create-dmg --volname "zec-qt-wallet-v$APP_VERSION" --volicon "res/logo.icns" --window-pos 200 120 --icon "zec-qt-wallet.app" 200 190 --app-drop-link 600 185 --hide-extension "zec-qt-wallet.app" --window-size 800 400 --hdiutil-quiet --background res/dmgbg.png artifacts/zec-qt-wallet.dmg zec-qt-wallet.app >/dev/null mkdir bin/dmgbuild >/dev/null 2>&1 sed "s/RELEASE_VERSION/${APP_VERSION}/g" res/appdmg.json > bin/dmgbuild/appdmg.json diff --git a/src/scripts/mkrelease.sh b/src/scripts/mkrelease.sh index 0b9e4a7..29fe6e0 100755 --- a/src/scripts/mkrelease.sh +++ b/src/scripts/mkrelease.sh @@ -56,7 +56,7 @@ make distclean >/dev/null 2>&1 echo "[OK]" echo "" -echo "[Linux " `lsb_release -r` "]" +echo "[Building on" `lsb_release -r` "]" echo -n "Configuring............" $QT_STATIC/bin/qmake zec-qt-wallet.pro -spec linux-clang CONFIG+=release > /dev/null diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..e69d257 --- /dev/null +++ b/src/version.h @@ -0,0 +1 @@ +#define APP_VERSION "0.4.0" diff --git a/zec-qt-wallet.pro b/zec-qt-wallet.pro index 30c8b2a..fb48726 100644 --- a/zec-qt-wallet.pro +++ b/zec-qt-wallet.pro @@ -13,8 +13,6 @@ PRECOMPILED_HEADER = src/precompiled.h greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = zec-qt-wallet -APP_VERSION=\\\"0.3.2\\\" - TEMPLATE = app @@ -23,9 +21,7 @@ TEMPLATE = app # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += \ - QT_DEPRECATED_WARNINGS \ - APP_VERSION=$$APP_VERSION - + QT_DEPRECATED_WARNINGS INCLUDEPATH += src/3rdparty/