diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 740a8a7..0000000 --- a/build.gradle +++ /dev/null @@ -1,153 +0,0 @@ -plugins { - // Main gradle plugin for building a Java library - id 'java-library' - id 'maven-publish' - // To create a shadow/fat jar that bundle up all dependencies - id 'com.github.johnrengelman.shadow' version '8.1.1' - // Add JavaFX dependencies - alias(libs.plugins.javafx) - // Version in settings.gradle - id 'org.bytedeco.gradle-javacpp-platform' -} - -ext.moduleName = 'qupath.extension.omero' -version = "0.1.1-rc1" -description = "QuPath extension to support image reading using OMERO APIs." -group = 'io.github.qupath' -ext.qupathVersion = gradle.ext.qupathVersion -ext.qupathJavaVersion = libs.versions.jdk.get() - -dependencies { - shadow "io.github.qupath:qupath-gui-fx:${qupathVersion}" - shadow "io.github.qupath:qupath-extension-bioformats:${qupathVersion}" - shadow libs.qupath.fxtras - shadow libs.guava - - shadow libs.slf4j - - // Auto-discover if OMERO-Gateway is available - shadow "org.openmicroscopy:omero-gateway:5.8.2" - - testImplementation "io.github.qupath:qupath-gui-fx:${qupathVersion}" - testImplementation "io.github.qupath:qupath-extension-bioformats:${qupathVersion}" - testImplementation "org.openmicroscopy:omero-gateway:5.8.2" - testImplementation libs.junit - testImplementation "org.testcontainers:testcontainers:1.19.1" - testImplementation "org.testcontainers:junit-jupiter:1.19.1" -} - -jar { - manifest { - attributes("Implementation-Title": project.name, - "Implementation-Version": archiveVersion, - "Automatic-Module-Name": moduleName) - } -} - -/** - * Copy necessary attributes, see - * - https://github.com/qupath/qupath-extension-template/issues/9 - * - https://github.com/openjfx/javafx-gradle-plugin#variants - */ -configurations.shadow { - def runtimeAttributes = configurations.runtimeClasspath.attributes - runtimeAttributes.keySet().each { key -> - if (key in [Usage.USAGE_ATTRIBUTE, OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, MachineArchitecture.ARCHITECTURE_ATTRIBUTE]) - attributes.attribute(key, runtimeAttributes.getAttribute(key)) - } -} - -processResources { - from ("${projectDir}/LICENSE") { - into 'licenses/' - } -} - -tasks.register("copyDependencies", Copy) { - description "Copy dependencies into the build directory for use elsewhere" - group "QuPath" - - from configurations.default - into 'build/libs' -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(qupathJavaVersion) - } - withSourcesJar() - withJavadocJar() -} - -tasks.withType(Javadoc) { - options.encoding = 'UTF-8' - def strictJavadoc = findProperty('strictJavadoc') - if (!strictJavadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } -} - -tasks.named('compileJava') { - options.encoding = 'UTF-8' -} - -tasks.withType(org.gradle.jvm.tasks.Jar) { - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -tasks.named('test') { - useJUnitPlatform() -} - -repositories { - mavenCentral() - - maven { - url "https://maven.scijava.org/content/repositories/releases" - } - - maven { - url "https://maven.scijava.org/content/repositories/snapshots" - } - - maven { - name "ome.maven" - url "https://artifacts.openmicroscopy.org/artifactory/maven" - } - - maven { - name "unidata.releases<" - url "https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases" - } -} - -publishing { - repositories { - maven { - name = "SciJava" - def releasesRepoUrl = uri("https://maven.scijava.org/content/repositories/releases") - def snapshotsRepoUrl = uri("https://maven.scijava.org/content/repositories/snapshots") - // Use gradle -Prelease publish - url = project.hasProperty('release') ? releasesRepoUrl : snapshotsRepoUrl - credentials { - username = System.getenv("MAVEN_USER") - password = System.getenv("MAVEN_PASS") - } - } - } - - publications { - mavenJava(MavenPublication) { - from components.java - - pom { - licenses { - license { - name = 'Apache License v2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0' - } - } - } - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..b6b5eaf --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,154 @@ +plugins { + // Main gradle plugin for building a Java library + id("java-library") + id("maven-publish") + // To create a shadow/fat jar that bundle up all dependencies + id("com.github.johnrengelman.shadow") version "8.1.1" + // Add JavaFX dependencies + alias(libs.plugins.javafx) + // Version in settings.gradle + id("org.bytedeco.gradle-javacpp-platform") +} + +extra["moduleName"] = "qupath.extension.omero" +version = "0.1.1-rc1" +description = "QuPath extension to support image reading using OMERO APIs." +group = "io.github.qupath" +extra["qupathVersion"] = gradle.extra["qupathVersion"] +extra["qupathJavaVersion"] = libs.versions.jdk.get() + +dependencies { + shadow("io.github.qupath:qupath-gui-fx:${project.extra["qupathVersion"]}") + shadow("io.github.qupath:qupath-extension-bioformats:${project.extra["qupathVersion"]}") + shadow(libs.qupath.fxtras) + shadow(libs.guava) + + shadow(libs.slf4j) + + // Auto-discover if OMERO-Gateway is available + shadow("org.openmicroscopy:omero-gateway:5.8.2") + + testImplementation("io.github.qupath:qupath-gui-fx:${project.extra["qupathVersion"]}") + testImplementation("io.github.qupath:qupath-extension-bioformats:${project.extra["qupathVersion"]}") + testImplementation("org.openmicroscopy:omero-gateway:5.8.2") + testImplementation(libs.junit) + testImplementation("org.testcontainers:testcontainers:1.19.1") + testImplementation("org.testcontainers:junit-jupiter:1.19.1") +} + +tasks.withType { + manifest { + attributes(mapOf( + "Implementation-Title" to project.name, + "Implementation-Version" to archiveVersion, + "Automatic-Module-Name" to project.extra["moduleName"] + )) + } +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(project.extra["qupathJavaVersion"] as String)) + } + withSourcesJar() + withJavadocJar() +} + +/** + * Copy necessary attributes, see + * - https://github.com/qupath/qupath-extension-template/issues/9 + * - https://github.com/openjfx/javafx-gradle-plugin#variants + */ +configurations.shadow { + val runtimeAttributes = configurations.runtimeClasspath.get().attributes + runtimeAttributes.keySet().forEach { key -> + attributes.attribute(key as Attribute, runtimeAttributes.getAttribute(key) as Any) + } +} + +tasks.processResources { + from ("${projectDir}/LICENSE") { + into("licenses/") + } +} + +tasks.register("copyDependencies") { + description = "Copy dependencies into the build directory for use elsewhere" + group = "QuPath" + + from(configurations.default) + into("build/libs") +} + +tasks.withType { + options.encoding = "UTF-8" + if (findProperty("strictJavadoc") == null) { + (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") + } +} + +tasks.named("compileJava") { + options.encoding = "UTF-8" +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.INCLUDE +} + +tasks.named("test") { + useJUnitPlatform() +} + +repositories { + mavenCentral() + + maven { + url = uri("https://maven.scijava.org/content/repositories/releases") + } + + maven { + url = uri("https://maven.scijava.org/content/repositories/snapshots") + } + + maven { + name = "ome.maven" + url = uri("https://artifacts.openmicroscopy.org/artifactory/maven") + } + + maven { + name = "unidata.releases<" + url = uri("https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases") + } +} + +publishing { + repositories { + maven { + name = "SciJava" + val releasesRepoUrl = uri("https://maven.scijava.org/content/repositories/releases") + val snapshotsRepoUrl = uri("https://maven.scijava.org/content/repositories/snapshots") + // Use gradle -Prelease publish + url = if (project.hasProperty("release")) releasesRepoUrl else snapshotsRepoUrl + credentials { + username = System.getenv("MAVEN_USER") + password = System.getenv("MAVEN_PASS") + } + } + } + + publications { + create("mavenJava") { + from(components["java"]) + + pom { + licenses { + license { + name = "Apache License v2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0" + } + } + } + } + } +} + diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index b92988c..0000000 --- a/settings.gradle +++ /dev/null @@ -1,31 +0,0 @@ -pluginManagement { - plugins { - id 'org.bytedeco.gradle-javacpp-platform' version '1.5.9' - } -} - -rootProject.name = 'qupath-extension-omero' - -gradle.ext.qupathVersion = "0.6.0-SNAPSHOT" - -dependencyResolutionManagement { - versionCatalogs { - libs { - from("io.github.qupath:qupath-catalog:${gradle.ext.qupathVersion}") - } - } - - repositories { - - mavenCentral() - - maven { - url "https://maven.scijava.org/content/repositories/releases" - } - - maven { - url "https://maven.scijava.org/content/repositories/snapshots" - } - - } -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..939d3e0 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,30 @@ +pluginManagement { + plugins { + kotlin("org.bytedeco.gradle-javacpp-platform") version "1.5.9" + } +} + +rootProject.name = "qupath-extension-omero" + +extra["qupathVersion"] = "0.6.0-SNAPSHOT" + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from("io.github.qupath:qupath-catalog:${extra["qupathVersion"]}") + } + } + + repositories { + mavenCentral() + + maven { + url = uri("https://maven.scijava.org/content/repositories/releases") + } + + maven { + url = uri("https://maven.scijava.org/content/repositories/snapshots") + } + + } +}