Skip to content

Commit

Permalink
Merge branch 'develop' into feature/sign-build-artifacts
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build-mac.yml
#	.github/workflows/build-win.yml
  • Loading branch information
infeo committed Nov 26, 2024
2 parents 5e5ec76 + 1a907ca commit 2a517ae
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 182 deletions.
39 changes: 10 additions & 29 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,17 @@ jobs:
cp LICENSE.txt target
cp target/cryptomator-*.jar target/mods
- name: Run jlink
run: >
"${JAVA_HOME}/bin/jlink"
--verbose
--output target/runtime
--module-path "${JAVA_HOME}/jmods"
--add-modules java.base,java.compiler,java.naming,java.xml
--strip-native-commands
--no-header-files
--no-man-pages
--strip-debug
--compress zip-6
run: |
envsubst < dist/jlink.args > target/jlink.args
"${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
- name: Run jpackage
run: >
"${JAVA_HOME}/bin/jpackage"
--verbose
--type app-image
--runtime-image target/runtime
--input target/libs
--module-path target/mods
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
--dest target
--name cryptomator-cli
--vendor "Skymatic GmbH"
--copyright "(C) 2016 - 2024 Skymatic GmbH"
--app-version "${{ needs.prepare.outputs.semVerNum }}"
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
--java-options "--enable-native-access=${{ matrix.native-access-lib }}"
--java-options "-Xss5m"
--java-options "-Xmx256m"
--java-options "-Dfile.encoding=\"utf-8\""
run: |
envsubst < dist/jpackage.args > target/jpackage.args
"${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args'
env:
JP_APP_VERSION: ${{ needs.prepare.outputs.semVerNum }}
APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
NATIVE_ACCESS_PACKAGE: ${{ matrix.native-access-lib }}
- uses: actions/upload-artifact@v4
with:
name: cryptomator-cli-linux-${{ matrix.architecture }}
Expand Down
47 changes: 16 additions & 31 deletions .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,22 @@ jobs:
cp LICENSE.txt target
cp target/cryptomator-*.jar target/mods
- name: Run jlink
run: >
"${JAVA_HOME}/bin/jlink"
--verbose
--output target/runtime
--module-path "${JAVA_HOME}/jmods"
--add-modules java.base,java.compiler,java.naming,java.xml
--strip-native-commands
--no-header-files
--no-man-pages
--strip-debug
--compress zip-6
run: |
envsubst < dist/jlink.args > target/jlink.args
"${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
- name: Run jpackage
run: >
"${JAVA_HOME}/bin/jpackage"
--verbose
--type app-image
--runtime-image target/runtime
--input target/libs
--module-path target/mods
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
--dest target
--name cryptomator-cli
--vendor "Skymatic GmbH"
--copyright "(C) 2016 - 2024 Skymatic GmbH"
--app-version "${{ needs.prepare.outputs.semVerNum }}"
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
--java-options "--enable-native-access=org.cryptomator.jfuse.mac"
--java-options "-Xss5m"
--java-options "-Xmx256m"
--java-options "-Dfile.encoding=\"utf-8\""
run: |
envsubst < dist/jpackage.args > target/jpackage.args
"${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args'
env:
JP_APP_VERSION: ${{ needs.prepare.outputs.semVerNum }}
APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
NATIVE_ACCESS_PACKAGE: org.cryptomator.jfuse.mac
- uses: actions/upload-artifact@v4
with:
name: cryptomator-cli-mac-${{ matrix.architecture }}
path: ./target/cryptomator-cli.app
if-no-files-found: error
- name: Patch .app dir
run: |
sed -i '' "s|###BUNDLE_SHORT_VERSION_STRING###|${VERSION_NO}|g" ./target/cryptomator-cli.app/Contents/Info.plist
Expand Down Expand Up @@ -234,5 +220,4 @@ jobs:
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
files: |
${{ matrix.artifact-name }}
cryptomator-cli-*.asc
cryptomator-cli-*.asc
40 changes: 10 additions & 30 deletions .github/workflows/build-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,17 @@ jobs:
cp LICENSE.txt target
cp target/cryptomator-*.jar target/mods
- name: Run jlink
run: >
"${JAVA_HOME}/bin/jlink"
--verbose
--output target/runtime
--module-path "${JAVA_HOME}/jmods"
--add-modules java.base,java.compiler,java.naming,java.xml
--strip-native-commands
--no-header-files
--no-man-pages
--strip-debug
--compress zip-6
run: |
envsubst < dist/jlink.args > target/jlink.args
"${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
- name: Run jpackage
run: >
"${JAVA_HOME}/bin/jpackage"
--verbose
--type app-image
--runtime-image target/runtime
--input target/libs
--module-path target/mods
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
--dest target
--name cryptomator-cli
--vendor "Skymatic GmbH"
--copyright "(C) 2016 - 2024 Skymatic GmbH"
--app-version "${{ needs.prepare.outputs.semVerNum }}"
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
--java-options "--enable-native-access=org.cryptomator.jfuse.win"
--java-options "-Xss5m"
--java-options "-Xmx256m"
--java-options "-Dfile.encoding=\"utf-8\""
--win-console
run: |
envsubst < dist/jpackage.args > target/jpackage.args
"${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args' --win-console
env:
JP_APP_VERSION: ${{ needs.prepare.outputs.semVerNum }}
APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
NATIVE_ACCESS_PACKAGE: org.cryptomator.jfuse.win
- name: Fix permissions
run: attrib -r target/cryptomator-cli/cryptomator-cli.exe
shell: pwsh
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Afterward, you can directly run Cryptomator-CLI by calling the binary, e.g. on L

