Skip to content

Commit 8c658a7

Browse files
committed
Update jpackage task. Remove scripts.
1 parent 436c564 commit 8c658a7

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545

4646
## Сборка дистрибутива
4747

48-
Запускает утилиту **jpackage**, используя скрипт (macOS - `jpackage_mac.sh`, Windows - `jpackage_win.bat`).
48+
Задача `:jpackage` в `build.gradle` Запускает утилиту [**jpackage
49+
**](https://docs.oracle.com/en/java/javase/21/docs/specs/man/jpackage.html).
4950

5051
```shell
5152
./gradlew jpackage

build.gradle

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -202,27 +202,18 @@ tasks.register("copyJar", Copy) {
202202
into(jpackageInputDir)
203203
}
204204

205-
final Map<String, String> jpackageCommonOptions = [
206-
"APP_NAME" : "GEM",
207-
"APP_VERSION" : project.version.toString().replaceAll(/[^0-9.]/, ""),
208-
"DEST" : layout.buildDirectory.dir("dist").get().asFile.absolutePath,
209-
"INPUT" : jpackageInputDir,
210-
"MAIN_CLASS" : application.mainClass.get(),
211-
"MAIN_JAR" : tasks.jar.archiveFileName.get(),
212-
"RESOURCE_DIR": file("$projectDir/package_resources").absolutePath
213-
]
214-
215205
tasks.register("jpackage", Exec) {
216206
dependsOn "build", "copyJar", "copyDependencies", "copyNativeDependencies"
217207
workingDir = projectDir
218-
environment(jpackageCommonOptions)
219-
220-
def os = DefaultNativePlatform.currentOperatingSystem
221-
if (os.isMacOsX()) {
222-
commandLine "bash", "jpackage_mac.sh"
223-
} else if (os.isWindows()) {
224-
commandLine "cmd", "/c", "jpackage_win.bat"
225-
} else {
226-
throw new StopActionException("Platform is not supported: ${os}")
227-
}
208+
executable "jpackage"
209+
args(
210+
"--type", "app-image",
211+
"--name", "GEM",
212+
"--app-version", project.version.toString().replaceAll(/[^0-9.]/, ""),
213+
"--dest", layout.buildDirectory.dir("dist").get().asFile.absolutePath,
214+
"--input", jpackageInputDir,
215+
"--main-class", application.mainClass.get(),
216+
"--main-jar", tasks.jar.archiveFileName.get(),
217+
"--resource-dir", file("$projectDir/package_resources").absolutePath
218+
)
228219
}

jpackage_mac.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

jpackage_win.bat

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)