Use javafx jmods instead of jars [stage]

This commit is contained in:
crschnick 2023-10-24 19:01:38 +00:00
parent 656be93d44
commit 5d55da8821
5 changed files with 43 additions and 13 deletions

View file

@ -50,6 +50,7 @@ project.ext {
sourceWebsite = 'https://github.com/xpipe-io/xpipe'
authors = 'Christopher Schnick'
artifactChecksums = new HashMap<String, String>()
javafxVersion = '21.0.1'
}
def replaceVariablesInFileAsString(String f, Map<String, String> replacements) {

1
dist/build.gradle vendored
View file

@ -6,6 +6,7 @@ plugins {
id 'org.jreleaser' version '1.8.0'
id("com.netflix.nebula.ospackage") version "11.4.0"
id 'org.gradle.crypto.checksum' version '1.4.0'
id 'de.undercouch.download' version '5.5.0'
}
repositories {

34
dist/jpackage.gradle vendored
View file

@ -1,3 +1,5 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.util.stream.Collectors
def distDir = "${project.layout.buildDirectory.get()}/dist"
@ -41,6 +43,35 @@ if (Integer.parseInt(macVersion.substring(0, 1)) == 0) {
macVersion = "1" + macVersion.substring(1)
}
task prepareJavafxJmods(type: DefaultTask) {
doLast {
def currentOS = DefaultNativePlatform.currentOperatingSystem;
def platform = null
if (currentOS.isWindows()) {
platform = 'windows'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'osx'
}
def assetName = "openjfx-${javafxVersion}_${platform}-${arch == 'x86_64' ? 'x64' : 'aarch64'}_bin-jmods.zip"
def url = "https://download2.gluonhq.com/openjfx/${javafxVersion}/${assetName}"
if (!file(layout.buildDirectory.file('javafx.zip')).exists()) {
download.run {
src url
dest layout.buildDirectory.file('javafx.zip')
overwrite false
}
}
copy {
from zipTree(layout.buildDirectory.file('javafx.zip'))
into layout.buildDirectory.dir('dist')
}
}
}
jlink {
imageDir = file("${project.layout.buildDirectory.get()}/image")
options = [
@ -51,6 +82,8 @@ jlink {
// '--strip-native-commands'
]
addExtraModulePath(layout.buildDirectory.dir("dist/javafx-jmods-${javafxVersion}").get().toString())
launcher {
moduleName = 'io.xpipe.app'
mainClassName = 'io.xpipe.app.Main'
@ -90,6 +123,7 @@ jlink {
}
tasks.named('jlink').get().dependsOn(rootProject.getTasksByName("jar", true))
tasks.named('jlink').get().dependsOn(prepareJavafxJmods)
def outputName = org.gradle.internal.os.OperatingSystem.current().isMacOsX() ? 'xpiped.app/Contents/Resources' : 'xpiped'
def extModules = project.allExtensions.toList()

View file

@ -15,17 +15,11 @@ if (arch == 'aarch64') {
platform += '-aarch64'
}
configurations {
dep
}
def jfxVersion = '21'
dependencies {
dep "org.openjfx:javafx-base:${jfxVersion}:${platform}"
dep "org.openjfx:javafx-controls:${jfxVersion}:${platform}"
dep "org.openjfx:javafx-graphics:${jfxVersion}:${platform}"
dep "org.openjfx:javafx-media:${jfxVersion}:${platform}"
dep "org.openjfx:javafx-web:${jfxVersion}:${platform}"
dep "org.openjfx:javafx-swing:${jfxVersion}:${platform}"
compileOnly "org.openjfx:javafx-base:${javafxVersion}:${platform}"
compileOnly "org.openjfx:javafx-controls:${javafxVersion}:${platform}"
compileOnly "org.openjfx:javafx-graphics:${javafxVersion}:${platform}"
compileOnly "org.openjfx:javafx-media:${javafxVersion}:${platform}"
compileOnly "org.openjfx:javafx-web:${javafxVersion}:${platform}"
compileOnly "org.openjfx:javafx-swing:${javafxVersion}:${platform}"
}

View file

@ -1 +1 @@
1.7.2-2
1.7.2-3