To unmount, send a SIGTERM signal to the process, e.g. by pressing CTRL+C (macOS: CMD+C) in the terminal.

For a complete list of options, use the`--help` option.
For a complete list of options, use the `--help` option.
```shell
cryptomator-cli --help`
cryptomator-cli --help
```

## Filesystem Integration
Expand Down
38 changes: 9 additions & 29 deletions build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -euxo pipefail

echo "Building cryptomator cli..."

export APP_VERSION='0.1.0-local'

# Check if Maven is installed
if ! command -v mvn &> /dev/null; then
echo "Maven is not installed. Please install Maven to proceed."
Expand All @@ -29,23 +31,15 @@ cp ./LICENSE.txt ./target/
mv ./target/cryptomator-cli-*.jar ./target/mods

echo "Creating JRE with jlink..."
"$JAVA_HOME/bin/jlink" \
--verbose \
--output target/runtime \
--module-path "${JAVA_HOME}/jmods" \
--add-modules java.base,java.compiler,java.naming,java.xml \
--strip-native-commands \
--no-header-files \
--no-man-pages \
--strip-debug \
--compress zip-0
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."
exit 1
fi

NATIVE_ACCESS_PACKAGE="no.native.access.available"
export NATIVE_ACCESS_PACKAGE="no.native.access.available"
_OS=$(uname -s)
if (echo "$_OS" | grep -q "Linux.*") ; then
_ARCH=$(uname -m)
Expand All @@ -59,25 +53,11 @@ if (echo "$_OS" | grep -q "Linux.*") ; then
fi
fi

export JP_APP_VERSION='99.9.9'
envsubst < dist/jpackage.args > target/jpackage.args

echo "Creating app binary with jpackage..."
"$JAVA_HOME/bin/jpackage" \
--verbose \
--type app-image \
--runtime-image target/runtime \
--input target/libs \
--module-path target/mods \
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli \
--dest target \
--name cryptomator-cli \
--vendor "Skymatic GmbH" \
--copyright "(C) 2016 - 2024 Skymatic GmbH" \
--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=${NATIVE_ACCESS_PACKAGE}" \
--java-options "-Xss5m" \
--java-options "-Xmx256m" \
--java-options "-Dfile.encoding=utf-8" \
"$JAVA_HOME/bin/jpackage" '@./target/jpackage.args'

if [ $? -ne 0 ] || [ ! -d ./target/cryptomator-cli ]; then
echo "Binary creation with jpackage failed."
Expand Down
37 changes: 9 additions & 28 deletions build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

echo "Building cryptomator cli..."

export APP_VERSION='0.1.0-local'

# Check if Maven is installed
if ! command -v mvn &> /dev/null; then
echo "Maven is not installed. Please install Maven to proceed."
Expand All @@ -28,41 +30,20 @@ cp ./LICENSE.txt ./target/
mv ./target/cryptomator-cli-*.jar ./target/mods

echo "Creating JRE with jlink..."
"$JAVA_HOME/bin/jlink" \
--verbose \
--output target/runtime \
--module-path "${JAVA_HOME}/jmods" \
--add-modules java.base,java.compiler,java.naming,java.xml \
--strip-native-commands \
--no-header-files \
--no-man-pages \
--strip-debug \
--compress zip-0
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."
exit 1
fi

export JP_APP_VERSION='99.9.9'
export NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.mac"
envsubst < dist/jpackage.args > target/jpackage.args

echo "Creating app binary with jpackage..."
"$JAVA_HOME/bin/jpackage" \
--verbose \
--type app-image \
--runtime-image target/runtime \
--input target/libs \
--module-path target/mods \
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli \
--dest target \
--name cryptomator-cli \
--vendor "Skymatic GmbH" \
--copyright "(C) 2016 - 2024 Skymatic GmbH" \
--app-version "99.9.9" \
--java-options "-Dorg.cryptomator.cli.version=0.0.1-local" \
--java-options "--enable-preview" \
--java-options "--enable-native-access=org.cryptomator.jfuse.mac" \
--java-options "-Xss5m" \
--java-options "-Xmx256m" \
--java-options "-Dfile.encoding=utf-8" \
"$JAVA_HOME/bin/jpackage" '@./target/jpackage.args'

if [ $? -ne 0 ] || [ ! -d ./target/cryptomator-cli.app ]; then
echo "Binary creation with jpackage failed."
Expand Down
49 changes: 16 additions & 33 deletions build_win.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"Building cryptomator cli..."

$appVersion='0.1.0-local'

# Check if maven is installed
$commands = 'mvn'
foreach ($cmd in $commands) {
Expand All @@ -12,9 +14,9 @@ if(-not $env:JAVA_HOME) {
}

# Check Java version
$minJavaVersion=$(mvn help:evaluate "-Dexpression=jdk.version" -q -DforceStdout)
$minJavaVersion=[int]$(mvn help:evaluate "-Dexpression=jdk.version" -q -DforceStdout)
$javaVersion = $(& "$env:JAVA_HOME\bin\java" --version) -split ' ' | Select-Object -Index 1
if( ($javaVersion -split '.' | Select-Object -First 1) -ne "22") {
if( ([int] ($javaVersion.Split('.') | Select-Object -First 1)) -lt $minJavaVersion) {
throw "Java version $javaVersion is too old. Minimum required version is $minJavaVersion"
}

Expand All @@ -24,43 +26,24 @@ 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 `
--verbose `
--output target/runtime `
--module-path "${env:JAVA_HOME}/jmods" `
--add-modules java.base,java.compiler,java.naming,java.xml `
--strip-native-commands `
--no-header-files `
--no-man-pages `
--strip-debug `
--compress zip-0
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."
throw "JRE creation with jLink failed with exit code $LASTEXITCODE."
}

