Skip to content

Commit 8a8cebe

Browse files
author
Carlo Castoldi
committed
use Kotlin & QuPath Gradle plugin
see: qupath/qupath-extension-template/pull/21
1 parent 4ede1b2 commit 8a8cebe

File tree

9 files changed

+122
-243
lines changed

9 files changed

+122
-243
lines changed

.github/workflows/jpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
- name: REUSE Compliance Check
2525
uses: fsfe/reuse-action@v3
2626

27-
- name: Set up JDK 17
27+
- name: Set up JDK 21
2828
uses: actions/setup-java@v4
2929
with:
30-
java-version: 17
30+
java-version: 21
3131
distribution: temurin
3232

3333
- name: Validate Gradle wrapper

build.gradle

Lines changed: 0 additions & 176 deletions
This file was deleted.

build.gradle.kts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// SPDX-FileCopyrightText: 2024 Carlo Castoldi <carlo.castoldi@outlook.com>
2+
//
3+
// SPDX-License-Identifier: CC0-1.0
4+
5+
import java.io.ByteArrayOutputStream
6+
7+
plugins {
8+
// QuPath Gradle extension convention plugin
9+
id("qupath-conventions")
10+
// To optionally create a shadow/fat jar that bundle up any non-core dependencies
11+
id("com.gradleup.shadow") version "8.3.5"
12+
jacoco
13+
}
14+
15+
qupathExtension {
16+
name = "qupath-extension-braian"
17+
group = "io.github.qupath"
18+
version = "1.1.0-SNAPSHOT"
19+
description = "QuPath extension for whole-brain data extraction"
20+
automaticModule = "qupath.extension.braian"
21+
}
22+
23+
dependencies {
24+
// Main dependencies for most QuPath extensions
25+
shadow(libs.bundles.qupath)
26+
shadow(libs.bundles.logging)
27+
shadow(libs.qupath.fxtras)
28+
shadow(libs.snakeyaml)
29+
30+
// For testing
31+
testImplementation(libs.bundles.qupath)
32+
testImplementation(libs.junit)
33+
testImplementation("org.mockito:mockito-core:5.+")
34+
}
35+
36+
tasks.test {
37+
finalizedBy(tasks.jacocoTestReport)
38+
}
39+
40+
tasks.jacocoTestReport {
41+
dependsOn(tasks.test) // tests are required to run before generating the report
42+
reports {
43+
csv.required = true
44+
}
45+
doLast {
46+
print("INSTRUCTIONS: " + printJacocoCoverage("3"))
47+
println(" BRANCHES: " + printJacocoCoverage("5"))
48+
}
49+
}
50+
51+
tasks.jacocoTestCoverageVerification {
52+
violationRules {
53+
rule {
54+
limit {
55+
minimum = "0.8".toBigDecimal()
56+
}
57+
}
58+
}
59+
}
60+
61+
fun printJacocoCoverage(xpath: String): String {
62+
val jacocoCoverage = ByteArrayOutputStream()
63+
exec {
64+
commandLine("xmllint","-html","-xpath", "//tfoot//td["+xpath+"]/text()", "build/reports/jacoco/test/html/index.html")
65+
standardOutput = jacocoCoverage
66+
isIgnoreExitValue = true
67+
}
68+
return jacocoCoverage.toString()
69+
}

gradle/wrapper/gradle-wrapper.jar

121 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# SPDX-FileCopyrightText: 2024 Carlo Castoldi <carlo.castoldi@outlook.com>
2-
#
3-
# SPDX-License-Identifier: CC0-1.0
4-
5-
# Fri Aug 16 16:08:32 CEST 2024
61
distributionBase=GRADLE_USER_HOME
72
distributionPath=wrapper/dists
8-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
94
networkTimeout=10000
105
validateDistributionUrl=true
116
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)