forked from cryptomator/cryptomator-win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
89 lines (77 loc) · 3.5 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
param(
[string]$upstreamVersion = "continuous",
[string]$signtool = "signtool sign /sha1 FF52240075AD7D14AF25629FDF69635357C7D14B /tr http://timestamp.digicert.com /fd sha256 /d `$qCryptomator`$q `$f"
)
$buildDir = Split-Path -Parent $PSCommandPath
$buildVersion = & git rev-list --count HEAD
Write-Output "`$upstreamVersion=$upstreamVersion"
Write-Output "`$buildVersion=$buildVersion"
Write-Output "`$signtool=$signtool"
Write-Output "`$buildDir=$buildDir"
Write-Output "`$Env:JAVA_HOME=$Env:JAVA_HOME"
$dokanInstallerVersion = & $PSScriptRoot"\Get-MSIFileInformation.ps1" .\resources\innosetup\Dokan_x64.msi "ProductVersion"
Write-Output "`$dokanInstallerVersion=$dokanInstallerVersion"
if (-not (Test-Path $Env:JAVA_HOME)) {
Write-Output "JAVA_HOME not set or does not exist: $Env:JAVA_HOME"
exit 1;
}
if(-not ($dokanInstallerVersion -eq [System.Diagnostics.FileVersionInfo]::GetVersionInfo(".\resources\app\dlls\dokan1.dll").FileVersion)){
Write-Output "The Dokany version of the installer does not match the signed Dokan-DLL. Please update one of them such they belong to the same release."
exit 1;
}
# cleanup
Remove-Item -Recurse -ErrorAction Ignore -Force buildkit.zip, app, libs, runtimeImage
# configure stuff
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# download and extract buildkit
$buildkitUrl = "https://github.com/cryptomator/cryptomator/releases/download/${upstreamVersion}/buildkit-win.zip"
$wc = New-Object System.Net.WebClient
Write-Output "Downloading ${buildkitUrl}..."
$wc.Downloadfile($buildkitUrl, "buildkit.zip")
Expand-Archive -Path buildkit.zip -DestinationPath . -Force
if (-not (Test-Path libs)) {
Write-Output "libs/ does not exist. Buildkit damaged?"
exit 1;
}
# create runtime image
& "$Env:JAVA_HOME\bin\jlink" `
--verbose `
--output runtimeImage `
--module-path `"$Env:JAVA_HOME\jmods`" `
--add-modules java.base,java.logging,java.xml,java.sql,java.management,java.security.sasl,java.naming,java.datatransfer,java.security.jgss,java.rmi,java.scripting,java.prefs,java.desktop,jdk.unsupported,java.net.http,jdk.crypto.ec `
--no-header-files `
--no-man-pages `
--strip-debug `
--strip-native-commands `
--compress=1
# create application dir
Write-Output "Create application dir: ..."
& "$Env:JAVA_HOME\bin\jpackage" `
--verbose `
--type app-image `
--runtime-image runtimeImage `
--input libs `
--dest app `
--name Cryptomator `
--vendor "Skymatic GmbH" `
--copyright "(C) 2016 - 2020 Skymatic GmbH" `
--app-version $upstreamVersion `
--icon resources/app/Cryptomator.ico `
--java-options "-Dcryptomator.logDir=`"~/AppData/Roaming/Cryptomator`"" `
--java-options "-Dcryptomator.settingsPath=`"~/AppData/Roaming/Cryptomator/settings.json`"" `
--java-options "-Dcryptomator.ipcPortPath=`"~/AppData/Roaming/Cryptomator/ipcPort.bin`"" `
--java-options "-Dcryptomator.keychainPath=`"~/AppData/Roaming/Cryptomator/keychain.json`"" `
--java-options "-Dcryptomator.buildNumber=`"exe-$buildVersion`"" `
--java-options "-Xss2m" `
--java-options "-Xmx512m" `
--main-class org.cryptomator.launcher.Cryptomator `
--main-jar launcher-$upstreamVersion.jar
# adjust .app
& 'attrib' -r 'app/Cryptomator/Cryptomator.exe'
Copy-Item resources/app/dlls/* app/Cryptomator/
# build installer
Copy-Item -Recurse resources/innosetup/* app/
Set-Location app/
$env:CRYPTOMATOR_VERSION = "$upstreamVersion"
$env:DOKAN_VERSION = "$dokanInstallerVersion"
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' setup.iss /Qp "/sdefault=`"$signtool`""