Skip to content

Commit

Permalink
also adjust jlink to use envsubst
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Nov 21, 2024
1 parent 0571f6f commit 83f08b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ cp ./LICENSE.txt ./target/
mv ./target/cryptomator-cli-*.jar ./target/mods

echo "Creating JRE with jlink..."
"$JAVA_HOME/bin/jlink" \
'@./dist/jlink.args' \
--module-path "${JAVA_HOME}/jmods"
envsubst < dist/jlink.args > target/jlink.args
"$JAVA_HOME/bin/jlink" '@./target/jlink.args'

if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
echo "JRE creation with jlink failed."
Expand Down
5 changes: 2 additions & 3 deletions build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ cp ./LICENSE.txt ./target/
mv ./target/cryptomator-cli-*.jar ./target/mods

echo "Creating JRE with jlink..."
"$JAVA_HOME/bin/jlink" \
'@./dist/jlink.args' \
--module-path "${JAVA_HOME}/jmods"
envsubst < dist/jlink.args > target/jlink.args
"$JAVA_HOME/bin/jlink" '@./target/jlink.args'

if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
echo "JRE creation with jlink failed."
Expand Down
11 changes: 5 additions & 6 deletions build_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ Copy-Item ./LICENSE.txt -Destination ./target -ErrorAction Stop
Move-Item ./target/cryptomator-cli-*.jar ./target/mods -ErrorAction Stop

Write-Host "Creating JRE with jlink..."
& $env:JAVA_HOME/bin/jlink `
`@./dist/jlink.args `
--module-path "${env:JAVA_HOME}/jmods"
Get-Content -Path './dist/jlink.args' | ForEach-Object { $_.Replace('${JAVA_HOME}', "$env:JAVA_HOME")} | Out-File -FilePath './target/jlink.args'
& $env:JAVA_HOME/bin/jlink `@./target/jlink.args

if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path ./target/runtime))) {
throw "JRE creation with jLink failed with exit code $LASTEXITCODE."
Expand All @@ -37,9 +36,9 @@ if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path ./target/runtime))) {
## powershell does not have envsubst
$jpAppVersion='99.9.9'
Get-Content -Path './dist/jpackage.args' | ForEach-Object {
$_.Replace('${APP_VERSION}', $appVersion)
.Replace('${JP_APP_VERSION}', $jpAppVersion)
.Replace('${NATIVE_ACCESS_PACKAGE}', 'org.cryptomator.jfuse.win')
$_.Replace('${APP_VERSION}', $appVersion).
Replace('${JP_APP_VERSION}', $jpAppVersion).
Replace('${NATIVE_ACCESS_PACKAGE}', 'org.cryptomator.jfuse.win')
} | Out-File -FilePath './target/jpackage.args'

# jpackage
Expand Down
1 change: 1 addition & 0 deletions dist/jlink.args
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--verbose
--module-path "${JAVA_HOME}/jmods"
--output target/runtime
--add-modules java.base,java.compiler,java.naming,java.xml
--strip-native-commands
Expand Down

0 comments on commit 83f08b0

Please sign in to comment.