Skip to content

Commit 0bac3da

Browse files
committed
Fix export on linux platform
1 parent 986caee commit 0bac3da

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,17 @@ jobs:
107107
run: |
108108
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-sample -p desktop --include-jdk -o exported-game-jdk
109109
test -d exported-game-jdk
110+
if [ "$(uname -s)" = "Linux" ]; then
111+
ls exported-game-jdk/*.deb
112+
elif [ "$(uname -s)" = "Darwin" ]; then
113+
ls exported-game-jdk/*.dmg
114+
fi
110115
- name: Test desktop export with JDK (Windows)
111116
if: runner.os == 'Windows'
112117
run: |
113118
tiny-cli-${{github.ref_name}}\bin\tiny-cli.bat export tiny-sample -p desktop --include-jdk -o exported-game-jdk
114119
if (-Not (Test-Path exported-game-jdk)) { exit 1 }
120+
if (-Not (Get-ChildItem exported-game-jdk\*.exe)) { exit 1 }
115121
116122
env:
117123
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,17 @@ sfx:
3131

3232
sample:
3333
./gradlew :tiny-cli:run --args="run ." -Ptiny.workDir=tiny-sample
34+
35+
test-linux-export:
36+
./gradlew assembleDist -Pversion=DEV-SNAPSHOT
37+
docker run --rm \
38+
-v "$(PWD)/tiny-cli/build/distributions:/dist" \
39+
-v "$(PWD)/tiny-sample:/tiny-sample" \
40+
eclipse-temurin:17-jdk-jammy \
41+
bash -c '\
42+
apt-get update && apt-get install -y --no-install-recommends fakeroot binutils unzip && \
43+
cd /tmp && \
44+
unzip /dist/tiny-cli-DEV-SNAPSHOT.zip && \
45+
tiny-cli-DEV-SNAPSHOT/bin/tiny-cli export /tiny-sample -p desktop --include-jdk -o /tmp/exported-game-jdk && \
46+
ls /tmp/exported-game-jdk/*.deb \
47+
'

tiny-cli/src/main/kotlin/com/github/minigdx/tiny/cli/command/ExportCommand.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.minigdx.tiny.cli.command
22

3+
import com.github.ajalt.clikt.core.Abort
34
import com.github.ajalt.clikt.core.CliktCommand
45
import com.github.ajalt.clikt.core.Context
56
import com.github.ajalt.clikt.parameters.arguments.argument
@@ -96,7 +97,7 @@ class ExportCommand : CliktCommand(name = "export") {
9697
if (includeJdk && !isJpackageAvailable()) {
9798
echo("\uD83D\uDE31 jpackage is not available. Please use Java 14 or later with jpackage support.")
9899
echo("\uD83D\uDCA1 Alternatively, use --exclude-jdk to create a portable JAR launcher.")
99-
return
100+
throw Abort()
100101
}
101102

102103
val targetPlatform = when (desktopPlatform) {
@@ -305,6 +306,7 @@ class ExportCommand : CliktCommand(name = "export") {
305306

306307
if (exitCode != 0) {
307308
echo("\uD83D\uDE31 jpackage failed with exit code $exitCode")
309+
throw Abort()
308310
}
309311

310312
if (!debug) {
@@ -342,7 +344,7 @@ class ExportCommand : CliktCommand(name = "export") {
342344
echo("\uD83D\uDE31 Could not find tiny-cli JAR.")
343345
echo("\uD83D\uDCA1 The CLI must be installed before using export-desktop.")
344346
echo("\uD83D\uDCA1 Run 'make install' to install the CLI.")
345-
return
347+
throw Abort()
346348
}
347349

348350
Files.copy(cliJar.toPath(), outputJar.toPath(), StandardCopyOption.REPLACE_EXISTING)
@@ -499,7 +501,7 @@ class ExportCommand : CliktCommand(name = "export") {
499501
return when (platform) {
500502
"windows" -> "exe"
501503
"mac" -> "dmg"
502-
"linux" -> "pkg"
504+
"linux" -> "deb"
503505
else -> "app-image"
504506
}
505507
}

0 commit comments

Comments
 (0)