Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update windows packaging process #2163

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion desktop/package/macosx/create_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
29 changes: 0 additions & 29 deletions desktop/package/windows/64bitBuild.bat

This file was deleted.

22 changes: 14 additions & 8 deletions desktop/package/windows/Bisq.iss
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
118 changes: 118 additions & 0 deletions desktop/package/windows/package.bat
Original file line number Diff line number Diff line change
@@ -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
70 changes: 70 additions & 0 deletions desktop/package/windows/release.bat
Original file line number Diff line number Diff line change
@@ -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