Skip to content

Commit

Permalink
adjust local build script
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Oct 24, 2024
1 parent 087d358 commit bb4dbbd
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
"Building cryptomator cli..."

$commands = 'mvn'
$envVars = 'JAVA_HOME'
foreach ($cmd in $commands) {
Invoke-Expression -Command "${cmd} --version" -ErrorAction Stop
}

(Get-ChildItem env:* | Where-Object { $envVars -contains $_.Name} | Measure-Object).Count

<#
foreach ($envVar in $envVars) {
if( "$env:$envVar")
if(-not $env:JAVA_HOME) {
throw "Environment variable JAVA_HOME not defined"
}
#>

Write-Host "Building java app with maven..."
mvn -B clean package
Copy-Item .\LICENSE.txt -Destination .\target
Move-Item .\target\cryptomator-cli-*.jar .\target\mods
## according to jdpes we only need java.base (and java.compiler due to dagger)

Write-Host "Creating JRE with jlink..."
& $env:JAVA_HOME\bin\jlink `
--verbose `
--output target\runtime `
Expand All @@ -29,7 +26,13 @@ Move-Item .\target\cryptomator-cli-*.jar .\target\mods
--strip-debug `
--compress zip-0

if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path .\target\runtime))) {
throw "JRE creation with jLink failed with exit code $LASTEXITCODE."
}

# jpackage
# app-version is hard coded, since the script is only for local test builds
Write-Host "Creating app binary with jpackage..."
& $env:JAVA_HOME\bin\jpackage `
--verbose `
--type app-image `
Expand All @@ -41,12 +44,15 @@ Move-Item .\target\cryptomator-cli-*.jar .\target\mods
--name cryptomator-cli `
--vendor "Skymatic GmbH" `
--copyright "(C) 2016 - 2024 Skymatic GmbH" `
--app-version "1.0.0.0" `
--app-version "0.0.1.0" `
--java-options "-Dorg.cryptomator.cli.version=0.0.1-local" `
--java-options "--enable-preview" `
--java-options "--enable-native-access=org.cryptomator.jfuse.win" `
--java-options "-Xss5m" `
--java-options "-Xmx256m" `
--java-options '-Dfile.encoding="utf-8"' `
--win-console
#--resource-dir dist/win/resources
#--icon dist/win/resources/Cryptomator.ico

if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path .\target\cryptomator-cli))) {
throw "Binary creation with jpackage failed with exit code $LASTEXITCODE."
}

0 comments on commit bb4dbbd

Please sign in to comment.