diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 2b6f5d2aa26..8cf18eb10a3 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -27,7 +27,7 @@ runs: env: GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true - name: Setup TestLens - uses: testlens-app/setup-testlens@v1.6.1 + uses: testlens-app/setup-testlens@v1.7.0 - name: Generate JBang cache key id: cache-key shell: bash diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index c0e16afd7d2..5340680e13b 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -55,6 +55,19 @@ jobs: - name: Run checkstyle using gradle run: gradle checkstyleMain checkstyleTest checkstyleJmh + dependencyscopes: + name: Dependency Scopes + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v6 + with: + submodules: 'true' + show-progress: 'false' + - uses: ./.github/actions/setup-gradle + - name: Run checkAllModuleInfo using gradle + run: gradle checkAllModuleInfo + openrewrite: name: OpenRewrite runs-on: ubuntu-slim diff --git a/build-logic/src/main/kotlin/JDKjsobjectDependencyMetadataRule.kt b/build-logic/src/main/kotlin/JDKjsobjectDependencyMetadataRule.kt new file mode 100644 index 00000000000..037d8703271 --- /dev/null +++ b/build-logic/src/main/kotlin/JDKjsobjectDependencyMetadataRule.kt @@ -0,0 +1,55 @@ +import org.gradle.api.artifacts.* +import org.gradle.api.attributes.java.TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE +import org.gradle.api.model.ObjectFactory +import org.gradle.kotlin.dsl.named +import org.gradle.nativeplatform.MachineArchitecture.ARCHITECTURE_ATTRIBUTE +import org.gradle.nativeplatform.OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE +import javax.inject.Inject + +// Based on: https://github.com/gradlex-org/jvm-dependency-conflict-resolution/blob/main/src/main/java/org/gradlex/jvm/dependency/conflict/resolution/rules/AddTargetPlatformVariantsMetadataRule.java +@CacheableRule +abstract class JDKjsobjectDependencyMetadataRule @Inject constructor( + private val classifier: String, + private val operatingSystem: String, + private val architecture: String, + private val minJavaVersion: Int +) : ComponentMetadataRule { + + @get:Inject + protected abstract val objects: ObjectFactory + + override fun execute(context: ComponentMetadataContext) { + val details = context.details + addTargetPlatformVariant(details, "Compile", "compile") + addTargetPlatformVariant(details, "Runtime", "runtime") + } + + private fun addTargetPlatformVariant(details: ComponentMetadataDetails, nameSuffix: String, baseVariant: String) { + val name = details.id.name + val version = details.id.version + + details.addVariant(classifier + nameSuffix + minJavaVersion, baseVariant) { + configureAttributes() + withFiles { + removeAllFiles() + addFile("$name-$version-$classifier.jar") + } + // depending on the JDK version, 'jsobject' is pulled in as extra dependency or not + withDependencies { + if (minJavaVersion >= 26) { + add("org.openjfx:jdk-jsobject") + } else { + removeIf { it.name == "jdk-jsobject" } + } + } + } + } + + private fun VariantMetadata.configureAttributes() { + attributes { + attributes.attribute(OPERATING_SYSTEM_ATTRIBUTE, objects.named(operatingSystem)) + attributes.attribute(ARCHITECTURE_ATTRIBUTE, objects.named(architecture)) + attributes.attribute(TARGET_JVM_VERSION_ATTRIBUTE, minJavaVersion) + } + } +} diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts index 5e0ac023420..44a61fcd256 100644 --- a/build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts +++ b/build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts @@ -1,15 +1,13 @@ +import org.gradlex.javamodule.dependencies.tasks.ModuleDirectivesOrderingCheck + plugins { id("org.gradlex.extra-java-module-info") id("org.gradlex.jvm-dependency-conflict-resolution") - id("org.gradlex.java-module-dependencies") // only for mappings at the moment + id("org.gradlex.java-module-dependencies") } -javaModuleDependencies { - // TODO remove to translate 'requires' from 'module-info.java' to Gradle dependencies - // and remove 'dependencies {}' block from build.gradle files - analyseOnly = true - moduleNameToGA.put("jul.to.slf4j", "org.slf4j:jul-to-slf4j") -} +// module-info entry order not checked +tasks.withType { enabled = false } jvmDependencyConflicts { consistentResolution { @@ -29,17 +27,33 @@ jvmDependencyConflicts { // Tell gradle which jar to use for which platform // Source: https://github.com/jjohannes/java-module-system/blob/be19f6c088dca511b6d9a7487dacf0b715dbadc1/gradle/plugins/src/main/kotlin/metadata-patch.gradle.kts#L14-L22 -jvmDependencyConflicts.patch { - listOf("javafx-base", "javafx-controls", "javafx-fxml", "javafx-graphics", "javafx-swing", "javafx-web", "javafx-media", "jdk-jsobject").forEach { jfxModule -> - module("org.openjfx:$jfxModule") { - addTargetPlatformVariant("", "none", "none") // matches the empty Jars: to get better errors - addTargetPlatformVariant("linux", OperatingSystemFamily.LINUX, MachineArchitecture.X86_64) - addTargetPlatformVariant("linux-aarch64", OperatingSystemFamily.LINUX, MachineArchitecture.ARM64) - addTargetPlatformVariant("mac", OperatingSystemFamily.MACOS, MachineArchitecture.X86_64) - addTargetPlatformVariant("mac-aarch64", OperatingSystemFamily.MACOS, MachineArchitecture.ARM64) - addTargetPlatformVariant("win", OperatingSystemFamily.WINDOWS, MachineArchitecture.X86_64) +listOf("javafx-base", "javafx-controls", "javafx-fxml", "javafx-graphics", "javafx-swing", "javafx-web", "javafx-media", "jdk-jsobject").forEach { jfxModule -> + addJfxTarget(jfxModule, "", "none", "none") // matches the empty Jars: to get better errors + addJfxTarget(jfxModule, "linux", OperatingSystemFamily.LINUX, MachineArchitecture.X86_64) + addJfxTarget(jfxModule, "linux-aarch64", OperatingSystemFamily.LINUX, MachineArchitecture.ARM64) + addJfxTarget(jfxModule, "mac", OperatingSystemFamily.MACOS, MachineArchitecture.X86_64) + addJfxTarget(jfxModule, "mac-aarch64", OperatingSystemFamily.MACOS, MachineArchitecture.ARM64) + addJfxTarget(jfxModule, "win", OperatingSystemFamily.WINDOWS, MachineArchitecture.X86_64) +} + +fun addJfxTarget(jfxModule: String, name: String, os: String, arch: String) { + if (jfxModule == "javafx-web" && name.isNotEmpty()) { + // Special treatment of 'javafx-web' for the time being due to https://bugs.openjdk.org/browse/JDK-8342623. + // Can be remove once Java 26 is the minimum version JabRef is built with. + dependencies.components.withModule("org.openjfx:$jfxModule") { + params(name, os, arch, 11) + } + dependencies.components.withModule("org.openjfx:$jfxModule") { + params(name, os, arch, 26) + } + } else { + jvmDependencyConflicts.patch.module("org.openjfx:$jfxModule") { + addTargetPlatformVariant(name, os, arch) } } +} + +jvmDependencyConflicts.patch { // Source: https://github.com/jjohannes/java-module-system/blob/be19f6c088dca511b6d9a7487dacf0b715dbadc1/gradle/plugins/src/main/kotlin/metadata-patch.gradle.kts#L9 module("com.google.guava:guava") { removeDependency("com.google.code.findbugs:jsr305") @@ -79,6 +93,18 @@ jvmDependencyConflicts.patch { module("org.xmlunit:xmlunit-legacy") { removeDependency("junit:junit") } + module("dev.langchain4j:langchain4j-core") { + addRuntimeOnlyDependency("com.knuddels:jtokkit") + } + module("org.jabref:afterburner.fx") { + // metadata decared these as runtime only, but they are 'requires transitive' in module-info + addApiDependency("org.openjfx:javafx-fxml") + addApiDependency("org.openjfx:javafx-controls") + } + module("org.libreoffice:libreoffice") { + // no dependency in metadata, but 'requires org.libreoffice.unoloader' in module-info + addRuntimeOnlyDependency("org.libreoffice:unoloader") + } } extraJavaModuleInfo { @@ -201,18 +227,17 @@ extraJavaModuleInfo { module("dev.langchain4j:langchain4j", "langchain4j") module("dev.langchain4j:langchain4j-core", "langchain4j.core") { // workaround for https://github.com/langchain4j/langchain4j/issues/3668 + patchRealModule() mergeJar("dev.langchain4j:langchain4j-http-client") mergeJar("dev.langchain4j:langchain4j-http-client-jdk") mergeJar("dev.langchain4j:langchain4j-hugging-face") mergeJar("dev.langchain4j:langchain4j-mistral-ai") mergeJar("dev.langchain4j:langchain4j-open-ai") mergeJar("dev.langchain4j:langchain4j-google-ai-gemini") - requires("jtokkit") requires("java.net.http") uses("dev.langchain4j.http.client.HttpClientBuilderFactory") exportAllPackages() requireAllDefinedDependencies() - patchRealModule() } module("dev.langchain4j:langchain4j-google-ai-gemini", "langchain4j.google.ai.gemini") module("dev.langchain4j:langchain4j-http-client", "langchain4j.http.client") @@ -222,15 +247,6 @@ extraJavaModuleInfo { module("dev.langchain4j:langchain4j-open-ai", "langchain4j.open.ai") module("eu.lestard:doc-annotations", "doc.annotations") module("info.debatty:java-string-similarity", "java.string.similarity") - module("io.github.darvil82:terminal-text-formatter", "io.github.darvil.terminal.textformatter") { - patchRealModule() - exportAllPackages() - requires("io.github.darvil.utils") - } - module("io.github.darvil82:utils", "io.github.darvil.utils") { - patchRealModule() - exportAllPackages() - } module("io.github.java-diff-utils:java-diff-utils", "io.github.javadiffutils") module("io.zonky.test.postgres:embedded-postgres-binaries-darwin-amd64", "embedded.postgres.binaries.darwin.amd64") module("io.zonky.test.postgres:embedded-postgres-binaries-darwin-arm64v8", "embedded.postgres.binaries.darwin.arm64v8") @@ -240,6 +256,8 @@ extraJavaModuleInfo { module("io.zonky.test.postgres:embedded-postgres-binaries-windows-amd64", "embedded.postgres.binaries.windows.amd64") module("net.harawata:appdirs", "net.harawata.appdirs") module("net.java.dev.jna:jna", "com.sun.jna") { + // Required as sometimes the non-jpms version if picked which should ideally be fixed differently + // More details: https://github.com/gradlex-org/jvm-dependency-conflict-resolution/issues/346 patchRealModule() exportAllPackages() requires("java.logging") @@ -272,14 +290,11 @@ extraJavaModuleInfo { requires("javafx.graphics") } module("org.javassist:javassist", "org.javassist") - module("org.jbibtex:jbibtex", "jbibtex") { - exportAllPackages() - } + module("org.jbibtex:jbibtex", "jbibtex") module("org.scala-lang:scala-library", "scala.library") module("pt.davidafsilva.apple:jkeychain", "jkeychain") module("org.testfx:testfx-core", "org.testfx") { - patchRealModule() exportAllPackages() // Content based on https://github.com/TestFX/TestFX/commit/bf4a08aa82c008fdd3c296aaafee1d222f3824cb requires("java.desktop") @@ -287,13 +302,11 @@ extraJavaModuleInfo { requiresTransitive("org.hamcrest") } module("org.testfx:testfx-junit5", "org.testfx.junit5") { - patchRealModule() exportAllPackages() requires("org.junit.jupiter.api") requiresTransitive("org.testfx") } - module("org.xmlunit:xmlunit-core", "org.xmlunit") { exportAllPackages() requires("java.xml") @@ -322,56 +335,24 @@ extraJavaModuleInfo { requireAllDefinedDependencies() requires("com.google.gson") } - module("org.eclipse.lsp4j:org.eclipse.lsp4j.debug", "org.eclipse.lsp4j.debug") { - exportAllPackages() - } - module("org.eclipse.lsp4j:org.eclipse.lsp4j.generator", "org.eclipse.lsp4j.generator") { - exportAllPackages() - } + module("org.eclipse.lsp4j:org.eclipse.lsp4j.debug", "org.eclipse.lsp4j.debug") + module("org.eclipse.lsp4j:org.eclipse.lsp4j.generator", "org.eclipse.lsp4j.generator") module("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc", "org.eclipse.lsp4j.jsonrpc") { exportAllPackages() requires("com.google.gson") requires("java.logging") } - module("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc.debug", "org.eclipse.lsp4j.jsonrpc.debug") { - exportAllPackages() - } - module("org.eclipse.lsp4j:org.eclipse.lsp4j.websocket.jakarta", "org.eclipse.lsp4j.websocket.jakarta") { - exportAllPackages() - requireAllDefinedDependencies() - } - module("jakarta.websocket:jakarta.websocket-api", "jakarta.websocket") { - overrideModuleName() - exportAllPackages() - } - module("org.eclipse.xtend:org.eclipse.xtend", "xtend") { - exportAllPackages() - } - module("org.eclipse.xtend:org.eclipse.xtend.lib", "xtend.lib") { - overrideModuleName() - exportAllPackages() - } - module("org.eclipse.xtend:org.eclipse.xtend.lib.macro", "xtend.lib.macro") { - overrideModuleName() - exportAllPackages() - } - module("org.eclipse.xtext:org.eclipse.xtext.xbase.lib", "xtext.xbase.lib") { - overrideModuleName() - exportAllPackages() - } - - module("com.tngtech.archunit:archunit-junit5-api", "com.tngtech.archunit.junit5.api") { - exportAllPackages() - requireAllDefinedDependencies() - } - module("com.tngtech.archunit:archunit-junit5-engine", "com.tngtech.archunit.junit5.engine") { - exportAllPackages() - requireAllDefinedDependencies() - } - module("com.tngtech.archunit:archunit-junit5-engine-api", "com.tngtech.archunit.junit5.engineapi") { - exportAllPackages() - requireAllDefinedDependencies() - } + module("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc.debug", "org.eclipse.lsp4j.jsonrpc.debug") + module("org.eclipse.lsp4j:org.eclipse.lsp4j.websocket.jakarta", "org.eclipse.lsp4j.websocket.jakarta") + module("jakarta.websocket:jakarta.websocket-api", "jakarta.websocket") + module("org.eclipse.xtend:org.eclipse.xtend", "xtend") + module("org.eclipse.xtend:org.eclipse.xtend.lib", "xtend.lib") + module("org.eclipse.xtend:org.eclipse.xtend.lib.macro", "xtend.lib.macro") + module("org.eclipse.xtext:org.eclipse.xtext.xbase.lib", "xtext.xbase.lib") + + module("com.tngtech.archunit:archunit-junit5-api", "com.tngtech.archunit.junit5.api") + module("com.tngtech.archunit:archunit-junit5-engine", "com.tngtech.archunit.junit5.engine") + module("com.tngtech.archunit:archunit-junit5-engine-api", "com.tngtech.archunit.junit5.engineapi") module("com.tngtech.archunit:archunit", "com.tngtech.archunit") { exportAllPackages() requireAllDefinedDependencies() @@ -472,75 +453,45 @@ extraJavaModuleInfo { } module("org.openjfx:javafx-base", "javafx.base") { - patchRealModule() - // jabgui requires at least "javafx.collections" - exportAllPackages() + preserveExisting() + exports("javafx.collections") + opens("com.sun.javafx.beans", "net.bytebuddy") } - // required for testing of jablib + // open packages for testing of jablib module("org.openjfx:javafx-fxml", "javafx.fxml") { - patchRealModule() - exportAllPackages() - - requiresTransitive("javafx.graphics") - requiresTransitive("java.desktop") + preserveExisting() + opens("javafx.fxml", "org.jabref.jablib"); } // Required for fxml loading (for localization test) module("org.openjfx:javafx-graphics", "javafx.graphics") { - patchRealModule() - exportAllPackages() // required for testfx - - requiresTransitive("javafx.base") - requiresTransitive("java.desktop") - requiresTransitive("jdk.unsupported") + preserveExisting() + exports("com.sun.javafx.scene") + opens("com.sun.javafx.application", "org.testfx") + opens("javafx.stage", "com.pixelduke.fxthemes") + opens("com.sun.javafx.tk.quantum", "com.pixelduke.fxthemes") } module("org.controlsfx:controlsfx", "org.controlsfx.controls") { - patchRealModule() - + preserveExisting() exports("impl.org.controlsfx.skin") - exports("org.controlsfx.control") - exports("org.controlsfx.control.action") - exports("org.controlsfx.control.decoration") - exports("org.controlsfx.control.table") - exports("org.controlsfx.control.textfield") - exports("org.controlsfx.dialog") - exports("org.controlsfx.validation") - exports("org.controlsfx.validation.decoration") - - requires("javafx.controls") - requiresTransitive("javafx.graphics") + requires("javafx.graphics") } module("org.openjfx:javafx-controls", "javafx.controls") { - patchRealModule() - - requiresTransitive("javafx.base"); - requiresTransitive("javafx.graphics"); - - exports("javafx.scene.chart") - exports("javafx.scene.control") - exports("javafx.scene.control.cell") - exports("javafx.scene.control.skin") - - // PATCH REASON: + preserveExisting() exports("com.sun.javafx.scene.control") } - module("org.hamcrest:hamcrest", "org.hamcrest") { - exportAllPackages() - } + module("org.hamcrest:hamcrest", "org.hamcrest") module("org.mockito:mockito-core", "org.mockito") { preserveExisting() requires("java.prefs") } - module("org.objenesis:objenesis", "org.objenesis") { - exportAllPackages() - requireAllDefinedDependencies() - } + module("org.objenesis:objenesis", "org.objenesis") module("com.jayway.jsonpath:json-path", "json.path") { exportAllPackages() requireAllDefinedDependencies() @@ -548,9 +499,6 @@ extraJavaModuleInfo { } module("net.minidev:json-smart", "json.smart") module("net.minidev:accessors-smart", "accessors.smart") - module("org.ow2.asm:asm", "org.objectweb.asm") { - preserveExisting() - } module("org.openjdk.jmh:jmh-core", "jmh.core") module("org.openjdk.jmh:jmh-generator-asm", "jmh.generator.asm") diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts index 6dff73d19d4..6b0e7035747 100644 --- a/build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts +++ b/build-logic/src/main/kotlin/org.jabref.gradle.base.targets.gradle.kts @@ -1,12 +1,14 @@ plugins { + id("org.jabref.gradle.base.dependency-rules") id("org.gradlex.java-module-packaging") } -val javaExt = extensions.getByType() -val toolchains = extensions.getByType() -val isIbm = toolchains.launcherFor(javaExt.toolchain) +val jdkVersion = java.toolchain.languageVersion.map { it.asInt() } +val isIbm = javaToolchains.launcherFor(java.toolchain) .map { it.metadata.vendor.contains("IBM", ignoreCase = true) } +val mainRuntimeClasspath = configurations["mainRuntimeClasspath"] + // Source: https://github.com/jjohannes/java-module-system/blob/main/gradle/plugins/src/main/kotlin/targets.gradle.kts // Configure variants for OS. Target name can be any string, but should match the name used in GitHub actions. javaModulePackaging { @@ -30,27 +32,47 @@ javaModulePackaging { operatingSystem = OperatingSystemFamily.LINUX architecture = MachineArchitecture.X86_64 packageTypes = listOf("app-image", "deb", "rpm") + configurations.named("${name}RuntimeClasspath") { + shouldResolveConsistentlyWith(mainRuntimeClasspath) + attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jdkVersion) + } } target("ubuntu-22.04-arm") { operatingSystem = OperatingSystemFamily.LINUX architecture = MachineArchitecture.ARM64 packageTypes = listOf("app-image", "deb", "rpm") + configurations.named("${name}RuntimeClasspath") { + shouldResolveConsistentlyWith(mainRuntimeClasspath) + attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jdkVersion) + } } target("macos-15-intel") { operatingSystem = OperatingSystemFamily.MACOS architecture = MachineArchitecture.X86_64 packageTypes = listOf("app-image", "dmg", "pkg") singleStepPackaging = true + configurations.named("${name}RuntimeClasspath") { + shouldResolveConsistentlyWith(mainRuntimeClasspath) + attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jdkVersion) + } } target("macos-15") { operatingSystem = OperatingSystemFamily.MACOS architecture = MachineArchitecture.ARM64 packageTypes = listOf("app-image", "dmg", "pkg") singleStepPackaging = true + configurations.named("${name}RuntimeClasspath") { + shouldResolveConsistentlyWith(mainRuntimeClasspath) + attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jdkVersion) + } } target("windows-latest") { operatingSystem = OperatingSystemFamily.WINDOWS architecture = MachineArchitecture.X86_64 packageTypes = listOf("app-image", "msi") + configurations.named("${name}RuntimeClasspath") { + shouldResolveConsistentlyWith(mainRuntimeClasspath) + attributes.attributeProvider(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, jdkVersion) + } } } diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.check.checkstyle.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.check.checkstyle.gradle.kts index 9f0d53b9164..138f93f32b2 100644 --- a/build-logic/src/main/kotlin/org.jabref.gradle.check.checkstyle.gradle.kts +++ b/build-logic/src/main/kotlin/org.jabref.gradle.check.checkstyle.gradle.kts @@ -9,8 +9,8 @@ checkstyle { tasks.withType().configureEach { reports { - xml.required.set(false) - html.required.set(true) + xml.required = false + html.required = true } source = fileTree("src") { include("**/*.java") } } diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.check.dependencies.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.check.dependencies.gradle.kts new file mode 100644 index 00000000000..0843ac84d58 --- /dev/null +++ b/build-logic/src/main/kotlin/org.jabref.gradle.check.dependencies.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("com.autonomousapps.dependency-analysis") +} diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.feature.test.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.feature.test.gradle.kts index 3a5caf23be5..a9a0510dc21 100644 --- a/build-logic/src/main/kotlin/org.jabref.gradle.feature.test.gradle.kts +++ b/build-logic/src/main/kotlin/org.jabref.gradle.feature.test.gradle.kts @@ -10,6 +10,20 @@ testing { suites.named("test") { useJUnitJupiter() } + + @Suppress("UnstableApiUsage") + suites.withType { + // Replace the 'catch-all' junit-jupiter dependency added by Gradle with a dependency to the engine only. + // This is, because all compile-time dependencies are defined explicitly in the modules, including + // 'org.junit.jupiter.api'. Unfortunately, there is no simple off switch. + // https://github.com/gradle/gradle/issues/21299#issuecomment-1316438289 + configurations.getByName(sources.implementationConfigurationName) { + withDependencies { + removeIf { it.group == "org.junit.jupiter" && it.name == "junit-jupiter" } + } + } + dependencies { runtimeOnly("org.junit.jupiter:junit-jupiter-engine") } + } } tasks.withType().configureEach { @@ -41,3 +55,9 @@ testlogger { configurations.testCompileOnly { extendsFrom(configurations.compileOnly.get()) } + +// See https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3 +val mockitoAgent = configurations.create("mockitoAgent") +dependencies { + mockitoAgent("org.mockito:mockito-core:5.21.0") { isTransitive = false } +} diff --git a/build-logic/src/main/kotlin/org.jabref.gradle.module.gradle.kts b/build-logic/src/main/kotlin/org.jabref.gradle.module.gradle.kts index 82e6baf0f5a..7033ce03a92 100644 --- a/build-logic/src/main/kotlin/org.jabref.gradle.module.gradle.kts +++ b/build-logic/src/main/kotlin/org.jabref.gradle.module.gradle.kts @@ -5,6 +5,7 @@ plugins { id("org.jabref.gradle.base.repositories") id("org.jabref.gradle.base.targets") id("org.jabref.gradle.check.checkstyle") + id("org.jabref.gradle.check.dependencies") id("org.jabref.gradle.check.modernizer") id("org.jabref.gradle.feature.compile") id("org.jabref.gradle.feature.javadoc") diff --git a/gradle/modules.properties b/gradle/modules.properties new file mode 100644 index 00000000000..5f180f89f63 --- /dev/null +++ b/gradle/modules.properties @@ -0,0 +1,19 @@ +# All entries where the Module Name is also found like here on Maven Central can be contributed upstream +# https://github.com/gradlex-org/java-module-dependencies?tab=readme-ov-file#add-module-name-mapping-information-if-needed +afterburner.fx=org.jabref:afterburner.fx +com.dd.plist=com.googlecode.plist:dd-plist +com.tobiasdiez.easybind=org.jabref:easybind +cuid=io.github.thibaultmeyer:cuid +info.picocli.codegen=info.picocli:picocli-codegen +io.github.darvil.terminal.textformatter=io.github.darvil82:terminal-text-formatter +io.github.eadr=io.github.adr:e-adr +jul.to.slf4j=org.slf4j:jul-to-slf4j +mslinks=com.github.vatbub:mslinks +org.apache.logging.log4j.to.slf4j=org.apache.logging.log4j:log4j-to-slf4j +org.glassfish.jersey.container.grizzly2.http=org.glassfish.jersey.containers:jersey-container-grizzly2-http +org.glassfish.jersey.core.common=org.glassfish.jersey.core:jersey-common +org.glassfish.jersey.core.server=org.glassfish.jersey.core:jersey-server +org.glassfish.jersey.inject.hk2=org.glassfish.jersey.inject:jersey-hk2 +org.glassfish.jersey.tests.framework.core=org.glassfish.jersey.test-framework:jersey-test-framework-core +org.glassfish.jersey.tests.framework.provider.grizzly=org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2 +tools.jackson.databind=tools.jackson.core:jackson-databind diff --git a/jabgui/build.gradle.kts b/jabgui/build.gradle.kts index fa9b8d99d72..8efb43743c4 100644 --- a/jabgui/build.gradle.kts +++ b/jabgui/build.gradle.kts @@ -1,6 +1,3 @@ -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.jvm.toolchain.JavaToolchainService - plugins { id("org.jabref.gradle.module") id("org.jabref.gradle.feature.shadowjar") @@ -16,134 +13,26 @@ version = providers.gradleProperty("projVersion") .orElse("100.0.0") .get() -// See https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3 -val mockitoAgent = configurations.create("mockitoAgent") - -// See https://bugs.openjdk.org/browse/JDK-8342623 -val target = java.toolchain.languageVersion.get().asInt() -if (target >= 26) { - dependencies { - implementation("org.openjfx:jdk-jsobject") - } -} else { - configurations.all { - exclude(group = "org.openjfx", module = "jdk-jsobject") - } -} - -dependencies { - implementation(project(":jablib")) - // Following already provided by jablib - // implementation("org.openjfx:javafx-base") - // implementation("org.openjfx:javafx-controls") - // implementation("org.openjfx:javafx-fxml") - // implementation("org.openjfx:javafx-graphics") - - implementation(project(":jabls")) - implementation(project(":jabsrv")) - - implementation("org.openjfx:javafx-swing") - implementation("org.openjfx:javafx-web") - - implementation("com.pixelduke:fxthemes") - - implementation("org.slf4j:slf4j-api") - implementation("org.tinylog:tinylog-api") - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - - implementation("org.jabref:afterburner.fx") - implementation("org.kordamp.ikonli:ikonli-javafx") - implementation("org.kordamp.ikonli:ikonli-materialdesign2-pack") - implementation("com.github.sialcasa.mvvmFX:mvvmfx-validation") //jitpack - implementation("de.saxsys:mvvmfx") - implementation("org.fxmisc.flowless:flowless") - implementation("org.fxmisc.richtext:richtextfx") - implementation("com.dlsc.gemsfx:gemsfx") - implementation("com.dlsc.pdfviewfx:pdfviewfx") - - // Required by gemsfx - implementation("tech.units:indriya") - // Required by gemsfx and langchain4j - implementation ("com.squareup.retrofit2:retrofit") - - implementation("org.controlsfx:controlsfx") - implementation("org.jabref:easybind") - - implementation("org.apache.lucene:lucene-core") - implementation("org.apache.lucene:lucene-queryparser") - implementation("org.apache.lucene:lucene-queries") - implementation("org.apache.lucene:lucene-analysis-common") - implementation("org.apache.lucene:lucene-highlighter") - - implementation("org.jsoup:jsoup") - - // Because of GraalVM quirks, we need to ship that. See https://github.com/jspecify/jspecify/issues/389#issuecomment-1661130973 for details - implementation("org.jspecify:jspecify") - - implementation("com.google.guava:guava") - - implementation("dev.langchain4j:langchain4j") - - implementation("io.github.java-diff-utils:java-diff-utils") - - implementation("org.jooq:jool") - - implementation("commons-io:commons-io") +testModuleInfo { + requires("org.jabref.testsupport") - implementation ("org.apache.pdfbox:pdfbox") + requires("com.github.javaparser.core") + requires("org.junit.jupiter.api") + requires("org.junit.jupiter.params") + requires("org.mockito") + requires("org.hamcrest") - implementation("net.java.dev.jna:jna-jpms") - implementation("net.java.dev.jna:jna-platform") + requires("org.testfx") + requires("org.testfx.junit5") - implementation("org.eclipse.jgit:org.eclipse.jgit") - - implementation("com.konghq:unirest-java-core") - - implementation("org.apache.httpcomponents.client5:httpclient5") - - implementation("com.vladsch.flexmark:flexmark-html2md-converter") - - implementation("io.github.adr:e-adr") - - implementation("org.libreoffice:unoloader") - implementation("org.libreoffice:libreoffice") - - implementation("com.github.javakeyring:java-keyring") - - implementation("info.picocli:picocli") - annotationProcessor("info.picocli:picocli-codegen") - - implementation("de.undercouch:citeproc-java") - - testImplementation(project(":test-support")) - - testImplementation("io.github.classgraph:classgraph") - testImplementation("org.testfx:testfx-core") - testImplementation("org.testfx:testfx-junit5") - - testImplementation("org.mockito:mockito-core") - mockitoAgent("org.mockito:mockito-core:5.18.0") { isTransitive = false } - testImplementation("net.bytebuddy:byte-buddy") - - testImplementation("org.hamcrest:hamcrest") - - testImplementation("com.github.javaparser:javaparser-symbol-solver-core") - testImplementation("org.ow2.asm:asm") - - testImplementation("com.tngtech.archunit:archunit") - testImplementation("com.tngtech.archunit:archunit-junit5-api") - testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine") + requires("com.tngtech.archunit") + requires("com.tngtech.archunit.junit5.api") + runtimeOnly("com.tngtech.archunit.junit5.engine") } application { - mainClass.set("org.jabref.Launcher") - mainModule.set("org.jabref") + mainClass= "org.jabref.Launcher" applicationDefaultJvmArgs = listOf( "--add-modules", "jdk.incubator.vector", @@ -196,7 +85,6 @@ javaModulePackaging { include("JabRefHost.ps1") }) } - targetsWithOs("linux") { options.addAll( "--linux-menu-group", "Office;", @@ -231,27 +119,9 @@ javaModulePackaging { } } -javaModuleTesting.whitebox(testing.suites["test"]) { - requires.add("org.jabref.testsupport") - - // Not sure why there is no dependency for jabgui normal running for this dependency - // requires.add("javafx.graphics") - - requires.add("com.github.javaparser.core") - requires.add("org.junit.jupiter.api") - requires.add("org.junit.jupiter.params") - requires.add("org.mockito") - - requires.add("org.testfx") - requires.add("org.testfx.junit5") - - requires.add("com.tngtech.archunit") - requires.add("com.tngtech.archunit.junit5.api") -} - tasks.test { jvmArgs = listOf( - "-javaagent:${mockitoAgent.asPath}", + "-javaagent:${configurations.mockitoAgent.get().asPath}", // Source: https://github.com/TestFX/TestFX/issues/638#issuecomment-433744765 "--add-opens", "javafx.graphics/com.sun.javafx.application=org.testfx", diff --git a/jabgui/src/main/java/module-info.java b/jabgui/src/main/java/module-info.java index a46f19f04de..18f22996ca1 100644 --- a/jabgui/src/main/java/module-info.java +++ b/jabgui/src/main/java/module-info.java @@ -52,9 +52,9 @@ // region: Logging requires org.slf4j; requires jul.to.slf4j; - requires org.apache.logging.log4j.to.slf4j; + requires /*runtime*/ org.apache.logging.log4j.to.slf4j; requires org.tinylog.api; - requires org.tinylog.api.slf4j; + requires /*runtime*/ org.tinylog.api.slf4j; requires org.tinylog.impl; // endregion @@ -80,6 +80,7 @@ // region: data mapping requires jdk.xml.dom; // requires com.google.gson; + requires tools.jackson.core; requires tools.jackson.databind; // endregion @@ -123,14 +124,15 @@ // requires snuggletex.core; - requires org.apache.pdfbox; // requires org.apache.xmpbox; // requires com.ibm.icu; requires flexmark; requires flexmark.html2md.converter; requires flexmark.util.ast; + requires flexmark.util.collection; requires flexmark.util.data; + requires flexmark.util.sequence; // requires com.h2database.mvstore; @@ -161,11 +163,11 @@ /* * In case the version is updated, please also increment {@link org.jabref.model.search.LinkedFilesConstants.VERSION} to trigger reindexing. */ - uses org.apache.lucene.codecs.lucene103.Lucene103Codec; - requires org.apache.lucene.analysis.common; - requires org.apache.lucene.core; - requires org.apache.lucene.highlighter; - requires org.apache.lucene.queryparser; + // uses org.apache.lucene.codecs.lucene103.Lucene103Codec; + // requires org.apache.lucene.analysis.common; + // requires org.apache.lucene.core; + // requires org.apache.lucene.highlighter; + // requires org.apache.lucene.queryparser; // endregion // requires net.harawata.appdirs; @@ -184,7 +186,7 @@ requires com.pixelduke.fxthemes; // requires com.sun.jna; // requires dd.plist; - requires io.github.eadr; + requires static io.github.eadr; // required by okhttp and some AI library // requires kotlin.stdlib; // requires mslinks; diff --git a/jabkit/build.gradle.kts b/jabkit/build.gradle.kts index 0ea5a54713b..f2219a0d323 100644 --- a/jabkit/build.gradle.kts +++ b/jabkit/build.gradle.kts @@ -1,6 +1,3 @@ -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.jvm.toolchain.JavaToolchainService - plugins { id("org.jabref.gradle.module") id("org.jabref.gradle.feature.shadowjar") @@ -13,71 +10,12 @@ version = providers.gradleProperty("projVersion") .orElse("100.0.0") .get() -// See https://bugs.openjdk.org/browse/JDK-8342623 -val target = java.toolchain.languageVersion.get().asInt() -if (target >= 26) { - dependencies { - implementation("org.openjfx:jdk-jsobject") - } -} else { - configurations.all { - exclude(group = "org.openjfx", module = "jdk-jsobject") - } -} - -dependencies { - implementation(project(":jablib")) - - // FIXME: Injector needs to be removed, no JavaFX dependencies, etc. - implementation("org.jabref:afterburner.fx") - - implementation("org.openjfx:javafx-base") - implementation("org.openjfx:javafx-controls") - implementation("org.openjfx:javafx-fxml") - // implementation("org.openjfx:javafx-graphics:$javafxVersion") - - implementation("info.picocli:picocli") - annotationProcessor("info.picocli:picocli-codegen") - - implementation("com.github.ben-manes.caffeine:caffeine") - // Because of GraalVM quirks, we need to ship that. See https://github.com/jspecify/jspecify/issues/389#issuecomment-1661130973 for details - implementation("org.jspecify:jspecify") - - implementation("org.slf4j:slf4j-api") - // implementation("org.tinylog:tinylog-api") - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - - implementation("com.google.guava:guava") - - implementation("org.slf4j:slf4j-api") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog in the CLI and GUI) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - - implementation("org.jabref:afterburner.fx") - - implementation("org.apache.lucene:lucene-queryparser") - - implementation("io.github.adr:e-adr") - - implementation("io.github.darvil82:terminal-text-formatter") - - testImplementation(project(":test-support")) - testImplementation("org.mockito:mockito-core") - testImplementation("net.bytebuddy:byte-buddy") -} - -javaModuleTesting.whitebox(testing.suites["test"]) { - requires.add("org.jabref.testsupport") - requires.add("org.junit.jupiter.api") - requires.add("org.junit.jupiter.params") - requires.add("org.mockito") +testModuleInfo { + requires("org.jabref.testsupport") + requires("org.junit.jupiter.api") + requires("org.junit.jupiter.params") + requires("org.mockito") + requires("com.google.common") } tasks.withType().configureEach { @@ -85,8 +23,7 @@ tasks.withType().configureEach { } application { - mainClass.set("org.jabref.toolkit.JabKitLauncher") - mainModule.set("org.jabref.jabkit") + mainClass = "org.jabref.toolkit.JabKitLauncher" // Also passed to launcher by java-module-packaging plugin applicationDefaultJvmArgs = listOf( @@ -127,14 +64,13 @@ javaModulePackaging { } } -val app = the() tasks.register("runJabKitPortableSmokeTest") { group = "test" description = "Runs JabKit from test resources dir" mainClass = "org.jabref.toolkit.JabKitLauncher" - mainModule.set("org.jabref.jabkit") + mainModule = "org.jabref.jabkit" classpath = sourceSets.main.get().runtimeClasspath - jvmArgs(app.applicationDefaultJvmArgs) + jvmArgs(application.applicationDefaultJvmArgs) workingDir = file("src/test/resources") args("--debug", "check-consistency", "--input=empty.bib") } diff --git a/jabkit/src/main/java/module-info.java b/jabkit/src/main/java/module-info.java index 6bb0f68a9ba..e87dbf1f810 100644 --- a/jabkit/src/main/java/module-info.java +++ b/jabkit/src/main/java/module-info.java @@ -9,23 +9,19 @@ requires transitive org.jspecify; requires java.prefs; - requires com.google.common; - - requires org.apache.lucene.queryparser; - requires javafx.base; requires afterburner.fx; requires org.slf4j; requires jul.to.slf4j; - requires org.apache.logging.log4j.to.slf4j; + requires /*runtime*/ org.apache.logging.log4j.to.slf4j; requires org.tinylog.api; - requires org.tinylog.api.slf4j; - requires org.tinylog.impl; + requires /*runtime*/ org.tinylog.api.slf4j; + requires /*runtime*/ org.tinylog.impl; requires java.xml; // region: other libraries (alphabetically) - requires io.github.eadr; + requires static io.github.eadr; // endregion } diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index 6b1cdeae791..6275491daa2 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -22,6 +22,46 @@ plugins { id("net.ltgt.nullaway") version "3.0.0" } +testModuleInfo { + // loading of .fxml files in localization tests requires JabRef's GUI classes + runtimeOnly("org.jabref") + + requires("org.jabref.testsupport") + + requires("javafx.fxml") + requires("javafx.graphics") + + requires("io.github.classgraph") + + requires("java.compiler") + + requires("org.junit.jupiter.api") + requires("org.junit.jupiter.params") + requires("org.hamcrest") + requires("org.mockito") + + // Required for LocalizationConsistencyTest + requires("org.testfx.junit5") + + requires("org.xmlunit") + requires("org.xmlunit.matchers") + + requires("com.tngtech.archunit") + requires("com.tngtech.archunit.junit5.api") + runtimeOnly("com.tngtech.archunit.junit5.engine") + + // Highly recommended builder generator - https://github.com/skinny85/jilt (used for tests only) + requiresStatic("jilt") + annotationProcessor("jilt") +} + +dependencies { + antlr("org.antlr:antlr4") + + errorprone("com.google.errorprone:error_prone_core") + errorprone("com.uber.nullaway:nullaway") +} + var version = providers.gradleProperty("projVersion") .orElse(providers.environmentVariable("VERSION")) .orElse("0.1.0") @@ -31,10 +71,6 @@ if (project.findProperty("tagbuild")?.toString() != "true") { version += "-SNAPSHOT" } -configurations.antlr { - extendsFrom(configurations.internal.get()) -} - configurations { // Treat the ANTLR compiler as a separate tool that should not end up on the compile/runtime // classpath of our runtime. @@ -47,202 +83,6 @@ tasks.withType().configureEach dependsOn(tasks.withType()) } -// See https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3 -val mockitoAgent = configurations.create("mockitoAgent") - -dependencies { - // api(platform(project(":versions"))) - - implementation("org.openjfx:javafx-base") - - implementation("com.ibm.icu:icu4j") - - // Fix "error: module not found: javafx.controls" during compilation - // implementation("org.openjfx:javafx-controls:$javafxVersion") - - // We do not use [Version Catalogs](https://docs.gradle.org/current/userguide/version_catalogs.html#sec:dependency-bundles), because - // exclusions are not supported - - implementation("org.jabref:afterburner.fx") - // Required by afterburner.fx - implementation("org.openjfx:javafx-fxml") - - implementation("org.jabref:easybind") - - implementation ("org.apache.pdfbox:pdfbox") - implementation ("org.apache.pdfbox:fontbox") - implementation ("org.apache.pdfbox:xmpbox") - - implementation("org.apache.lucene:lucene-core") - implementation("org.apache.lucene:lucene-queryparser") - implementation("org.apache.lucene:lucene-queries") - implementation("org.apache.lucene:lucene-analysis-common") - implementation("org.apache.lucene:lucene-highlighter") - - implementation("org.apache.commons:commons-csv") - implementation("org.apache.commons:commons-lang3") - implementation("org.apache.commons:commons-text") - implementation("commons-logging:commons-logging") - - implementation("com.h2database:h2-mvstore") - - // required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635 - implementation("org.bouncycastle:bcprov-jdk18on") - - // region: LibreOffice - implementation("org.libreoffice:unoloader") - implementation("org.libreoffice:libreoffice") - // Required for ID generation - implementation("io.github.thibaultmeyer:cuid") - // endregion - - implementation("io.github.java-diff-utils:java-diff-utils") - implementation("info.debatty:java-string-similarity") - - implementation("com.github.javakeyring:java-keyring") - - implementation("org.eclipse.jgit:org.eclipse.jgit") - - implementation("tools.jackson.dataformat:jackson-dataformat-yaml") - implementation("tools.jackson.core:jackson-databind") - // TODO: Somwewhere we get a warning: unknown enum constant Id.CLASS reason: class file for com.fasterxml.jackson.annotation.JsonTypeInfo$Id not found - // implementation("com.fasterxml.jackson.core:jackson-annotations:2.19.1") - - implementation("com.fasterxml:aalto-xml") - - implementation("org.postgresql:postgresql") - - antlr("org.antlr:antlr4") - implementation("org.antlr:antlr4-runtime") - - implementation("com.google.guava:guava") - - implementation("jakarta.annotation:jakarta.annotation-api") - implementation("jakarta.inject:jakarta.inject-api") - - // region HTTP clients - implementation("org.jsoup:jsoup") - implementation("com.konghq:unirest-java-core") - implementation("com.konghq:unirest-modules-gson") - implementation("org.apache.httpcomponents.client5:httpclient5") - implementation("jakarta.ws.rs:jakarta.ws.rs-api") - // endregion - - implementation("org.slf4j:slf4j-api") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog in the CLI and GUI) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - - // required by org.jabref.generators (only) - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-api") - implementation("org.tinylog:tinylog-impl") - - implementation("de.undercouch:citeproc-java") - - implementation("com.vladsch.flexmark:flexmark") - implementation("com.vladsch.flexmark:flexmark-html2md-converter") - - implementation("net.harawata:appdirs") - - implementation("org.jooq:jool") - - // Because of GraalVM quirks, we need to ship that. See https://github.com/jspecify/jspecify/issues/389#issuecomment-1661130973 for details - implementation("org.jspecify:jspecify") - - // parse plist files - implementation("com.googlecode.plist:dd-plist") - - // Parse lnk files - implementation("com.github.vatbub:mslinks") - - // YAML reading and writing - implementation("org.yaml:snakeyaml") - - // region AI - implementation("dev.langchain4j:langchain4j") - // Even though we use jvm-openai for LLM connection, we still need this package for tokenization. - implementation("dev.langchain4j:langchain4j-open-ai") - implementation("dev.langchain4j:langchain4j-mistral-ai") - implementation("dev.langchain4j:langchain4j-google-ai-gemini") - implementation("dev.langchain4j:langchain4j-http-client") - implementation("dev.langchain4j:langchain4j-http-client-jdk") - - implementation("org.apache.velocity:velocity-engine-core") - implementation("ai.djl:api") - implementation("ai.djl.huggingface:tokenizers") - implementation("ai.djl.pytorch:pytorch-model-zoo") - implementation("io.github.stefanbratanov:jvm-openai") - // openai depends on okhttp, which needs kotlin - see https://github.com/square/okhttp/issues/5299 for details - implementation("com.squareup.okhttp3:okhttp") - // GemxFX also (transitively) depends on kotlin - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - // endregion - - implementation("com.github.ben-manes.caffeine:caffeine") - - implementation("commons-io:commons-io") - - implementation("com.github.tomtung:latex2unicode_2.13") - - implementation("de.rototor.snuggletex:snuggletex-jeuclid") - - // Even if("compileOnly") is used, IntelliJ always adds to module-info.java. To avoid issues during committing, we use("implementation") instead of("compileOnly") - implementation("io.github.adr:e-adr") - - implementation("io.github.darvil82:terminal-text-formatter") - - implementation("io.zonky.test:embedded-postgres") - implementation("io.zonky.test.postgres:embedded-postgres-binaries-darwin-arm64v8") - implementation("io.zonky.test.postgres:embedded-postgres-binaries-linux-arm64v8") - - testImplementation(project(":test-support")) - - // loading of .fxml files in localization tests requires JabRef's GUI classes - testImplementation(project(":jabgui")) - - testImplementation("io.github.classgraph:classgraph") - testImplementation("org.junit.jupiter:junit-jupiter-api") - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.junit.jupiter:junit-jupiter-params") - testImplementation("org.junit.platform:junit-platform-launcher") - - testImplementation("org.mockito:mockito-core") - // TODO: Use versions of versions/build.gradle.kts - mockitoAgent("org.mockito:mockito-core:5.21.0") { isTransitive = false } - testImplementation("net.bytebuddy:byte-buddy") - - testImplementation("org.xmlunit:xmlunit-core") - testImplementation("org.xmlunit:xmlunit-matchers") - testImplementation("org.junit.jupiter:junit-jupiter-api") - - testImplementation("com.tngtech.archunit:archunit") - testImplementation("com.tngtech.archunit:archunit-junit5-api") - testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine") - - testImplementation("org.hamcrest:hamcrest") - - testImplementation("org.ow2.asm:asm") - - // Required for LocalizationConsistencyTest - testImplementation("org.testfx:testfx-core") - testImplementation("org.testfx:testfx-junit5") - - // Highly recommended builder generator - https://github.com/skinny85/jilt - // Keep it for tests only - testCompileOnly("cc.jilt:jilt") - testAnnotationProcessor("cc.jilt:jilt") - - errorprone("com.google.errorprone:error_prone_core") - errorprone("com.uber.nullaway:nullaway") -} -/* -jacoco { - toolVersion = "0.8.13" -} - */ - tasks.generateGrammarSource { maxHeapSize = "64m" arguments = arguments + listOf("-visitor", "-long-messages") @@ -319,8 +159,8 @@ abstract class JoinNonCommentedLines : DefaultTask() { } val extractMaintainers by tasks.registering(JoinNonCommentedLines::class) { - inputFile.set(layout.projectDirectory.file("../MAINTAINERS")) - outputFile.set(layout.buildDirectory.file("maintainers.txt")) + inputFile = layout.projectDirectory.file("../MAINTAINERS") + outputFile = layout.buildDirectory.file("maintainers.txt") } val maintainersProvider: Provider = extractMaintainers.flatMap { @@ -406,7 +246,7 @@ tasks.withType().configureEach { options.isFork = true options.errorprone { - disableAllChecks.set(true) + disableAllChecks = true enable("NullAway") } @@ -429,7 +269,7 @@ tasks.test { excludeTags("DatabaseTest", "FetcherTest") } jvmArgs = listOf( - "-javaagent:${mockitoAgent.asPath}", + "-javaagent:${configurations.mockitoAgent.get().asPath}", "--add-opens", "java.base/jdk.internal.ref=org.apache.pdfbox.io", "--add-opens", "java.base/java.nio=org.apache.pdfbox.io", "--enable-native-access=com.sun.jna,javafx.graphics,org.apache.lucene.core" @@ -443,7 +283,7 @@ jmh { zip64 = true } -val testSourceSet = sourceSets["test"] +val testSourceSet = sourceSets.test.get() tasks.register("fetcherTest") { group = LifecycleBasePlugin.VERIFICATION_GROUP @@ -519,27 +359,27 @@ mavenPublishing { coordinates("org.jabref", "jablib", version) pom { - name.set("jablib") - description.set("JabRef's Java library to work with BibTeX") - inceptionYear.set("2025") - url.set("https://github.com/JabRef/jabref/") + name = "jablib" + description = "JabRef's Java library to work with BibTeX" + inceptionYear = "2025" + url = "https://github.com/JabRef/jabref/" licenses { license { - name.set("MIT") - url.set("https://github.com/JabRef/jabref/blob/main/LICENSE") + name = "MIT" + url = "https://github.com/JabRef/jabref/blob/main/LICENSE" } } developers { developer { - id.set("jabref") - name.set("JabRef Developers") - url.set("https://github.com/JabRef/") + id = "jabref" + name = "JabRef Developers" + url = "https://github.com/JabRef/" } } scm { - url.set("https://github.com/JabRef/jabref") - connection.set("scm:git:https://github.com/JabRef/jabref") - developerConnection.set("scm:git:git@github.com:JabRef/jabref.git") + url = "https://github.com/JabRef/jabref" + connection = "scm:git:https://github.com/JabRef/jabref" + developerConnection = "scm:git:git@github.com:JabRef/jabref.git" } } } @@ -563,26 +403,3 @@ publishing.publications.withType().configureEach { allVariants { fromResolutionResult() } } } - -javaModuleTesting.whitebox(testing.suites["test"]) { - requires.add("io.github.classgraph") - - requires.add("jilt") - requires.add("java.compiler") - - requires.add("org.junit.jupiter.api") - requires.add("org.junit.jupiter.params") - requires.add("org.jabref.testsupport") - requires.add("org.hamcrest") - requires.add("org.mockito") - - // Required for LocalizationConsistencyTest - requires.add("org.testfx.junit5") - // requires.add("org.assertj.core") - - requires.add("org.xmlunit") - requires.add("org.xmlunit.matchers") - - requires.add("com.tngtech.archunit") - requires.add("com.tngtech.archunit.junit5.api") -} diff --git a/jablib/src/main/java/module-info.java b/jablib/src/main/java/module-info.java index 74db2dba4db..5482f2cb49b 100644 --- a/jablib/src/main/java/module-info.java +++ b/jablib/src/main/java/module-info.java @@ -125,10 +125,9 @@ requires java.base; - requires javafx.base; - requires javafx.graphics; // because of javafx.scene.paint.Color + requires transitive javafx.base; requires afterburner.fx; - requires com.tobiasdiez.easybind; + requires transitive com.tobiasdiez.easybind; // for java.awt.geom.Rectangle2D required by org.jabref.logic.pdf.TextExtractor requires java.desktop; @@ -138,21 +137,26 @@ requires java.sql.rowset; // region: Logging - requires org.slf4j; - requires jul.to.slf4j; - requires org.apache.logging.log4j.to.slf4j; + requires transitive org.slf4j; + // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog in the CLI and GUI) + requires /*runtime*/ jul.to.slf4j; + // route all requests to log4j to SLF4J + requires /*runtime*/ org.apache.logging.log4j.to.slf4j; + // required by org.jabref.generators (only) + requires /*runtime*/ org.tinylog.api.slf4j; + requires /*runtime*/ org.tinylog.impl; // endregion // Preferences and XML requires java.prefs; - requires com.fasterxml.aalto; + requires /*runtime*/ com.fasterxml.aalto; // YAML requires org.yaml.snakeyaml; // region: Annotations (@PostConstruct) - requires jakarta.annotation; - requires jakarta.inject; + requires static jakarta.annotation; + requires transitive jakarta.inject; // endregion // region: data mapping @@ -161,37 +165,35 @@ requires tools.jackson.databind; requires tools.jackson.dataformat.yaml; requires tools.jackson.core; + requires transitive com.fasterxml.jackson.annotation; // endregion // region HTTP clients requires java.net.http; requires jakarta.ws.rs; - requires org.apache.httpcomponents.core5.httpcore5; - requires org.jsoup; - requires unirest.java.core; - requires unirest.modules.gson; + requires transitive org.apache.httpcomponents.core5.httpcore5; + requires transitive org.jsoup; + requires transitive unirest.java.core; + requires /*runtime*/ unirest.modules.gson; // endregion // region: SQL databases requires embedded.postgres; // For arm, we explicitly need to add these as well - requires embedded.postgres.binaries.darwin.arm64v8; - requires embedded.postgres.binaries.linux.arm64v8; + requires /*runtime*/ embedded.postgres.binaries.darwin.arm64v8; + requires /*runtime*/ embedded.postgres.binaries.linux.arm64v8; - requires org.tukaani.xz; + requires /*runtime*/ org.tukaani.xz; requires org.postgresql.jdbc; // endregion // region: Apache Commons and other (similar) helper libraries - requires com.google.common; - requires io.github.javadiffutils; + requires transitive com.google.common; requires java.string.similarity; - requires org.apache.commons.compress; - requires org.apache.commons.csv; + requires transitive org.apache.commons.csv; requires org.apache.commons.io; requires org.apache.commons.lang3; requires org.apache.commons.text; - requires org.apache.commons.logging; // endregion // region: caching @@ -201,35 +203,32 @@ // region: latex2unicode requires com.github.tomtung.latex2unicode; requires fastparse; - requires scala.library; // endregion requires jbibtex; - requires citeproc.java; + requires transitive citeproc.java; - requires snuggletex.core; + requires transitive snuggletex.core; - requires org.apache.pdfbox; - requires org.apache.xmpbox; + requires transitive org.apache.pdfbox; + requires transitive org.apache.xmpbox; requires com.ibm.icu; requires flexmark; - requires flexmark.html2md.converter; requires flexmark.util.ast; requires flexmark.util.data; - requires com.h2database.mvstore; + requires transitive com.h2database.mvstore; requires java.keyring; - requires org.freedesktop.dbus; // region AI - requires ai.djl.api; - requires ai.djl.pytorch_model_zoo; + requires transitive ai.djl.api; + requires /*runtime*/ ai.djl.pytorch_model_zoo; requires ai.djl.tokenizers; requires jvm.openai; requires langchain4j; - requires langchain4j.core; + requires transitive langchain4j.core; uses ai.djl.engine.EngineProvider; uses ai.djl.repository.RepositoryFactory; uses ai.djl.repository.zoo.ZooProvider; @@ -243,19 +242,17 @@ */ uses org.apache.lucene.codecs.lucene103.Lucene103Codec; requires org.apache.lucene.analysis.common; - requires org.apache.lucene.core; - requires org.apache.lucene.highlighter; + requires transitive org.apache.lucene.core; + requires transitive org.apache.lucene.highlighter; requires org.apache.lucene.queryparser; // endregion // region: appdirs requires net.harawata.appdirs; - requires com.sun.jna; - requires com.sun.jna.platform; // endregion // region: jgit - requires org.eclipse.jgit; + requires transitive org.eclipse.jgit; uses org.eclipse.jgit.transport.SshSessionFactory; uses org.eclipse.jgit.lib.Signer; // endregion @@ -264,13 +261,11 @@ requires cuid; requires com.dd.plist; requires io.github.darvil.terminal.textformatter; - requires io.github.eadr; - // required by okhttp and some AI library - requires kotlin.stdlib; + requires static io.github.eadr; requires mslinks; - requires org.antlr.antlr4.runtime; + requires transitive org.antlr.antlr4.runtime; requires org.jooq.jool; - requires org.libreoffice.uno; + requires transitive org.libreoffice.uno; requires transitive org.jspecify; // endregion } diff --git a/jablib/src/main/java/org/jabref/logic/ai/chatting/chathistory/storages/MVStoreChatHistoryStorage.java b/jablib/src/main/java/org/jabref/logic/ai/chatting/chathistory/storages/MVStoreChatHistoryStorage.java index 31e13930b3e..834f03b048f 100644 --- a/jablib/src/main/java/org/jabref/logic/ai/chatting/chathistory/storages/MVStoreChatHistoryStorage.java +++ b/jablib/src/main/java/org/jabref/logic/ai/chatting/chathistory/storages/MVStoreChatHistoryStorage.java @@ -15,7 +15,6 @@ import dev.langchain4j.data.message.AiMessage; import dev.langchain4j.data.message.ChatMessage; import dev.langchain4j.data.message.UserMessage; -import kotlin.ranges.IntRange; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,9 +101,9 @@ private List loadMessagesFromMap(Map ma private void storeMessagesForMap(Map map, List messages) { map.clear(); - new IntRange(0, messages.size() - 1).forEach(i -> - map.put(i, ChatHistoryRecord.fromLangchainMessage(messages.get(i))) - ); + for (int i = 0; i < messages.size(); i++) { + map.put(i, ChatHistoryRecord.fromLangchainMessage(messages.get(i))); + } } private Map getMapForEntry(Path bibDatabasePath, String citationKey) { diff --git a/jabls-cli/build.gradle.kts b/jabls-cli/build.gradle.kts index 7a7cf3141fb..2576114bc25 100644 --- a/jabls-cli/build.gradle.kts +++ b/jabls-cli/build.gradle.kts @@ -12,9 +12,12 @@ version = providers.gradleProperty("projVersion") .orElse("100.0.0") .get() +mainModuleInfo { + annotationProcessor("info.picocli.codegen") +} + application{ - mainClass.set("org.jabref.languageserver.cli.ServerCli") - mainModule.set("org.jabref.jabls.cli") + mainClass = "org.jabref.languageserver.cli.ServerCli" applicationDefaultJvmArgs = listOf( "--enable-native-access=com.sun.jna,org.apache.lucene.core", @@ -26,37 +29,6 @@ application{ ) } -// See https://bugs.openjdk.org/browse/JDK-8342623 -val target = java.toolchain.languageVersion.get().asInt() -if (target >= 26) { - dependencies { - implementation("org.openjfx:jdk-jsobject") - } -} else { - configurations.all { - exclude(group = "org.openjfx", module = "jdk-jsobject") - } -} - -dependencies { - implementation(project(":jablib")) - implementation(project(":jabls")) - - implementation("org.openjfx:javafx-controls") - implementation("org.openjfx:javafx-fxml") - implementation("org.jabref:afterburner.fx") - - implementation("org.slf4j:slf4j-api") - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - implementation("info.picocli:picocli") - annotationProcessor("info.picocli:picocli-codegen") -} - tasks.test { testLogging { // set options for log level LIFECYCLE diff --git a/jabls-cli/src/main/java/module-info.java b/jabls-cli/src/main/java/module-info.java index 47f05ee2a34..aead126386a 100644 --- a/jabls-cli/src/main/java/module-info.java +++ b/jabls-cli/src/main/java/module-info.java @@ -1,13 +1,17 @@ module org.jabref.jabls.cli { opens org.jabref.languageserver.cli to info.picocli; - requires transitive org.jabref.jablib; - requires transitive org.jabref.jabls; + requires org.jabref.jablib; + requires org.jabref.jabls; requires afterburner.fx; requires org.slf4j; requires jul.to.slf4j; + requires /*runtime*/ org.tinylog.api; + requires /*runtime*/ org.tinylog.impl; + requires /*runtime*/ org.apache.logging.log4j.to.slf4j; + requires /*runtime*/ org.tinylog.api.slf4j; requires info.picocli; } diff --git a/jabls/build.gradle.kts b/jabls/build.gradle.kts index 45597d2bd40..bab68503a88 100644 --- a/jabls/build.gradle.kts +++ b/jabls/build.gradle.kts @@ -5,26 +5,12 @@ plugins { id("java-library") } -dependencies { - api(project(":jablib")) - - implementation("org.slf4j:slf4j-api") - - // LSP4J for LSP Server - implementation("org.eclipse.lsp4j:org.eclipse.lsp4j") - implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.websocket.jakarta") - - implementation("com.google.guava:guava") +testModuleInfo { + requires("org.junit.jupiter.api") + requires("org.mockito") // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - testImplementation("org.slf4j:jul-to-slf4j") - - testImplementation("org.mockito:mockito-core") -} - -javaModuleTesting.whitebox(testing.suites["test"]) { - requires.add("org.junit.jupiter.api") - requires.add("org.mockito") + runtimeOnly("jul.to.slf4j") } tasks.test { diff --git a/jabls/src/main/java/module-info.java b/jabls/src/main/java/module-info.java index f0f5a6f9783..c3a2d8f175d 100644 --- a/jabls/src/main/java/module-info.java +++ b/jabls/src/main/java/module-info.java @@ -4,18 +4,18 @@ exports org.jabref.languageserver.controller; exports org.jabref.languageserver.util; - requires org.jabref.jablib; + requires transitive org.jabref.jablib; + requires tools.jackson.core; requires tools.jackson.databind; requires com.google.common; - requires com.google.gson; + requires transitive com.google.gson; requires org.slf4j; - requires org.eclipse.lsp4j; + requires transitive org.eclipse.lsp4j; requires org.eclipse.lsp4j.jsonrpc; - requires org.eclipse.lsp4j.websocket.jakarta; - requires org.jspecify; + requires transitive org.jspecify; } diff --git a/jabsrv-cli/build.gradle.kts b/jabsrv-cli/build.gradle.kts index b7f44dedd5a..c448c5c705b 100644 --- a/jabsrv-cli/build.gradle.kts +++ b/jabsrv-cli/build.gradle.kts @@ -12,9 +12,12 @@ version = providers.gradleProperty("projVersion") .orElse("100.0.0") .get() +mainModuleInfo { + annotationProcessor("info.picocli.codegen") +} + application{ - mainClass.set("org.jabref.http.server.cli.ServerCli") - mainModule.set("org.jabref.jabsrv.cli") + mainClass = "org.jabref.http.server.cli.ServerCli" applicationDefaultJvmArgs = listOf( "--enable-native-access=com.sun.jna,org.apache.lucene.core", @@ -26,90 +29,6 @@ application{ ) } -// See https://bugs.openjdk.org/browse/JDK-8342623 -val target = java.toolchain.languageVersion.get().asInt() -if (target >= 26) { - dependencies { - implementation("org.openjfx:jdk-jsobject") - } -} else { - configurations.all { - exclude(group = "org.openjfx", module = "jdk-jsobject") - } -} - -dependencies { - implementation(project(":jablib")) - implementation(project(":jabsrv")) - - implementation("org.openjfx:javafx-controls") - implementation("org.openjfx:javafx-fxml") - implementation ("org.openjfx:javafx-graphics") - - implementation("org.slf4j:slf4j-api") - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - implementation("info.picocli:picocli") - annotationProcessor("info.picocli:picocli-codegen") - - // required because of "service implementation must be defined in the same module as the provides directive" - implementation("org.postgresql:postgresql") - implementation("org.bouncycastle:bcprov-jdk18on") - implementation("com.konghq:unirest-modules-gson") - implementation("ai.djl:api") - implementation("ai.djl.huggingface:tokenizers") - implementation("ai.djl.pytorch:pytorch-model-zoo") - - // Prevents errors at "createMergedModule" - // implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - - // region copied from jabsrv - - // API - implementation("jakarta.ws.rs:jakarta.ws.rs-api") - - // Implementation of the API - implementation("org.glassfish.jersey.core:jersey-server") - - // Injection framework - // implementation("org.glassfish.jersey.inject:jersey-hk2") - // implementation("org.glassfish.hk2:hk2-api") - // implementation("org.glassfish.hk2:hk2-utils") - // Just to avoid the compiler error " org.glassfish.hk2.extension.ServiceLocatorGenerator: module jabsrv.merged.module does not declare `uses`" - // implementation("org.glassfish.hk2:hk2-locator") - - // testImplementation("org.glassfish.hk2:hk2-testing") - // implementation("org.glassfish.hk2:hk2-testing-jersey") - // testImplementation("org.glassfish.hk2:hk2-junitrunner") - - // HTTP server - // implementation("org.glassfish.jersey.containers:jersey-container-netty-http") - implementation("org.glassfish.jersey.containers:jersey-container-grizzly2-http") - implementation("org.glassfish.grizzly:grizzly-http-server") - implementation("org.glassfish.grizzly:grizzly-framework") - testImplementation("org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2") - implementation("jakarta.validation:jakarta.validation-api") - implementation("org.hibernate.validator:hibernate-validator") - - implementation("com.konghq:unirest-modules-gson") - - // Allow objects "magically" to be mapped to JSON using GSON - // implementation("org.glassfish.jersey.media:jersey-media-json-gson") - - implementation("com.google.guava:guava") - - implementation("org.jabref:afterburner.fx") - implementation("net.harawata:appdirs") - - implementation("de.undercouch:citeproc-java") - - // endregion -} - tasks.test { testLogging { // set options for log level LIFECYCLE diff --git a/jabsrv-cli/src/main/java/module-info.java b/jabsrv-cli/src/main/java/module-info.java index 0ef9cbcea7a..2458305c57a 100644 --- a/jabsrv-cli/src/main/java/module-info.java +++ b/jabsrv-cli/src/main/java/module-info.java @@ -1,44 +1,23 @@ module org.jabref.jabsrv.cli { opens org.jabref.http.server.cli to info.picocli; - requires transitive org.jabref.jablib; - requires transitive org.jabref.jabsrv; + requires org.jabref.jablib; + requires org.jabref.jabsrv; requires org.slf4j; requires jul.to.slf4j; - requires com.google.common; - requires com.google.gson; - - // requires org.glassfish.hk2.api; - - requires jakarta.annotation; - requires jakarta.inject; + requires static jakarta.annotation; requires afterburner.fx; provides com.airhacks.afterburner.views.ResourceLocator with org.jabref.http.cli.JabRefResourceLocator; requires javafx.base; - requires org.glassfish.grizzly; - requires org.glassfish.grizzly.http; requires org.glassfish.grizzly.http.server; - requires jakarta.validation; - requires jakarta.ws.rs; - requires org.glassfish.jersey.core.common; - requires org.glassfish.jersey.container.grizzly2.http; - requires org.glassfish.jersey.core.server; requires info.picocli; - requires net.harawata.appdirs; - requires com.sun.jna; - requires com.sun.jna.platform; - - requires jbibtex; - requires citeproc.java; - requires transitive org.jspecify; requires java.logging; - } diff --git a/jabsrv/build.gradle.kts b/jabsrv/build.gradle.kts index 981fa8559ff..dd35d89a3e7 100644 --- a/jabsrv/build.gradle.kts +++ b/jabsrv/build.gradle.kts @@ -5,71 +5,15 @@ plugins { id("java-library") } -dependencies { - api(project(":jablib")) - - implementation("org.slf4j:slf4j-api") - - // API - implementation("jakarta.ws.rs:jakarta.ws.rs-api") - - // Implementation of the API - implementation("org.glassfish.jersey.core:jersey-server") - - // Injection framework - implementation("org.glassfish.jersey.inject:jersey-hk2") - implementation("org.glassfish.hk2:hk2-api") - implementation("org.glassfish.hk2:hk2-utils") - implementation("org.glassfish.hk2:hk2-locator") - - // testImplementation("org.glassfish.hk2:hk2-testing") - // implementation("org.glassfish.hk2:hk2-testing-jersey") - // testImplementation("org.glassfish.hk2:hk2-junitrunner") - - // HTTP server - // implementation("org.glassfish.jersey.containers:jersey-container-netty-http") - implementation("org.glassfish.jersey.containers:jersey-container-grizzly2-http") - implementation("org.glassfish.grizzly:grizzly-http-server") - implementation("org.glassfish.grizzly:grizzly-framework") - implementation("org.glassfish.jaxb:jaxb-runtime") - testImplementation("org.glassfish.jersey.test-framework:jersey-test-framework-core") - testImplementation("org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2") - implementation("jakarta.validation:jakarta.validation-api") - implementation("org.hibernate.validator:hibernate-validator") - - implementation("com.konghq:unirest-modules-gson") - - // Allow objects "magically" to be mapped to JSON using GSON - // implementation("org.glassfish.jersey.media:jersey-media-json-gson") - - implementation("com.google.guava:guava") - - implementation("org.jabref:afterburner.fx") - implementation("org.openjfx:javafx-base") - implementation("org.openjfx:javafx-controls") - implementation("org.openjfx:javafx-fxml") - - implementation("net.harawata:appdirs") - - implementation("de.undercouch:citeproc-java") - - testImplementation("org.mockito:mockito-core") - testImplementation("net.bytebuddy:byte-buddy") - - testImplementation("org.tinylog:slf4j-tinylog") - testImplementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - testImplementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - testImplementation("org.apache.logging.log4j:log4j-to-slf4j") - -} - -javaModuleTesting.whitebox(testing.suites["test"]) { - requires.add("jul.to.slf4j") - requires.add("org.junit.jupiter.api") - requires.add("org.mockito") - requires.add("org.glassfish.jersey.tests.framework.core") +testModuleInfo { + requires("org.junit.jupiter.api") + requires("org.mockito") + requires("org.glassfish.jersey.tests.framework.core") + requires("jul.to.slf4j") + runtimeOnly("org.glassfish.jersey.tests.framework.provider.grizzly") + runtimeOnly("org.tinylog.api") + runtimeOnly("org.tinylog.impl") + runtimeOnly("org.apache.logging.log4j.to.slf4j") } tasks.test { diff --git a/jabsrv/src/main/java/module-info.java b/jabsrv/src/main/java/module-info.java index 7fd8ad3366f..d737204923c 100644 --- a/jabsrv/src/main/java/module-info.java +++ b/jabsrv/src/main/java/module-info.java @@ -16,47 +16,44 @@ opens org.jabref.http.server.resources to org.glassfish.hk2.locator, org.glassfish.hk2.utilities; exports org.jabref.http.server.resources; - requires javafx.base; + requires transitive javafx.base; // For CAYW feature requires transitive javafx.graphics; requires transitive javafx.controls; requires afterburner.fx; + requires java.desktop; // For ServiceLocatorUtilities.createAndPopulateServiceLocator() - requires org.glassfish.hk2.locator; - uses org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl; + requires /*runtime*/ org.glassfish.hk2.locator; - requires org.jabref.jablib; + requires transitive org.jabref.jablib; - requires org.slf4j; + requires transitive org.slf4j; requires com.google.common; - requires com.google.gson; + requires transitive com.google.gson; - requires org.glassfish.hk2.api; + requires transitive org.glassfish.hk2.api; - requires jakarta.annotation; - requires jakarta.inject; + requires static jakarta.annotation; + requires transitive jakarta.inject; + + // Injection framework + requires /*runtime*/ org.glassfish.jersey.inject.hk2; requires org.glassfish.grizzly; - requires org.glassfish.grizzly.http; - requires org.glassfish.grizzly.http.server; - requires jakarta.validation; - requires jakarta.ws.rs; + requires transitive org.glassfish.grizzly.http.server; + requires transitive jakarta.ws.rs; - requires org.glassfish.jersey.core.common; requires org.glassfish.jersey.core.server; requires org.glassfish.jersey.container.grizzly2.http; requires net.harawata.appdirs; - requires com.sun.jna; - requires com.sun.jna.platform; - - requires jbibtex; - requires citeproc.java; requires transitive org.jspecify; requires java.logging; + requires tools.jackson.core; requires tools.jackson.databind; + requires transitive com.fasterxml.jackson.annotation; } diff --git a/test-support/build.gradle.kts b/test-support/build.gradle.kts index 3033d2da9a3..9f1f1094e81 100644 --- a/test-support/build.gradle.kts +++ b/test-support/build.gradle.kts @@ -2,30 +2,3 @@ plugins { id("org.jabref.gradle.module") id("java-library") } - -dependencies { - implementation(project(":jablib")) - - implementation("org.openjfx:javafx-base") - implementation("org.openjfx:javafx-controls") - implementation("org.openjfx:javafx-fxml") - - implementation("org.slf4j:slf4j-api") - implementation("org.tinylog:tinylog-api") - implementation("org.tinylog:slf4j-tinylog") - implementation("org.tinylog:tinylog-impl") - // route all requests to java.util.logging to SLF4J (which in turn routes to tinylog) - implementation("org.slf4j:jul-to-slf4j") - // route all requests to log4j to SLF4J - implementation("org.apache.logging.log4j:log4j-to-slf4j") - - implementation("org.junit.jupiter:junit-jupiter-api") - - implementation("org.mockito:mockito-core") - implementation("net.bytebuddy:byte-buddy") - - implementation("org.jspecify:jspecify") - - implementation("com.tngtech.archunit:archunit") - implementation("com.tngtech.archunit:archunit-junit5-api") -} diff --git a/test-support/src/main/java/module-info.java b/test-support/src/main/java/module-info.java index b8d2d3e2a68..c28edb537a1 100644 --- a/test-support/src/main/java/module-info.java +++ b/test-support/src/main/java/module-info.java @@ -1,10 +1,14 @@ open module org.jabref.testsupport { - requires org.junit.jupiter.api; + requires transitive com.tngtech.archunit.junit5.api; + requires transitive com.tngtech.archunit; + requires transitive org.jabref.jablib; + requires transitive org.junit.jupiter.api; + requires org.mockito; - requires org.jabref.jablib; - requires com.tngtech.archunit; - requires com.tngtech.archunit.junit5.api; - requires javafx.graphics; + requires javafx.base; + requires org.junit.platform.commons; + + requires static com.fasterxml.jackson.annotation; exports org.jabref.support; } diff --git a/versions/build.gradle.kts b/versions/build.gradle.kts index 974e8dd111f..22b0ad85594 100644 --- a/versions/build.gradle.kts +++ b/versions/build.gradle.kts @@ -21,34 +21,11 @@ val pdfbox = "3.0.6" dependencies { api(platform("ai.djl:bom:0.36.0")) api(platform("dev.langchain4j:langchain4j-bom:1.11.0")) - api("dev.langchain4j:langchain4j") - api("dev.langchain4j:langchain4j-google-ai-gemini") - api("dev.langchain4j:langchain4j-hugging-face") - api("dev.langchain4j:langchain4j-mistral-ai") - api("dev.langchain4j:langchain4j-open-ai") api(enforcedPlatform("io.zonky.test.postgres:embedded-postgres-binaries-bom:18.2.0")) - api(platform("org.junit:junit-bom:6.0.3")) - api("org.junit.jupiter:junit-jupiter-api") - api("org.junit.jupiter:junit-jupiter-params") - api("org.junit.jupiter:junit-jupiter") - api("org.junit.platform:junit-platform-launcher") - api(platform("org.glassfish.grizzly:grizzly-bom:5.0.0")) - api("org.glassfish.grizzly:grizzly-framework") - api("org.glassfish.grizzly:grizzly-http-server") - api(platform("org.glassfish.jersey:jersey-bom:4.0.2")) - api("org.glassfish.jersey.containers:jersey-container-grizzly2-http") - api("org.glassfish.jersey.core:jersey-server") - api("org.glassfish.jersey.inject:jersey-hk2") - api("org.glassfish.jersey.test-framework:jersey-test-framework-core") - api("org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2") - api(platform("tools.jackson:jackson-bom:3.0.4")) - api("tools.jackson.core:jackson-core") - api("tools.jackson.core:jackson-databind") - api("tools.jackson.dataformat:jackson-dataformat-yaml") } dependencies.constraints { @@ -70,6 +47,7 @@ dependencies.constraints { api("org.eclipse.lsp4j:org.eclipse.lsp4j.websocket.jakarta:1.0.0") api("com.github.ben-manes.caffeine:caffeine:3.2.3") api("com.github.javakeyring:java-keyring:1.0.4") + api("com.github.javaparser:javaparser-core:3.28.0") api("com.github.javaparser:javaparser-symbol-solver-core:3.28.0") api("com.github.sialcasa.mvvmFX:mvvmfx-validation:f195849ca9") //jitpack api("com.github.tomtung:latex2unicode_2.13:0.3.2") @@ -78,6 +56,7 @@ dependencies.constraints { api("com.google.guava:guava:33.5.0-jre") api("com.googlecode.plist:dd-plist:1.29") api("com.h2database:h2-mvstore:2.4.240") + api("com.knuddels:jtokkit:1.1.0") api("com.konghq:unirest-java-core:4.7.4") api("com.konghq:unirest-modules-gson:4.7.4") api("com.pixelduke:fxthemes:1.6.0") @@ -92,6 +71,7 @@ dependencies.constraints { api("com.vladsch.flexmark:flexmark:0.64.8") api("commons-io:commons-io:2.21.0") api("commons-logging:commons-logging:1.3.5") + api("de.rototor.snuggletex:snuggletex-core:1.3.0") api("de.rototor.snuggletex:snuggletex-jeuclid:1.3.0") api("de.saxsys:mvvmfx:1.8.0") api("de.undercouch:citeproc-java:3.5.0") @@ -122,6 +102,7 @@ dependencies.constraints { api("org.apache.commons:commons-csv:1.14.1") api("org.apache.commons:commons-lang3:3.20.0") api("org.apache.commons:commons-text:1.15.0") + api("org.apache.httpcomponents.core5:httpcore5:5.4.1") api("org.apache.httpcomponents.client5:httpclient5:5.6") api("org.apache.logging.log4j:log4j-to-slf4j:2.25.3") api("org.apache.lucene:lucene-analysis-common:$lucene")