1
1
" Building cryptomator cli..."
2
2
3
+ $appVersion = ' 0.1.0-local'
4
+
3
5
# Check if maven is installed
4
6
$commands = ' mvn'
5
7
foreach ($cmd in $commands ) {
@@ -14,7 +16,7 @@ if(-not $env:JAVA_HOME) {
14
16
# Check Java version
15
17
$minJavaVersion = $ (mvn help:evaluate " -Dexpression=jdk.version" - q - DforceStdout)
16
18
$javaVersion = $ (& " $env: JAVA_HOME \bin\java" -- version) -split ' ' | Select-Object - Index 1
17
- if ( ($javaVersion -split ' .' | Select-Object - First 1 ) -ne " 22" ) {
19
+ if ( ($javaVersion.Split ( ' .' ) | Select-Object - First 1 ) -ne " 22" ) {
18
20
throw " Java version $javaVersion is too old. Minimum required version is $minJavaVersion "
19
21
}
20
22
@@ -24,43 +26,25 @@ Copy-Item ./LICENSE.txt -Destination ./target -ErrorAction Stop
24
26
Move-Item ./ target/ cryptomator- cli-* .jar ./ target/ mods - ErrorAction Stop
25
27
26
28
Write-Host " Creating JRE with jlink..."
27
- & $env: JAVA_HOME / bin/ jlink `
28
- -- verbose `
29
- -- output target/ runtime `
30
- -- module- path " ${env: JAVA_HOME} /jmods" `
31
- -- add-modules java.base, java.compiler, java.naming, java.xml `
32
- -- strip- native- commands `
33
- -- no- header- files `
34
- -- no- man- pages `
35
- -- strip- debug `
36
- -- compress zip- 0
29
+ Get-Content - Path ' ./dist/jlink.args' | ForEach-Object { $_.Replace (' ${JAVA_HOME}' , " $env: JAVA_HOME " )} | Out-File - FilePath ' ./target/jlink.args'
30
+ & $env: JAVA_HOME / bin/ jlink ` @./ target/ jlink.args
37
31
38
32
if ( ($LASTEXITCODE -ne 0 ) -or (-not (Test-Path ./ target/ runtime))) {
39
- throw " JRE creation with jLink failed with exit code $LASTEXITCODE ."
33
+ throw " JRE creation with jLink failed with exit code $LASTEXITCODE ."
40
34
}
41
35
36
+ # # powershell does not have envsubst
37
+ $jpAppVersion = ' 99.9.9'
38
+ Get-Content - Path ' ./dist/jpackage.args' | ForEach-Object {
39
+ $_.Replace (' ${APP_VERSION}' , $appVersion ).
40
+ Replace(' ${JP_APP_VERSION}' , $jpAppVersion ).
41
+ Replace(' ${NATIVE_ACCESS_PACKAGE}' , ' org.cryptomator.jfuse.win' )
42
+ } | Out-File - FilePath ' ./target/jpackage.args'
43
+
42
44
# jpackage
43
45
# app-version is hard coded, since the script is only for local test builds
44
46
Write-Host " Creating app binary with jpackage..."
45
- & $env: JAVA_HOME / bin/ jpackage `
46
- -- verbose `
47
- -- type app- image `
48
- -- runtime- image target/ runtime `
49
- -- input target/ libs `
50
- -- module- path target/ mods `
51
- -- module org.cryptomator.cli/ org.cryptomator.cli.CryptomatorCli `
52
- -- dest target `
53
- -- name cryptomator- cli `
54
- -- vendor " Skymatic GmbH" `
55
- -- copyright " (C) 2016 - 2024 Skymatic GmbH" `
56
- -- app- version " 0.0.1.0" `
57
- -- java- options " -Dorg.cryptomator.cli.version=0.0.1-local" `
58
- -- java- options " --enable-preview" `
59
- -- java- options " --enable-native-access=org.cryptomator.jfuse.win" `
60
- -- java- options " -Xss5m" `
61
- -- java- options " -Xmx256m" `
62
- -- java- options ' -Dfile.encoding="utf-8"' `
63
- -- win- console
47
+ & $env: JAVA_HOME / bin/ jpackage ` @./ target/ jpackage.args -- win- console
64
48
65
49
if ( ($LASTEXITCODE -ne 0 ) -or (-not (Test-Path ./ target/ cryptomator- cli))) {
66
50
throw " Binary creation with jpackage failed with exit code $LASTEXITCODE ."
0 commit comments