Skip to content

Commit 6a92ef1

Browse files
authored
Merge pull request #52 from Siedlerchr/switch-to-gradle-x-2
Switch to Kotlin and GradleX
2 parents 34ec945 + e5c8fe9 commit 6a92ef1

File tree

5 files changed

+120
-64
lines changed

5 files changed

+120
-64
lines changed

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
java-version: '25'
3232
distribution: 'corretto'
3333
- uses: gradle/actions/setup-gradle@v4
34-
- run: ./gradlew jlinkZip
34+
- run: ./gradlew jpackage
3535
- name: Upload a Build Artifact
3636
uses: actions/upload-artifact@v4
3737
with:

build.gradle

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

build.gradle.kts

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

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)