1
1
2
2
import org.gradle.internal.os.OperatingSystem
3
- import org.javamodularity.moduleplugin.extensions.CompileModuleOptions
4
- import org.javamodularity.moduleplugin.extensions.RunModuleOptions
5
3
6
4
plugins {
7
5
id(" buildlogic.java-common-conventions" )
8
6
9
7
application
10
8
11
- id(" org.openjfx.javafxplugin" ) version(" 0.1.0" )
12
-
13
9
// Do not activate; causes issues with the modularity plugin (no tests found etc)
14
10
// id("com.redock.classpathtofile") version "0.1.0"
15
11
@@ -22,9 +18,19 @@ version = project.findProperty("projVersion") ?: "100.0.0"
22
18
val luceneVersion = " 10.2.1"
23
19
val pdfbox = " 3.0.5"
24
20
21
+ val javafxVersion = " 24.0.1"
22
+
25
23
dependencies {
26
24
implementation(project(" :jablib" ))
27
25
26
+ implementation(" org.openjfx:javafx-base:$javafxVersion " )
27
+ implementation(" org.openjfx:javafx-controls:$javafxVersion " )
28
+ implementation(" org.openjfx:javafx-fxml:$javafxVersion " )
29
+ // implementation("org.openjfx:javafx-graphics:24.0.1")
30
+ implementation(" org.openjfx:javafx-graphics:$javafxVersion " )
31
+ implementation(" org.openjfx:javafx-swing:$javafxVersion " )
32
+ implementation(" org.openjfx:javafx-web:$javafxVersion " )
33
+
28
34
implementation(" org.slf4j:slf4j-api:2.0.17" )
29
35
implementation(" org.tinylog:tinylog-api:2.7.0" )
30
36
implementation(" org.tinylog:slf4j-tinylog:2.7.0" )
@@ -138,12 +144,6 @@ dependencies {
138
144
testImplementation(" com.github.javaparser:javaparser-symbol-solver-core:3.26.4" )
139
145
}
140
146
141
- javafx {
142
- version = " 24"
143
- // javafx.swing required by com.dlsc.gemsfx
144
- modules = listOf (" javafx.base" , " javafx.graphics" , " javafx.fxml" , " javafx.web" , " javafx.swing" )
145
- }
146
-
147
147
application {
148
148
mainClass.set(" org.jabref.Launcher" )
149
149
mainModule.set(" org.jabref" )
@@ -187,10 +187,6 @@ application {
187
187
)
188
188
}
189
189
190
- // Workaround for https://github.com/openjfx/javafx-gradle-plugin/issues/89
191
- // See also https://github.com/java9-modularity/gradle-modules-plugin/issues/165
192
- modularity.disableEffectiveArgumentsAdjustment()
193
-
194
190
/*
195
191
jacoco {
196
192
toolVersion = "0.8.13"
@@ -204,65 +200,10 @@ tasks.named<JavaExec>("run") {
204
200
doFirst {
205
201
// Clear the default JVM arguments to avoid warnings
206
202
// application.applicationDefaultJvmArgs = emptyList()
207
- application.applicationDefaultJvmArgs = listOf (" --enable-native-access=ai.djl.tokenizers,ai.djl.pytorch_engine,com.sun.jna,javafx.graphics,javafx.media,javafx.web,org.apache.lucene.core" )
208
- }
209
-
210
- extensions.configure<RunModuleOptions >(" moduleOptions" ) {
211
- // On a change here, also adapt "application > applicationDefaultJvmArgs"
212
- addExports.putAll(
213
- mapOf (
214
- // TODO: Remove access to internal API
215
- " javafx.base/com.sun.javafx.event" to " org.jabref.merged.module" ,
216
- " javafx.controls/com.sun.javafx.scene.control" to " org.jabref" ,
217
-
218
- // ControlsFX compatibility
219
- // We need to restate the ControlsFX exports, because we get following error otherwise:
220
- // java.lang.IllegalAccessError:
221
- // class org.controlsfx.control.textfield.AutoCompletionBinding (in module org.controlsfx.controls)
222
- // cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base) because
223
- // module javafx.base does not export com.sun.javafx.event to module org.controlsfx.controls
224
- // Taken from here: https://github.com/controlsfx/controlsfx/blob/9.0.0/build.gradle#L1
225
- " javafx.graphics/com.sun.javafx.scene" to " org.controlsfx.controls" ,
226
- " javafx.graphics/com.sun.javafx.scene.traversal" to " org.controlsfx.controls" ,
227
- " javafx.graphics/com.sun.javafx.css" to " org.controlsfx.controls" ,
228
- " javafx.controls/com.sun.javafx.scene.control" to " org.controlsfx.controls" ,
229
- " javafx.controls/com.sun.javafx.scene.control.behavior" to " org.controlsfx.controls" ,
230
- " javafx.controls/com.sun.javafx.scene.control.inputmap" to " org.controlsfx.controls" ,
231
- " javafx.base/com.sun.javafx.event" to " org.controlsfx.controls" ,
232
- " javafx.base/com.sun.javafx.collections" to " org.controlsfx.controls" ,
233
- " javafx.base/com.sun.javafx.runtime" to " org.controlsfx.controls" ,
234
- " javafx.web/com.sun.webkit" to " org.controlsfx.controls"
235
- )
236
- )
237
-
238
- addOpens.putAll(
239
- mapOf (
240
- " javafx.controls/javafx.scene.control" to " org.jabref" ,
241
- " javafx.controls/com.sun.javafx.scene.control" to " org.jabref" ,
242
- " org.controlsfx.controls/impl.org.controlsfx.skin" to " org.jabref" ,
243
- " org.controlsfx.controls/org.controlsfx.control.textfield" to " org.jabref" ,
244
- " javafx.controls/javafx.scene.control.skin" to " org.controlsfx.controls" ,
245
- " javafx.graphics/javafx.scene" to " org.controlsfx.controls" ,
246
- " javafx.base/javafx.collections" to " org.jabref" ,
247
- " javafx.base/javafx.collections.transformation" to " org.jabref"
248
- )
249
- )
250
-
251
- addModules.add(" jdk.incubator.vector" )
252
-
253
- createCommandLineArgumentFile = true
254
- }
255
- }
256
-
257
- tasks.compileJava {
258
- extensions.configure<CompileModuleOptions > {
259
- addExports.putAll(
260
- mapOf (
261
- // TODO: Remove access to internal api
262
- " javafx.controls/com.sun.javafx.scene.control" to " org.jabref" ,
263
- " org.controlsfx.controls/impl.org.controlsfx.skin" to " org.jabref"
203
+ application.applicationDefaultJvmArgs =
204
+ listOf (
205
+ " --enable-native-access=ai.djl.tokenizers,ai.djl.pytorch_engine,com.sun.jna,javafx.graphics,javafx.media,javafx.web,org.apache.lucene.core"
264
206
)
265
- )
266
207
}
267
208
}
268
209
@@ -290,7 +231,8 @@ jlink {
290
231
" zip-6" ,
291
232
" --no-header-files" ,
292
233
" --no-man-pages" ,
293
- " --bind-services"
234
+ " --bind-services" ,
235
+ " --add-modules" , " jdk.incubator.vector"
294
236
)
295
237
296
238
launcher {
@@ -493,3 +435,18 @@ if (OperatingSystem.current().isWindows) {
493
435
}
494
436
}
495
437
}
438
+
439
+ javaModuleTesting.whitebox(testing.suites[" test" ]) {
440
+ requires.add(" org.junit.jupiter.api" )
441
+ requires.add(" org.junit.jupiter.params" )
442
+ requires.add(" org.mockito" )
443
+ requires.add(" org.jabref.testsupport" )
444
+ }
445
+
446
+ tasks.test {
447
+ jvmArgs = listOf (
448
+ " --add-opens" , " javafx.graphics/com.sun.javafx.application=org.testfx" ,
449
+ " --add-reads" , " org.mockito=java.prefs" ,
450
+ " --add-reads" , " org.mockito=javafx.scene" ,
451
+ )
452
+ }
0 commit comments