Skip to content

Commit 71679de

Browse files
committed
Switch to Kotlin and GradleX
1 parent 34ec945 commit 71679de

File tree

4 files changed

+117
-63
lines changed

4 files changed

+117
-63
lines changed

build.gradle

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

build.gradle.kts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
plugins {
2+
java
3+
application
4+
id("org.gradlex.extra-java-module-info") version "1.13.1"
5+
id("org.gradlex.jvm-dependency-conflict-resolution") version "2.4"
6+
id("org.gradlex.java-module-dependencies") version "1.10"
7+
id("org.gradlex.java-module-packaging") version "1.1"
8+
}
9+
10+
group = "org.jabreftest.test"
11+
12+
// "1.0-SNAPSHOT" cannot be used, otherwise we get
13+
// java.lang.IllegalArgumentException: Version [1.0-SNAPSHOT] contains invalid component [0-SNAPSHOT]
14+
version = "0.1.0"
15+
16+
repositories {
17+
mavenCentral()
18+
}
19+
20+
val javafx = "25"
21+
val junitVersion = "5.13.4"
22+
23+
java {
24+
toolchain {
25+
languageVersion.set(JavaLanguageVersion.of(25))
26+
}
27+
}
28+
29+
tasks.withType<JavaCompile>().configureEach {
30+
options.encoding = "UTF-8"
31+
}
32+
33+
application {
34+
mainModule.set("javafx.reproducer")
35+
mainClass.set("org.jabreftest.test.javafxreproducer.HelloApplication")
36+
}
37+
38+
dependencies {
39+
implementation("org.openjfx:javafx-controls:$javafx")
40+
implementation("org.openjfx:javafx-fxml:$javafx")
41+
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
42+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
43+
}
44+
45+
tasks.test {
46+
useJUnitPlatform()
47+
}
48+
49+
jvmDependencyConflicts.patch {
50+
listOf("base", "controls", "fxml", "graphics").forEach { jfxModule ->
51+
module("org.openjfx:javafx-$jfxModule") {
52+
addTargetPlatformVariant("", "none", "none") // matches the empty Jars: to get better errors
53+
addTargetPlatformVariant("linux", OperatingSystemFamily.LINUX, MachineArchitecture.X86_64)
54+
addTargetPlatformVariant("linux-aarch64", OperatingSystemFamily.LINUX, MachineArchitecture.ARM64)
55+
addTargetPlatformVariant("mac", OperatingSystemFamily.MACOS, MachineArchitecture.X86_64)
56+
addTargetPlatformVariant("mac-aarch64", OperatingSystemFamily.MACOS, MachineArchitecture.ARM64)
57+
addTargetPlatformVariant("win", OperatingSystemFamily.WINDOWS, MachineArchitecture.X86_64)
58+
}
59+
}
60+
}
61+
62+
extraJavaModuleInfo {
63+
failOnAutomaticModules = true
64+
failOnModifiedDerivedModuleNames = true
65+
skipLocalJars = true
66+
}
67+
68+
// Source: https://github.com/jjohannes/java-module-system/blob/main/gradle/plugins/src/main/kotlin/targets.gradle.kts
69+
// Configure variants for OS. Target name can be any string, but should match the name used in GitHub actions.
70+
javaModulePackaging {
71+
// Configuration shared by all targets and applications
72+
vendor = "JabRef"
73+
jlinkOptions.addAll(
74+
"--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages"
75+
// "--ignore-signing-information",
76+
// "--compress", "zip-6",
77+
// "--no-header-files",
78+
// "--no-man-pages",
79+
// "--bind-services",
80+
)
81+
82+
target("ubuntu-22.04") {
83+
operatingSystem = OperatingSystemFamily.LINUX
84+
architecture = MachineArchitecture.X86_64
85+
packageTypes = listOf("app-image", "deb", "rpm")
86+
}
87+
target("ubuntu-22.04-arm") {
88+
operatingSystem = OperatingSystemFamily.LINUX
89+
architecture = MachineArchitecture.ARM64
90+
packageTypes = listOf("app-image", "deb", "rpm")
91+
}
92+
target("macos-13") {
93+
operatingSystem = OperatingSystemFamily.MACOS
94+
architecture = MachineArchitecture.X86_64
95+
packageTypes = listOf("app-image", "dmg", "pkg")
96+
singleStepPackaging = true
97+
}
98+
target("macos-14") {
99+
operatingSystem = OperatingSystemFamily.MACOS
100+
architecture = MachineArchitecture.ARM64
101+
packageTypes = listOf("app-image", "dmg", "pkg")
102+
singleStepPackaging = true
103+
}
104+
target("windows-latest") {
105+
operatingSystem = OperatingSystemFamily.WINDOWS
106+
architecture = MachineArchitecture.X86_64
107+
packageTypes = listOf("app-image", "msi")
108+
}
109+
}

settings.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
rootProject.name = "javafx-reproducer"
1+
plugins {
2+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
3+
}
4+
5+
rootProject.name = "javafx-reproducer"

src/main/java/module-info.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
module org.jabreftest.test.javafxreproducer {
1+
// "Full name" cannot be used - otherwise, one gets following error message:
2+
// Module name 'org.jabreftest.test.javafxreproducer' does not fit the project and source set names; expected name '<optional.prefix.>javafx.reproducer'.
3+
module javafx.reproducer {
24
requires javafx.controls;
35
requires javafx.fxml;
46

0 commit comments

Comments
 (0)