diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 5de0518..0000000 --- a/build.gradle +++ /dev/null @@ -1,162 +0,0 @@ -plugins { - id 'java-library' - id 'maven-publish' - id 'com.github.johnrengelman.shadow' version '8.1.1' - // Include this plugin to avoid downloading JavaCPP dependencies for all platforms - id 'org.bytedeco.gradle-javacpp-platform' - id 'org.openjfx.javafxplugin' version '0.1.0' -} - -ext.moduleName = 'qupath.extension.py4j' - -base { - archivesName = rootProject.name - version = '0.1.0-SNAPSHOT' - description = 'Connect QuPath to Python using Py4J' - group = 'io.github.qupath' -} - -ext.qupathVersion = gradle.ext.qupathVersion -ext.qupathJavaVersion = libs.versions.jdk.get() as Integer - -dependencies { - shadow "io.github.qupath:qupath-gui-fx:${qupathVersion}" - - shadow libs.slf4j - shadow libs.qupath.fxtras - shadow libs.ikonli.javafx - shadow libs.guava - - implementation 'net.sf.py4j:py4j:0.10.9.7' -} - - -/* - * Manifest info - */ -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)) - } -} - -/* - * Copy the LICENSE file into the jar... if we have one (we should!) - */ -processResources { - from ("${projectDir}/LICENSE") { - into 'licenses/' - } -} - -/* - * Define extra 'copyDependencies' task to copy dependencies into the build directory. - */ -tasks.register("copyDependencies", Copy) { - description "Copy dependencies into the build directory for use elsewhere" - group "QuPath" - - from configurations.default - into 'build/libs' -} - -/* - * Ensure Java compatibility, and include sources and javadocs when building. - */ -java { - toolchain { - languageVersion = JavaLanguageVersion.of(qupathJavaVersion) - } - withSourcesJar() - withJavadocJar() -} - -/* - * Create javadocs for all modules/packages in one place. - * Use -PstrictJavadoc=true to fail on error with doclint (which is rather strict). - */ -tasks.withType(Javadoc).configureEach { - options.encoding = 'UTF-8' - def strictJavadoc = findProperty('strictJavadoc') - if (!strictJavadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } -} - -/* - * Specify that the encoding should be UTF-8 for source files - */ -tasks.named('compileJava') { - options.encoding = 'UTF-8' -} - -/* - * Avoid 'Entry .gitkeep is a duplicate but no duplicate handling strategy has been set.' - * when using withSourcesJar() - */ -tasks.withType(org.gradle.jvm.tasks.Jar).configureEach { - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} - -// Looks redundant to include this here and in settings.gradle, -// but helps overcome some gradle trouble when including this as a subproject -// within QuPath itself (which is useful during development). -repositories { - mavenCentral() - - // Add scijava - which is where QuPath's jars are hosted - maven { - url "https://maven.scijava.org/content/repositories/releases" - } - - maven { - url "https://maven.scijava.org/content/repositories/snapshots" - } -} - - -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..a1bc24e --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,59 @@ +plugins { + id("qupath-conventions") + id("com.gradleup.shadow") version "8.3.5" + `maven-publish` +} + +qupathExtension { + name = "qupath-extension-py4j" + version = "0.1.0-SNAPSHOT" + group = "io.github.qupath" + description = "Connect QuPath to Python using Py4J" + automaticModule = "qupath.extension.py4j" +} + +dependencies { + + shadow(libs.bundles.qupath) + shadow(libs.bundles.logging) + shadow(libs.qupath.fxtras) + shadow(libs.ikonli.javafx) + shadow(libs.guava) + + implementation("net.sf.py4j:py4j:0.10.9.7") + + // For testing + testImplementation(libs.bundles.qupath) + testImplementation(libs.junit) + +} + +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 = "https://www.apache.org/licenses/LICENSE-2.0" + } + } + } + } + } +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index df97d72..e2847c8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 6689b85..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index b9fba39..0000000 --- a/settings.gradle +++ /dev/null @@ -1,37 +0,0 @@ -pluginManagement { - plugins { - // Gradle is awkward about declaring versions for plugins - // Specifying it here, rather than build.gradle, makes it possible - // to include the extension as a subproject of QuPath itself - // (which is useful during development) - id 'org.bytedeco.gradle-javacpp-platform' version '1.5.9' - } -} -rootProject.name = 'qupath-extension-py4j' - -gradle.ext.qupathVersion = "0.6.0-SNAPSHOT" - -dependencyResolutionManagement { - - // Access QuPath's version catalog for dependency versions - versionCatalogs { - libs { - from("io.github.qupath:qupath-catalog:${gradle.ext.qupathVersion}") - } - } - - repositories { - - mavenCentral() - - // Add scijava - which is where QuPath's jars are hosted - 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..12d007b --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + url = uri("https://maven.scijava.org/content/repositories/releases") + } + } +} + +qupath { + version = "0.6.0-SNAPSHOT" +} + +// Apply QuPath Gradle settings plugin to handle configuration +plugins { + id("io.github.qupath.qupath-extension-settings") version "0.2.1" +}