diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 13b0e91..2a01281 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -24,10 +24,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 # TODO: check Java version uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8057f78 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Make draft release + +on: + push: + tags: ["v*"] + workflow_dispatch: + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Define version env variable + run: | + echo "VERSION=$(echo ${{ github.ref_name }} | sed -r 's/v([0-9]+\.[0-9]+\.?[0-9]?)/\1/'" >> $GITHUB_ENV + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1.1.0 + - name: Build with Gradle + uses: gradle/gradle-build-action@v2.7.1 + with: + arguments: build -Pversion=$VERSION + - name: Release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create --draft ${{ github.ref_name }} --title ${{ github.ref_name }} build/libs/* diff --git a/build.gradle b/build.gradle index 483cd85..ea141ff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,28 +1,29 @@ plugins { - // Main gradle plugin for building a Java library - id 'java-library' - // Support writing the extension in Groovy (remove this if you don't want to) - id 'groovy' - // To create a shadow/fat jar that bundle up all dependencies - id 'com.github.johnrengelman.shadow' version '7.1.2' - // Include this plugin to avoid downloading JavaCPP dependencies for all platforms - id 'org.bytedeco.gradle-javacpp-platform' + // Main gradle plugin for building a Java library + id 'java-library' + // Support writing the extension in Groovy (remove this if you don't want to) + id 'groovy' + // To create a shadow/fat jar that bundle up all dependencies + 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' } // TODO: Change the module name ext.moduleName = 'io.github.qupath.extension.template' // TODO: Define the extension version & provide a short description -version = "0.1.0-SNAPSHOT" description = 'A simple QuPath extension template' + // TODO: Specify the QuPath version, compatible with the extension. // The default 'gradle.ext.qupathVersion' reads this from settings.gradle. ext.qupathVersion = gradle.ext.qupathVersion // TODO: Specify the Java version compatible with the extension -// Generally 11 for QuPath v0.4.3, but will be 17 for QuPath v0.5.0 -ext.qupathJavaVersion = 11 +// Should be Java 17 for QuPath v0.5.0 +ext.qupathJavaVersion = 17 /** * Define dependencies. @@ -86,7 +87,7 @@ tasks.register("copyDependencies", Copy) { } /* - * Ensure Java 11 compatibility, and include sources and javadocs when building. + * Ensure Java 17 compatibility, and include sources and javadocs when building. */ java { toolchain { @@ -148,4 +149,4 @@ repositories { url "https://maven.scijava.org/content/repositories/snapshots" } -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..249e583 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 ae04661..a595206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index d4625d8..ed3fa38 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,7 @@ pluginManagement { // 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.8' + id 'org.bytedeco.gradle-javacpp-platform' version '1.5.9' } } @@ -14,7 +14,7 @@ rootProject.name = 'my-qupath-extension' // TODO: Define the QuPath version compatible with the extension // Note that the QuPath API isn't stable; something designed for // 0.X.a should work with 0.X.b, but not necessarily with 0.Y.a. -gradle.ext.qupathVersion = "0.4.3" +gradle.ext.qupathVersion = "0.5.0" dependencyResolutionManagement { @@ -39,4 +39,4 @@ dependencyResolutionManagement { } } -} \ No newline at end of file +} diff --git a/src/main/java/qupath/ext/template/DemoExtension.java b/src/main/java/qupath/ext/template/DemoExtension.java index 5759607..07de097 100644 --- a/src/main/java/qupath/ext/template/DemoExtension.java +++ b/src/main/java/qupath/ext/template/DemoExtension.java @@ -7,6 +7,7 @@ import qupath.lib.common.Version; import qupath.lib.gui.QuPathGUI; import qupath.lib.gui.dialogs.Dialogs; +import qupath.lib.gui.extensions.GitHubProject; import qupath.lib.gui.extensions.QuPathExtension; import qupath.lib.gui.prefs.PathPrefs; @@ -23,25 +24,38 @@ * /resources/META-INF/services/qupath.lib.gui.extensions.QuPathExtension * */ -public class DemoExtension implements QuPathExtension { +public class DemoExtension implements QuPathExtension, GitHubProject { private static final Logger logger = LoggerFactory.getLogger(DemoExtension.class); /** * Display name for your extension + * TODO: define this */ private static final String EXTENSION_NAME = "My Java extension"; /** * Short description, used under 'Extensions > Installed extensions' + * TODO: define this */ private static final String EXTENSION_DESCRIPTION = "This is just a demo to show how extensions work"; /** * QuPath version that the extension is designed to work with. * This allows QuPath to inform the user if it seems to be incompatible. + * TODO: define this */ - private static final Version EXTENSION_QUPATH_VERSION = Version.parse("v0.4.0"); + private static final Version EXTENSION_QUPATH_VERSION = Version.parse("v0.5.0"); + + /** + * GitHub repo that your extension can be found at. + * This makes it easier for users to find updates to your extension. + * If you don't want to support this feature, you can remove + * references to GitHubRepo and GitHubProject from your extension. + * TODO: define this + */ + private static final GitHubRepo EXTENSION_REPOSITORY = GitHubRepo.create( + EXTENSION_NAME, "myGitHubUserName", "myGitHubRepo"); /** * Flag whether the extension is already installed (might not be needed... but we'll do it anyway) @@ -109,4 +123,8 @@ public Version getQuPathVersion() { return EXTENSION_QUPATH_VERSION; } + @Override + public GitHubRepo getRepository() { + return EXTENSION_REPOSITORY; + } }