From 7d5eee8602f7e3a4555bd8781f4f3e921cecbe27 Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Sat, 22 Dec 2018 01:14:54 -0800 Subject: [PATCH 1/4] Update windows packaging process The 64bitBuild.bat script has been renamed to package.bat and has been updated so that it is capable of performing the complete packaging process without having to rely on the jar first being built and prepped from the MacOS scripts. However, it does support having the jar previously built and prepped and will look for a prepped jar in the desktop/package folder. If not found, it will build and prep it prior to packaging the executable. Additionally, some unnecessary options that were being passed to javapackager.exe have been eliminated such as BappVersion and Bruntime. AppVersion is now being passed via environment variables and the Bruntime option is valid only when the -native option is set to jnlp. The Bisq.iss file was changed so it no longer needs to be updated with AppVersion every time as it is being passed from package.bat via environment variables. Also, AppCopyrightYear does not need to be updated as it is determined automatically. A few other options were added or tweaked as well. Finally, a release.bat script has been added that will perform the release process of copying necessary files to a versioned release folder and generating/verifying signatures. Linux and MacOS packaged installers should be copied to their appropriate package folders prior to executing this script if they are to be included in this release process, otherwise only the Windows files will be included. The MacOS and Linux packaging scripts should be reviewed and updated accordingly. --- desktop/package/macosx/create_app.sh | 2 +- desktop/package/{macosx => }/tools-1.0.jar | Bin desktop/package/windows/64bitBuild.bat | 29 ----- desktop/package/windows/Bisq.iss | 22 ++-- desktop/package/windows/package.bat | 118 +++++++++++++++++++++ desktop/package/windows/release.bat | 70 ++++++++++++ 6 files changed, 203 insertions(+), 38 deletions(-) rename desktop/package/{macosx => }/tools-1.0.jar (100%) delete mode 100644 desktop/package/windows/64bitBuild.bat create mode 100644 desktop/package/windows/package.bat create mode 100644 desktop/package/windows/release.bat diff --git a/desktop/package/macosx/create_app.sh b/desktop/package/macosx/create_app.sh index 4a981bbfd73..d9d542dc29a 100755 --- a/desktop/package/macosx/create_app.sh +++ b/desktop/package/macosx/create_app.sh @@ -33,7 +33,7 @@ shasum -a256 $EXE_JAR | awk '{print $1}' # We make a deterministic jar by stripping out comments with date, etc. # jar file created from https://github.com/ManfredKarrer/tools -java -jar ./package/macosx/tools-1.0.jar $EXE_JAR +java -jar ./package/tools-1.0.jar $EXE_JAR echo SHA 256 after stripping jar file to get a deterministic jar: shasum -a256 $EXE_JAR | awk '{print $1}' | tee deploy/Bisq-$version.jar.txt diff --git a/desktop/package/macosx/tools-1.0.jar b/desktop/package/tools-1.0.jar similarity index 100% rename from desktop/package/macosx/tools-1.0.jar rename to desktop/package/tools-1.0.jar diff --git a/desktop/package/windows/64bitBuild.bat b/desktop/package/windows/64bitBuild.bat deleted file mode 100644 index 259a33a17a5..00000000000 --- a/desktop/package/windows/64bitBuild.bat +++ /dev/null @@ -1,29 +0,0 @@ -:: Invoke from Bisq home directory -:: edit iss file -> AppVersion -:: edit -> -BappVersion and -srcfiles - -:: 64 bit build -:: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) - -cd ../../ - -SET version=0.9.1 - -:: Private setup -::SET outdir=\\VBOXSVR\vm_shared_windows -:: Others might use the following -SET outdir=. - -call "%JAVA_HOME%\bin\javapackager.exe" -deploy ^ --BappVersion="%version%" ^ --native exe ^ --name Bisq ^ --title Bisq ^ --vendor Bisq ^ --outdir %outdir% ^ --appclass bisq.desktop.app.BisqAppMain ^ --srcdir %outdir% ^ --srcfiles Bisq.jar ^ --outfile Bisq ^ --Bruntime="%JAVA_HOME%\jre" ^ --v diff --git a/desktop/package/windows/Bisq.iss b/desktop/package/windows/Bisq.iss index 23264dc73c7..b14fe1cdf42 100644 --- a/desktop/package/windows/Bisq.iss +++ b/desktop/package/windows/Bisq.iss @@ -1,17 +1,23 @@ -;This file will be executed next to the application bundle image +;This file will be executed next to the application bundle image ;I.e. current directory will contain folder Bisq with application files -[Setup] +#define AppVersion GetEnv('version') +#define FileVersion GetEnv('file_version') +#define AppCopyrightYear GetDateTimeString('yyyy', '-', ':') +[Setup] AppId={{bisq}} AppName=Bisq -AppVersion=0.9.1 -AppVerName=Bisq +AppVersion={#AppVersion} +AppVerName=Bisq v{#AppVersion} AppPublisher=Bisq AppComments=Bisq -AppCopyright=Copyright (C) 2018 +AppCopyright=Copyright (C) {#AppCopyrightYear} AppPublisherURL=https://bisq.network -AppSupportURL=https://bisq.network -;AppUpdatesURL=http://java.com/ +AppSupportURL=https://bisq.community +;AppUpdatesURL=https://github.com/bisq-network/bisq/releases +VersionInfoVersion={#FileVersion} +VersionInfoDescription=Bisq Setup +VersionInfoCopyright=Copyright (C) {#AppCopyrightYear} DefaultDirName={localappdata}\Bisq DisableStartupPrompt=Yes DisableDirPage=Yes @@ -24,7 +30,7 @@ DefaultGroupName=Bisq LicenseFile= ;WinXP or above MinVersion=0,5.1 -OutputBaseFilename=Bisq +OutputBaseFilename=Bisq-{#AppVersion} Compression=lzma SolidCompression=yes PrivilegesRequired=lowest diff --git a/desktop/package/windows/package.bat b/desktop/package/windows/package.bat new file mode 100644 index 00000000000..48156512b1a --- /dev/null +++ b/desktop/package/windows/package.bat @@ -0,0 +1,118 @@ +:: Requirements: +:: - Inno Setup unicode installed (http://www.jrsoftware.org/isdl.php) +:: - OracleJDK 10 installed +:: Note: OpenJDK 10 does not have the javapackager util, so must use OracleJDK +:: Prior to running this script: +:: - Update version below +:: - Ensure JAVA_HOME below is pointing to OracleJDK 10 directory + +@echo off + +set version=0.9.1-SNAPSHOT +set JAVA_HOME=%ProgramFiles%\Java\jdk-10.0.2 +set package_dir=%~dp0.. +for /F "tokens=1,2,3 delims=.-" %%a in ("%version%") do ( + set file_version=%%a.%%b.%%c +) + +cd %~dp0..\..\.. + +if exist "%package_dir%\desktop-%version%-all.jar" ( + set jar_dir=%package_dir% + set jar_file=%package_dir%\desktop-%version%-all.jar + set jar_filename=desktop-%version%-all.jar + goto PackageJar +) + +echo Building application +call gradlew.bat :desktop:clean :desktop:build -x test shadowJar +if exist "%~dp0..\..\..\desktop\build\libs\desktop-%version%-all.jar" ( + set jar_dir=%~dp0..\..\..\desktop\build\libs + set jar_file=%~dp0..\..\..\desktop\build\libs\desktop-%version%-all.jar + set jar_filename=desktop-%version%-all.jar +) else ( + echo No jar file available in %~dp0..\..\..\desktop\build\libs + exit /B 1 +) + +if not exist "%TEMP%\7za920\7za.exe" ( + echo Downloading 7zip ^(command line version^) to %TEMP% in order to extract the jar + powershell -Command "Invoke-WebRequest https://www.7-zip.org/a/7za920.zip -OutFile $env:temp\7za920.zip" + powershell -Command "Expand-Archive $env:temp\7za920.zip -DestinationPath $env:temp\7za920 -Force" +) + +set tmp_dir=%~dp0..\..\..\desktop\build\libs\tmp +echo Extracting jar file to %tmp_dir% +if exist "%tmp_dir%" ( + rmdir /S /Q "%tmp_dir%" +) +md "%tmp_dir%" +"%TEMP%\7za920\7za.exe" x "%jar_file%" -o"%tmp_dir%" -r -y + +echo Deleting problematic module config from extracted jar +:: Strip out Java 9 module configuration used in the fontawesomefx library as it causes javapackager to stop +:: because of this existing module information, since it is not used as a module. +:: Sometimes module-info.class does not exist - TODO check why and if still needed +if exist "%tmp_dir%\module-info.class" ( + del /Q "%tmp_dir%\module-info.class" +) + +echo Zipping jar again without module config +set jar_file=%package_dir%\%jar_filename% +if exist "%jar_file%" ( + del /Q "%jar_file%" +) +"%TEMP%\7za920\7za.exe" a -tzip "%jar_file%" "%tmp_dir%\*" -r +rmdir /S /Q "%tmp_dir%" + +if exist "%TEMP%\7za920.zip" ( + echo Removing downloaded files + del /Q "%TEMP%\7za920.zip" +) + +echo SHA256 before stripping jar file: +for /F "delims=" %%h in ('certutil -hashfile "%jar_file%" SHA256 ^| findstr -i -v "SHA256" ^| findstr -i -v "certutil"') do (set hash=%%h) +echo %hash% + +echo Making deterministic jar by stripping out parameters and comments that contain dates +:: Jar file created from https://github.com/ManfredKarrer/tools +:: TODO Is this step still necessary? Since we are using preserveFileTimestamps and reproducibleFileOrder in build.gradle +java -jar "%CD%\desktop\package\tools-1.0.jar" "%jar_file%" + +echo SHA256 after stripping jar file: +for /F "delims=" %%h in ('certutil -hashfile "%jar_file%" SHA256 ^| findstr -i -v "SHA256" ^| findstr -i -v "certutil"') do (set hash=%%h) +echo %hash% +echo %hash% > "%package_dir%\%jar_filename%.txt" + +:PackageJar +if exist "%package_dir%\windows\Bisq-%version%.exe" ( + del /Q "%package_dir%\windows\Bisq-%version%.exe" +) + +cd desktop + +echo Generating packaged executable +call "%JAVA_HOME%\bin\javapackager.exe" -deploy ^ +-native exe ^ +-name Bisq ^ +-title Bisq ^ +-vendor Bisq ^ +-outdir "%package_dir%\windows" ^ +-appclass bisq.desktop.app.BisqAppMain ^ +-srcdir "%package_dir%" ^ +-srcfiles %jar_filename% ^ +-outfile Bisq ^ +-v + +if not exist "%package_dir%\windows\Bisq-%version%.exe" ( + echo No exe file found at %package_dir%\windows\Bisq-%version%.exe + exit /B 2 +) + +echo SHA256 of %package_dir%\windows\Bisq-%version%.exe: +for /F "delims=" %%h in ('certutil -hashfile "%package_dir%\windows\Bisq-%version%.exe" SHA256 ^| findstr -i -v "SHA256" ^| findstr -i -v "certutil"') do (set hash=%%h) +echo %hash% +echo %hash% > "%package_dir%\windows\Bisq-%version%.exe.txt" + +echo Done! +pause diff --git a/desktop/package/windows/release.bat b/desktop/package/windows/release.bat new file mode 100644 index 00000000000..4f33cce6604 --- /dev/null +++ b/desktop/package/windows/release.bat @@ -0,0 +1,70 @@ +:: Requirements: +:: - GPG installed (https://gpg4win.org/get-gpg4win.html) +:: - GPG key has been created +:: Prior to running this script: +:: - Update version below + +@echo off + +set version=0.9.1-SNAPSHOT +set release_dir=%~dp0..\..\..\releases\%version% +set package_dir=%~dp0.. + +set dmg=Bisq-%version%.dmg +set deb=Bisq-%version%.deb +set exe=Bisq-%version%.exe + +set /P gpg_user="Enter email address used for gpg signing: " + +echo Creating release directory +if exist "%release_dir%" ( + rmdir /S /Q "%release_dir%" +) +md "%release_dir%" + +echo Copying files to release folder +:: sig key mkarrer +xcopy /Y "%~dp0..\F379A1C6.asc" "%release_dir%" +:: sig key cbeams +xcopy /Y "%~dp0..\5BC5ED73.asc" "%release_dir%" +:: sig key Christoph Atteneder +xcopy /Y "%~dp0..\29CDFD3B.asc" "%release_dir%" +:: signing key +xcopy /Y "%~dp0..\signingkey.asc" "%release_dir%" +if exist "%package_dir%\macosx\%dmg%" ( + xcopy /Y "%package_dir%\macosx\%dmg%" "%release_dir%" + xcopy /Y "%package_dir%\macosx\%dmg%.txt" "%release_dir%" +) +if exist "%package_dir%\linux\%deb%" ( + xcopy /Y "%package_dir%\linux\%deb%" "%release_dir%" + xcopy /Y "%package_dir%\linux\%deb%.txt" "%release_dir%" +) +if exist "%package_dir%\windows\%exe%" ( + xcopy /Y "%package_dir%\windows\%exe%" "%release_dir%" + xcopy /Y "%package_dir%\windows\%exe%.txt" "%release_dir%" +) + +echo Creating signatures +if exist "%release_dir%\%dmg%" ( + gpg --digest-algo SHA256 --local-user %gpg_user% --output "%release_dir%\%dmg%.asc" --detach-sig --armor "%release_dir%\%dmg%" +) +if exist "%release_dir%\%deb%" ( + gpg --digest-algo SHA256 --local-user %gpg_user% --output "%release_dir%\%deb%.asc" --detach-sig --armor "%release_dir%\%deb%" +) +if exist "%release_dir%\%exe%" ( + gpg --digest-algo SHA256 --local-user %gpg_user% --output "%release_dir%\%exe%.asc" --detach-sig --armor "%release_dir%\%exe%" +) + +echo Verifying signatures +if exist "%release_dir%\%dmg%" ( + gpg --digest-algo SHA256 --verify "%release_dir%\%dmg%.asc" +) +if exist "%release_dir%\%deb%" ( + gpg --digest-algo SHA256 --verify "%release_dir%\%deb%.asc" +) +if exist "%release_dir%\%exe%" ( + gpg --digest-algo SHA256 --verify "%release_dir%\%exe%.asc" +) + +echo Done! +pause From 3d2817e884e5876b97ac6d9f8485c00a4c76657d Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 7 Jan 2019 12:15:26 +0100 Subject: [PATCH 2/4] Manually merge back changes from master --- desktop/package/windows/Bisq.iss | 112 ++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 38 deletions(-) diff --git a/desktop/package/windows/Bisq.iss b/desktop/package/windows/Bisq.iss index b14fe1cdf42..80c3bdd6082 100644 --- a/desktop/package/windows/Bisq.iss +++ b/desktop/package/windows/Bisq.iss @@ -1,5 +1,8 @@ ;This file will be executed next to the application bundle image ;I.e. current directory will contain folder Bisq with application files +;Note: This file must use UTF-8 encoding with BOM + +#define SourceDir GetEnv('package_dir') + '\windows' #define AppVersion GetEnv('version') #define FileVersion GetEnv('file_version') #define AppCopyrightYear GetDateTimeString('yyyy', '-', ':') @@ -10,7 +13,7 @@ AppName=Bisq AppVersion={#AppVersion} AppVerName=Bisq v{#AppVersion} AppPublisher=Bisq -AppComments=Bisq +AppComments={cm:AppComments} AppCopyright=Copyright (C) {#AppCopyrightYear} AppPublisherURL=https://bisq.network AppSupportURL=https://bisq.community @@ -22,14 +25,14 @@ DefaultDirName={localappdata}\Bisq DisableStartupPrompt=Yes DisableDirPage=Yes DisableProgramGroupPage=Yes -DisableReadyPage=Yes -DisableFinishedPage=Yes +DisableReadyPage=No +DisableFinishedPage=No DisableWelcomePage=Yes DefaultGroupName=Bisq ;Optional License LicenseFile= -;WinXP or above -MinVersion=0,5.1 +;Windows 7 with Service Pack 1 or above +MinVersion=0,6.1.7601 OutputBaseFilename=Bisq-{#AppVersion} Compression=lzma SolidCompression=yes @@ -37,40 +40,40 @@ PrivilegesRequired=lowest SetupIconFile=Bisq\Bisq.ico UninstallDisplayIcon={app}\Bisq.ico UninstallDisplayName=Bisq +WizardImageFile={#SourceDir}\Bisq-setup-image.bmp WizardImageStretch=No WizardSmallImageFile=Bisq-setup-icon.bmp ArchitecturesInstallIn64BitMode=x64 -ChangesAssociations=Yes +ShowLanguageDialog=No [Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" +Name: en; MessagesFile: "compiler:Default.isl" +Name: de; MessagesFile: "compiler:Languages\German.isl" +Name: fr; MessagesFile: "compiler:Languages\French.isl" +Name: sp; MessagesFile: "compiler:Languages\Spanish.isl" + +[CustomMessages] +en.AppComments=The decentralized exchange network +en.AppIsRunning=Bisq is running, please close it and run setup again. +de.AppComments=Das dezentrale Austauschnetzwerk +de.AppIsRunning=Bisq läuft, bitte schließen Sie es und führen Sie das Setup erneut aus. +fr.AppComments=Le réseau d'échange décentralisé +fr.AppIsRunning=Bisq est en cours d'exécution, fermez-le et exécutez à nouveau le programme d'installation. +sp.AppComments=La red de intercambio descentralizado +sp.AppIsRunning=Bisq se está ejecutando, ciérrelo y vuelva a ejecutar la configuración. [Files] Source: "Bisq\Bisq.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "Bisq\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs [Icons] -Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnTrue() -Name: "{commondesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico"; Check: returnFalse() +Name: "{group}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico" +Name: "{userdesktop}\Bisq"; Filename: "{app}\Bisq.exe"; IconFilename: "{app}\Bisq.ico" [Run] -Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent; Check: returnTrue() -Filename: "{app}\Bisq.exe"; Parameters: "-install -svcName ""Bisq"" -svcDesc ""Bisq"" -mainExe ""Bisq.exe"" "; Check: returnFalse() - -[UninstallRun] -Filename: "{app}\Bisq.exe "; Parameters: "-uninstall -svcName Bisq -stopOnUninstall"; Check: returnFalse() +Filename: "{app}\Bisq.exe"; Description: "{cm:LaunchProgram,Bisq}"; Flags: nowait postinstall skipifsilent [Code] -function returnTrue(): Boolean; -begin - Result := True; -end; - -function returnFalse(): Boolean; -begin - Result := False; -end; - procedure DirectoryCopy(SourcePath, DestPath: string); var FindRec: TFindRec; @@ -128,7 +131,7 @@ begin entry := ExpandConstant('{localappdata}') + '\Bisq\'; if DirExists(entry) then begin DelTree(entry, true, true, true); - end + end; end; procedure DeleteTorFiles; @@ -143,15 +146,15 @@ begin hiddenServiceDir := mainnetDir + '\tor\hiddenservice'; hiddenServiceBackupDir := mainnetDir + '\hiddenservice_backup'; if DirExists(hiddenServiceDir) then begin - if DirExists(hiddenServiceBackupDir) then begin - DelTree(hiddenServiceBackupDir, true, true, true); - end - CreateDir(hiddenServiceBackupDir); - DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir); - DelTree(torDir, false, true, true); - CreateDir(hiddenServiceDir); - DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir); - end + if DirExists(hiddenServiceBackupDir) then begin + DelTree(hiddenServiceBackupDir, true, true, true); + end; + CreateDir(hiddenServiceBackupDir); + DirectoryCopy(hiddenServiceDir, hiddenServiceBackupDir); + DelTree(torDir, false, true, true); + CreateDir(hiddenServiceDir); + DirectoryCopy(hiddenServiceBackupDir, hiddenServiceDir); + end; end; function PrepareToInstall(var NeedsRestart: Boolean): String; @@ -161,11 +164,44 @@ begin Result := ''; end; +function IsAppRunning(): Boolean; +var + FSWbemLocator : Variant; + FWMIService : Variant; + FWbemObjectSet : Variant; + ExecutablePath : String; +begin + Result := False; + ExecutablePath := Format('%s\Bisq\Bisq.exe', [ExpandConstant('{localappdata}')]) + StringChangeEx(ExecutablePath, '\', '\\', True); + try + FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator'); + FWMIService := FSWbemLocator.ConnectServer('localhost', 'root\CIMV2', '', ''); + FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where ExecutablePath="%s"', [ExecutablePath])); + Result := (FWbemObjectSet.Count > 0); + FWbemObjectSet := Unassigned; + FWMIService := Unassigned; + FSWbemLocator := Unassigned; + except + end; +end; + function InitializeSetup(): Boolean; begin -// Possible future improvements: -// if version less or same => just launch app -// if upgrade => check if same app is running and wait for it to exit -// Add pack200/unpack200 support? Result := True; + if IsAppRunning() then + begin + MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK); + Result := False; + end; +end; + +function InitializeUninstall(): Boolean; +begin + Result := True; + if IsAppRunning() then + begin + MsgBox(ExpandConstant('{cm:AppIsRunning}'), mbCriticalError, MB_OK); + Result := False; + end; end; From c82c0e5296350088cd0a383a9dde506d844092a2 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 7 Jan 2019 12:19:41 +0100 Subject: [PATCH 3/4] Not override JAVA_HOME --- desktop/package/windows/package.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/desktop/package/windows/package.bat b/desktop/package/windows/package.bat index 48156512b1a..ab2af6c8aeb 100644 --- a/desktop/package/windows/package.bat +++ b/desktop/package/windows/package.bat @@ -9,7 +9,6 @@ @echo off set version=0.9.1-SNAPSHOT -set JAVA_HOME=%ProgramFiles%\Java\jdk-10.0.2 set package_dir=%~dp0.. for /F "tokens=1,2,3 delims=.-" %%a in ("%version%") do ( set file_version=%%a.%%b.%%c From 584b5557c319b0aa32b7cd5fe4f71071b7a7436a Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Mon, 7 Jan 2019 14:07:48 +0100 Subject: [PATCH 4/4] Remove BOM as it fails during build process on Windows 10 --- desktop/package/windows/Bisq.iss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/package/windows/Bisq.iss b/desktop/package/windows/Bisq.iss index 80c3bdd6082..2075dbc84d7 100644 --- a/desktop/package/windows/Bisq.iss +++ b/desktop/package/windows/Bisq.iss @@ -1,6 +1,6 @@ -;This file will be executed next to the application bundle image +;This file will be executed next to the application bundle image ;I.e. current directory will contain folder Bisq with application files -;Note: This file must use UTF-8 encoding with BOM +;Note: This file must use UTF-8 encoding #define SourceDir GetEnv('package_dir') + '\windows' #define AppVersion GetEnv('version')