generated from qupath/qupath-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
161 lines (138 loc) · 4.91 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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'
// So that we can install the project into the local Maven repository cache,
// so that it can be depended upon by other local projects.
id 'maven-publish'
}
// Change the module name
ext.moduleName = 'qupath.extension.BasicStitchingExtension'
group = 'qupath.ext.basicstitching'
// TODO: Define the extension version & provide a short description
version = "0.1.0"
description = 'A basic QuPath extension for stitching.'
// 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 = 17
/**
* Define dependencies.
* - Using 'shadow' indicates that they are already part of QuPath, so you don't need
* to include them in your extension. If creating a single 'shadow jar' containing your
* extension and all dependencies, these won't be added.
* - Using 'implementation' indicates that you need the dependency for the extension to work,
* and it isn't part of QuPath already. If you are creating a single 'shadow jar', the
* dependency should be bundled up in the extension.
* - Using 'testImplementation' indicates that the dependency is only needed for testing,
* but shouldn't be bundled up for use in the extension.
*/
dependencies {
// Main QuPath user interface jar.
// Automatically includes other QuPath jars as sub-dependencies.
shadow "io.github.qupath:qupath-gui-fx:${qupathVersion}"
//Access to BioFormats extension for writing ome.tif files
implementation "io.github.qupath:qupath-extension-bioformats:${qupathVersion}"
// For logging - the version comes from QuPath's version catalog at
// https://github.com/qupath/qupath/blob/main/gradle/libs.versions.toml
// See https://docs.gradle.org/current/userguide/platforms.html
shadow libs.slf4j
// If you aren't using Groovy, this can be removed
shadow libs.bundles.groovy
testImplementation "io.github.qupath:qupath-gui-fx:${qupathVersion}"
testImplementation libs.junit
}
/*
* Manifest info
*/
jar {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Version": archiveVersion,
"Automatic-Module-Name": moduleName)
}
}
/*
* 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 11 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
}
/*
* Support tests with JUnit.
*/
tasks.named('test') {
useJUnitPlatform()
}
// 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 {
// Add this if you need access to dependencies only installed locally
// mavenLocal()
mavenCentral()
// Add scijava - which is where QuPath's jars are hosted
// Needed for ome:formats-gpl dependency.
maven {
url "https://maven.scijava.org/content/groups/public"
}
}
publishing {
publications {
myLibrary(MavenPublication) {
from components.java
}
}
}