Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPMS compatibility #619

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -41,6 +43,7 @@ val lwjglArtifacts = listOf(
"lwjgl-zstd"
)


dependencies {
val scijavaParentPomVersion = project.properties["scijavaParentPOMVersion"]
val lwjglVersion = project.properties["lwjglVersion"]
Expand Down Expand Up @@ -113,6 +116,8 @@ dependencies {
api("sc.fiji:bigdataviewer-core:10.4.14")
api("sc.fiji:bigdataviewer-vistools:1.0.0-beta-28")
api("sc.fiji:bigvolumeviewer:0.3.3") {
exclude("sc.fiji", "bigdataviewer-core")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add a comment explaining what it accomplishes to exclude bigdataviewer-core and bigdataviewer-vistools here, when they are included as direct dependencies immediately above.

exclude("sc.fiji", "bigdataviewer-vistools")
exclude("org.jogamp.gluegen", "gluegen-rt")
exclude("org.jogamp.jogl", "jogl-all")
}
Expand All @@ -123,9 +128,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")
Expand Down Expand Up @@ -154,6 +158,7 @@ dependencies {
val isRelease: Boolean
get() = System.getProperty("release") == "true"


tasks {
withType<KotlinCompile>().all {
kotlinOptions {
Expand All @@ -165,6 +170,10 @@ tasks {
withType<JavaCompile>().all {
targetCompatibility = project.properties["jvmTarget"]?.toString() ?: "21"
sourceCompatibility = project.properties["jvmTarget"]?.toString() ?: "21"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a thing with this PR specifically, but maybe rather than setting -target and source, you want to configure the --release?

    options.compilerArgs.add("--release")
    options.compilerArgs.add(project.properties["jvmTarget"]?.toString() ?: "21")

Why? Because.


// Set high error limit, such that all JPMS errors are shown, it's over 9000!
options.compilerArgs.addAll("-Xmaxerrs 9001".split(" "))

}

withType<GenerateMavenPom>().configureEach {
Expand Down
5 changes: 4 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ repositories {

dependencies {
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
// 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,
//snakeYAML, tensorFlow, junit5, jmh, misc
//snakeYAML, tensorFlow, junit5, jmh, misc
13 changes: 13 additions & 0 deletions buildSrc/src/main/kotlin/scenery/base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
57 changes: 57 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module graphics.scenery {
exports graphics.scenery;
exports graphics.scenery.atomicsimulations;
exports graphics.scenery.attribute;
exports graphics.scenery.backends;
exports graphics.scenery.compute;
exports graphics.scenery.controls;
exports graphics.scenery.effectors;
exports graphics.scenery.fonts;
exports graphics.scenery.geometry;
exports graphics.scenery.net;
exports graphics.scenery.numerics;
exports graphics.scenery.primitives;
exports graphics.scenery.proteins;
exports graphics.scenery.repl;
exports graphics.scenery.serialization;
exports graphics.scenery.textures;
exports graphics.scenery.ui;
exports graphics.scenery.utils;
exports graphics.scenery.volumes;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading it right, it looks like this is exporting all the graphics.scenery.* packages, but none of the graphics.scenery.*.* ones? Specifically: missing are attribute.geometry, attribute.material, attribute.renderable, attribute.spatial, backends.software, backends.vulkan, controls.behaviours, controls.eyetracking, utils.extensions. Intentional, or no?

And are you sure you want to expose so much API surface? I guess since scenery hasn't hit 1.0.0 yet, you can still break things. But this work is an opportunity to consider whether it makes sense to create any internal (non-exported) packages, no?


requires java.base;
requires java.desktop;
requires java.management;
requires java.logging;
requires jdk.unsupported;

requires kotlin.stdlib;
requires kotlin.reflect;
requires kotlinx.coroutines.core;

requires org.joml;
requires org.lwjgl;
requires org.lwjgl.vulkan;
requires org.lwjgl.tinyexr;
requires org.lwjgl.remotery;
requires org.lwjgl.openvr;
requires org.lwjgl.glfw;
requires org.lwjgl.spvc;
requires org.lwjgl.shaderc;
requires org.lwjgl.jemalloc;
requires info.picocli;
requires org.bytedeco.ffmpeg;
requires com.fasterxml.jackson.core;
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 org.slf4j;
requires bvv;
requires bdv;
// requires bdv.util;
requires net.imglib2.realtransform;
requires net.imglib2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, scenery only uses (used) n5 in tests? Please let me know if you find a good way of dealing with test-scope dependencies with JPMS. We have found it very challenging with SciJava Ops; we were unable to make a separate module-info.java in the src/test subtree work (see scijava/scijava@ae39206 for details).

import java.nio.file.Files


Expand Down Expand Up @@ -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<UnsignedShortType> = N5Utils.openVolatile(N5FSReader(n5path.toString()), datasetName)
val ooc: RandomAccessibleInterval<UnsignedShortType>? = 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
Expand Down
Loading