feat: fix build process for javafx and conveyor

This commit is contained in:
2023-04-10 17:57:01 +02:00
parent 80f7ec117a
commit d8185d280e
2 changed files with 57 additions and 5 deletions

View File

@@ -3,14 +3,16 @@ plugins {
id 'application' id 'application'
id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.openjfx.javafxplugin' version '0.0.13'
id 'dev.hydraulic.conveyor' version '1.4' id 'dev.hydraulic.conveyor' version '1.4'
id "org.panteleyev.jpackageplugin" version "1.5.2"
} }
import org.gradle.internal.os.OperatingSystem import org.gradle.internal.os.OperatingSystem
import org.panteleyev.jpackage.ImageType
group 'com.lenis0012' group 'com.lenis0012'
version '1.0' version '1.0'
project.ext.lwjglVersion = "3.3.2-SNAPSHOT" project.ext.lwjglVersion = "3.3.2"
switch (OperatingSystem.current()) { switch (OperatingSystem.current()) {
case OperatingSystem.LINUX: case OperatingSystem.LINUX:
project.ext.lwjglNatives = "natives-linux" project.ext.lwjglNatives = "natives-linux"
@@ -29,6 +31,7 @@ repositories {
dependencies { dependencies {
implementation 'org.jfxtras:jmetro:11.6.16' implementation 'org.jfxtras:jmetro:11.6.16'
implementation 'org.controlsfx:controlsfx:11.1.0' implementation 'org.controlsfx:controlsfx:11.1.0'
implementation 'org.eclipse.fx:org.eclipse.fx.drift:1.0.0'
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion") implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
implementation "org.lwjgl:lwjgl" implementation "org.lwjgl:lwjgl"
@@ -58,9 +61,9 @@ application {
mainModule = 'oraksi' mainModule = 'oraksi'
mainClass = 'com.lenis0012.oraksi.HelloApplication' mainClass = 'com.lenis0012.oraksi.HelloApplication'
applicationDefaultJvmArgs = [ applicationDefaultJvmArgs = [
'--enable-preview', '--enable-native-access=oraksi', '--enable-preview',
'--add-opens', '--enable-native-access=oraksi',
'javafx.graphics/javafx.scene=oraksi' '--add-opens=javafx.graphics/javafx.scene=oraksi'
] ]
} }
@@ -75,3 +78,39 @@ javafx {
version = '20' version = '20'
modules = ['javafx.controls', 'javafx.fxml'] modules = ['javafx.controls', 'javafx.fxml']
} }
task copyDependencies(type: Copy) {
from configurations.runtimeClasspath
into "build/jmods"
}
task copyJar(type: Copy) {
from tasks.jar
into "build/jmods"
}
jpackage {
dependsOn("build", "copyDependencies", "copyJar")
appName = "Oraksi"
appVersion = project.version.toString()
vendor = "com.lenis0012"
copyright = "Copyright (c) 2023 Lennart ten Wolde"
// runtimeImage = System.getProperty("java.home")
module = "oraksi/com.lenis0012.oraksi.HelloApplication"
modulePaths = ["$buildDir/jmods"]
destination = "$buildDir/dist"
javaOptions = ["-Dfile.encoding=UTF-8", "--enable-preview", "--enable-native-access=oraksi", "--add-opens=javafx.graphics/javafx.scene=oraksi"]
type = ImageType.APP_IMAGE
// mac {
// icon = "icons/icons.icns"
// }
//
// windows {
// icon = "icons/icons.ico"
// winMenu = true
// winDirChooser = true
// }
}

View File

@@ -10,7 +10,7 @@ app {
// Windows gets square icons, macOS and Linux icons with rounded corners. // Windows gets square icons, macOS and Linux icons with rounded corners.
icons = { icons = {
label = "FX" label = "Ok"
} }
// Ensure the icons are also included as data files so we can set the window icon. // Ensure the icons are also included as data files so we can set the window icon.
@@ -21,6 +21,19 @@ app {
// Check for and apply updates synchronously on every app launch instead of in the background. // Check for and apply updates synchronously on every app launch instead of in the background.
// Consider removing this line for your own app! // Consider removing this line for your own app!
updates = aggressive updates = aggressive
jvm {
extract-native-libraries = true
system-properties = {
"org.lwjgl.librarypath" = <libpath>
"org.lwjgl.util.Debug" = true
}
// Required options because module is converted to jar (https://github.com/hydraulic-software/conveyor/issues/55)
options += "--enable-native-access=ALL-UNNAMED"
options += "--add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED"
}
} }
; app.windows.console = true
conveyor.compatibility-level = 8 conveyor.compatibility-level = 8