From 2fdd9473f07186bc2517e646bd4a0628fb207c81 Mon Sep 17 00:00:00 2001 From: Ulrik Guenther Date: Fri, 9 Feb 2024 17:33:58 +0100 Subject: [PATCH] Fix JPMS issues, move module-info.java to correct place (WIP) --- build.gradle.kts | 16 +++++++++++++--- buildSrc/build.gradle.kts | 3 +++ .../src/main/kotlin/scenery/base.gradle.kts | 13 +++++++++++++ src/main/{kotlin => java}/module-info.java | 18 +++++++++--------- .../examples/volumes/OutOfCoreRAIExample.kt | 14 +++++++------- 5 files changed, 45 insertions(+), 19 deletions(-) rename src/main/{kotlin => java}/module-info.java (87%) diff --git a/build.gradle.kts b/build.gradle.kts index ffaf81a694..185b1a94e0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ import scenery.* import java.net.URL plugins { + `java-library` // kotlin and dokka versions are now managed in settings.gradle.kts and gradle.properties kotlin("jvm") kotlin("kapt") @@ -12,11 +13,12 @@ plugins { scenery.base scenery.publish scenery.sign -// id("com.github.elect86.sciJava") version "0.0.4" jacoco id("com.github.johnrengelman.shadow") apply false } + + repositories { mavenCentral() maven("https://maven.scijava.org/content/groups/public") @@ -39,6 +41,7 @@ val lwjglArtifacts = listOf( "lwjgl-jawt" ) + dependencies { val scijavaParentPomVersion = project.properties["scijavaParentPOMVersion"] val lwjglVersion = project.properties["lwjglVersion"] @@ -110,6 +113,8 @@ dependencies { api("sc.fiji:bigdataviewer-core:10.4.13") api("sc.fiji:bigdataviewer-vistools:1.0.0-beta-28") api("sc.fiji:bigvolumeviewer:0.3.3") { + exclude("sc.fiji", "bigdataviewer-core") + exclude("sc.fiji", "bigdataviewer-vistools") exclude("org.jogamp.gluegen", "gluegen-rt") exclude("org.jogamp.jogl", "jogl-all") } @@ -120,8 +125,8 @@ dependencies { exclude("org.lwjgl", "lwjgl-bom") exclude("org.lwjgl", "lwjgl") } - implementation("org.janelia.saalfeldlab:n5") - implementation("org.janelia.saalfeldlab:n5-imglib2") +// implementation("org.janelia.saalfeldlab:n5") +// implementation("org.janelia.saalfeldlab:n5-imglib2") listOf("core", "structure", "modfinder").forEach { implementation("org.biojava:biojava-$it:6.0.5") { exclude("org.slf4j", "slf4j-api") @@ -150,6 +155,7 @@ dependencies { val isRelease: Boolean get() = System.getProperty("release") == "true" + tasks { withType().all { kotlinOptions { @@ -161,6 +167,10 @@ tasks { withType().all { targetCompatibility = project.properties["jvmTarget"]?.toString() ?: "21" sourceCompatibility = project.properties["jvmTarget"]?.toString() ?: "21" + + // Set high error limit, such that all JPMS errors are shown, it's over 9000! + options.compilerArgs.addAll("-Xmaxerrs 9001".split(" ")) + } withType().configureEach { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 49da95c66e..a805e5441e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -11,8 +11,11 @@ repositories { dependencies { implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10") +// implementation("org.gradlex:extra-java-module-info:1.8") } + + //, imagej, imgLib2, scifio, fiji, bigDataViewer, trakEM2, n5, boneJ, ome, omero, //groovy, apache, batik, commons, eclipseCollections, eclipseSwt, googleCloud, jackson, //jetty, jGraphT, jna, jogamp, kotlib, logBack, migLayout, rSyntaxTextArea, slf4j, diff --git a/buildSrc/src/main/kotlin/scenery/base.gradle.kts b/buildSrc/src/main/kotlin/scenery/base.gradle.kts index 2404159f18..70fdce98cd 100644 --- a/buildSrc/src/main/kotlin/scenery/base.gradle.kts +++ b/buildSrc/src/main/kotlin/scenery/base.gradle.kts @@ -5,8 +5,21 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { jacoco +// id("org.gradlex.extra-java-module-info") } +//extraJavaModuleInfo { +//// module("net.imglib2:imglib2", "net.imglib2") { +//// mergeJar("sc.fiji:bigdataviewer-core") +//// } +// +//// automaticModule("sc.fiji:bigdataviewer-core", "bdv") { +//// mergeJar("sc.fiji:bigdataviewer-vistools") +//// } +// +// deriveAutomaticModuleNamesFromFileNames.set(true) +//} + repositories { mavenCentral() } diff --git a/src/main/kotlin/module-info.java b/src/main/java/module-info.java similarity index 87% rename from src/main/kotlin/module-info.java rename to src/main/java/module-info.java index 164e961b52..2f143d2447 100644 --- a/src/main/kotlin/module-info.java +++ b/src/main/java/module-info.java @@ -45,13 +45,13 @@ requires com.fasterxml.jackson.databind; requires com.fasterxml.jackson.dataformat.yaml; requires com.fasterxml.jackson.kotlin; - requires jinput; - requires trove4j; - requires org.scijava.ui.behaviour; +// requires jinput; +// requires trove4j; +// requires org.scijava.ui.behaviour; requires org.slf4j; - -// opens java.nio; -// opens java.nio; -// opens sun.nio.ch; -// opens sun. -} \ No newline at end of file + requires bvv; + requires bdv; +// requires bdv.util; + requires net.imglib2.realtransform; + requires net.imglib2; +} diff --git a/src/test/kotlin/graphics/scenery/tests/examples/volumes/OutOfCoreRAIExample.kt b/src/test/kotlin/graphics/scenery/tests/examples/volumes/OutOfCoreRAIExample.kt index 734b26c572..b2e9e2fd26 100644 --- a/src/test/kotlin/graphics/scenery/tests/examples/volumes/OutOfCoreRAIExample.kt +++ b/src/test/kotlin/graphics/scenery/tests/examples/volumes/OutOfCoreRAIExample.kt @@ -18,10 +18,10 @@ import net.imglib2.img.Img import net.imglib2.img.display.imagej.ImageJFunctions import net.imglib2.type.numeric.integer.UnsignedShortType import net.imglib2.type.volatiles.VolatileUnsignedShortType -import org.janelia.saalfeldlab.n5.GzipCompression -import org.janelia.saalfeldlab.n5.N5FSReader -import org.janelia.saalfeldlab.n5.N5FSWriter -import org.janelia.saalfeldlab.n5.imglib2.N5Utils +//import org.janelia.saalfeldlab.n5.GzipCompression +//import org.janelia.saalfeldlab.n5.N5FSReader +//import org.janelia.saalfeldlab.n5.N5FSWriter +//import org.janelia.saalfeldlab.n5.imglib2.N5Utils import java.nio.file.Files @@ -50,12 +50,12 @@ class OutOfCoreRAIExample: SceneryBase("Out-of-core RAI Rendering example", 1280 // and save it to a temporary location. val datasetName = "testDataset" val n5path = Files.createTempDirectory("scenery-t1-head-n5") - val n5 = N5FSWriter(n5path.toString()) - N5Utils.save(img, n5, datasetName, intArrayOf(img.dimension(0).toInt(), img.dimension(1).toInt(), img.dimension(2).toInt()), GzipCompression()) +// val n5 = N5FSWriter(n5path.toString()) +// N5Utils.save(img, n5, datasetName, intArrayOf(img.dimension(0).toInt(), img.dimension(1).toInt(), img.dimension(2).toInt()), GzipCompression()) // load the multiresolution N5 dataset from the temporary location and wrap it // as [net.imglib2.Volatile] dataset. - val ooc: RandomAccessibleInterval = N5Utils.openVolatile(N5FSReader(n5path.toString()), datasetName) + val ooc: RandomAccessibleInterval? = null //N5Utils.openVolatile(N5FSReader(n5path.toString()), datasetName) val wrapped = VolatileViews.wrapAsVolatile(ooc) // When loading datasets with multiple resolution levels, it's important to use Volatile types