-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
150 lines (127 loc) · 4.37 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
plugins {
// Main gradle plugin for building a Java library
id 'java-library'
// 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'
// Include JavaFX dependencies
alias(libs.plugins.javafx)
}
// TODO: Change the module name
ext.moduleName = 'org.elephant.sam.qupath'
// TODO: Define the extension version & provide a short description
version = "0.7.0"
description = 'QuPath extension for Segment Anything Model (SAM)'
// 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 subdependencies.
shadow "io.github.qupath:qupath-gui-fx:${qupathVersion}"
// QuPath FX utils
shadow libs.qupath.fxtras
// 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
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) {
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) {
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
maven {
url "https://maven.scijava.org/content/repositories/releases"
}
maven {
url "https://maven.scijava.org/content/repositories/snapshots"
}
}