Skip to content

Commit

Permalink
Merge pull request #8 from alanocallaghan/0.5.0
Browse files Browse the repository at this point in the history
0.5.0
  • Loading branch information
petebankhead authored Dec 1, 2023
2 parents 8c47996 + 484e8b5 commit 45df6ac
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/*
27 changes: 14 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -148,4 +149,4 @@ repositories {
url "https://maven.scijava.org/content/repositories/snapshots"
}

}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand All @@ -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 {

Expand All @@ -39,4 +39,4 @@ dependencyResolutionManagement {
}

}
}
}
22 changes: 20 additions & 2 deletions src/main/java/qupath/ext/template/DemoExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -23,25 +24,38 @@
* /resources/META-INF/services/qupath.lib.gui.extensions.QuPathExtension
* </pre>
*/
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)
Expand Down Expand Up @@ -109,4 +123,8 @@ public Version getQuPathVersion() {
return EXTENSION_QUPATH_VERSION;
}

@Override
public GitHubRepo getRepository() {
return EXTENSION_REPOSITORY;
}
}

0 comments on commit 45df6ac

Please sign in to comment.