## 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')
} | Out-File -FilePath './target/jpackage.args'

# 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 `
--runtime-image target/runtime `
--input target/libs `
--module-path target/mods `
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli `
--dest target `
--name cryptomator-cli `
--vendor "Skymatic GmbH" `
--copyright "(C) 2016 - 2024 Skymatic GmbH" `
--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
& $env:JAVA_HOME/bin/jpackage `@./target/jpackage.args --win-console

if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path ./target/cryptomator-cli))) {
throw "Binary creation with jpackage failed with exit code $LASTEXITCODE."
Expand Down
9 changes: 9 additions & 0 deletions dist/jlink.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--verbose
--module-path "${JAVA_HOME}/jmods"
--output target/runtime
--add-modules java.base,java.compiler,java.naming,java.xml
--strip-native-commands
--no-header-files
--no-man-pages
--strip-debug
--compress zip-6
20 changes: 20 additions & 0 deletions dist/jpackage.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Contains three env vars:
# JP_APP_VERSION: The version needed for jpackage. This version _must_ follow the scheme Y.X.X, where Y >= 1 and X >=0
# APP_VERSION: The actual, semantic version displayed in the cli app
# NATIVE_ACCESS_PACKAGE: The java package containing the fuse bindings for the system
--verbose
--type app-image
--runtime-image target/runtime
--input target/libs
--module-path target/mods
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
--dest target
--name cryptomator-cli
--vendor "Skymatic GmbH"
--copyright "(C) 2016 - 2024 Skymatic GmbH"
--app-version "${JP_APP_VERSION}"
--java-options "-Dorg.cryptomator.cli.version=${APP_VERSION}"
--java-options "--enable-native-access=${NATIVE_ACCESS_PACKAGE}"
--java-options "-Xss5m"
--java-options "-Xmx256m"
--java-options "-Dfile.encoding=\"utf-8\""

0 comments on commit 2a517ae

Please sign in to comment.