11" Building cryptomator cli..."
22
3+ $appVersion = ' 0.1.0-local'
4+
35# Check if maven is installed
46$commands = ' mvn'
57foreach ($cmd in $commands ) {
@@ -12,9 +14,9 @@ if(-not $env:JAVA_HOME) {
1214}
1315
1416# Check Java version
15- $minJavaVersion = $ (mvn help:evaluate " -Dexpression=jdk.version" - q - DforceStdout)
17+ $minJavaVersion = [ int ] $ (mvn help:evaluate " -Dexpression=jdk.version" - q - DforceStdout)
1618$javaVersion = $ (& " $env: JAVA_HOME \bin\java" -- version) -split ' ' | Select-Object - Index 1
17- if ( ($javaVersion -split ' .' | Select-Object - First 1 ) -ne " 22 " ) {
19+ if ( ([ int ] ( $javaVersion.Split ( ' .' ) | Select-Object - First 1 )) -lt $minJavaVersion ) {
1820 throw " Java version $javaVersion is too old. Minimum required version is $minJavaVersion "
1921}
2022
@@ -24,43 +26,24 @@ Copy-Item ./LICENSE.txt -Destination ./target -ErrorAction Stop
2426Move-Item ./ target/ cryptomator- cli-* .jar ./ target/ mods - ErrorAction Stop
2527
2628Write-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
3731
3832if ( ($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 ."
4034}
4135
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+
4244# jpackage
43- # app-version is hard coded, since the script is only for local test builds
4445Write-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
46+ & $env: JAVA_HOME / bin/ jpackage ` @./ target/ jpackage.args -- win- console
6447
6548if ( ($LASTEXITCODE -ne 0 ) -or (-not (Test-Path ./ target/ cryptomator- cli))) {
6649 throw " Binary creation with jpackage failed with exit code $LASTEXITCODE ."
0 commit comments