-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
executable file
·358 lines (301 loc) · 13.1 KB
/
Copy pathbuild.gradle
File metadata and controls
executable file
·358 lines (301 loc) · 13.1 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/*
* Copyright (c) 2021 German Cancer Research Center (DKFZ).
*
* Distributed under the MIT License (license terms are at https://www.github.com/theroddywms/Roddy/LICENSE.txt).
*/
// TODO Put git short hash into manifests
import org.cyclonedx.gradle.CycloneDxTask
import org.gradle.api.artifacts.DependencyResolveDetails
import org.gradle.api.artifacts.Configuration
plugins {
id 'org.ajoberstar.grgit' version '4.1.1' // Apache 2.0
id 'idea'
id 'pmd'
id 'org.cyclonedx.bom' version '1.10.0'
id 'maven-publish'
id 'org.asciidoctor.jvm.convert' version '4.0.2' // Apache 2.0
id 'application'
id 'distribution'
id 'groovy'
}
group = "com.github.theroddywms"
/**
* -PignoreFailedTests Continue despite failed tests.
* -PallowDirtyRepo=true Continue release despite dirty repo.
* -Pchecked=false Turn off -F Xlint:unchecked
*/
ext.allowDirtyRepo = (project.hasProperty("allowDirty") && project.allowDirty == "true")
application {
mainClass.set("de.dkfz.roddy.Roddy")
}
// Java settings
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// toolchain {
// languageVersion = JavaLanguageVersion.of(8)
// }
}
compileJava {
options.fork = true
options.compilerArgs = ["-release", targetCompatibility]
}
// Set -Pchecked={true,false} on the command line to change this compiler parameter. Default: unchecked
if (project.hasProperty("checked") && !project.checked) {
compileJava.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
compileGroovy.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
}
// The following keeps the Gradle build files separate from the ones build by IntelliJ (usually in build/).
rootProject.layout.buildDirectory = "${projectDir}/gradleBuild"
/*
* Gets the version name from the current Git tag. If the current commit is not tagged,
* this returned string will indicate that. Also if the repository is dirty
*/
def getVersionName() {
String dirtySuffix = grgit.status().isClean() ? '' : '-dirty'
String headCommit = grgit.head().id
def tagsAtHead = grgit.tag.list().findAll { it.commit.id == headCommit }
if (tagsAtHead.size() == 0) {
// If the current commit is not tagged, just use the describe output with a dirty suffix.
return grgit.describe() + dirtySuffix
} else if (tagsAtHead.size() > 1) {
// If there are multiple tags, then we cannot decide which one to use.
System.err.println("Warning: Multiple tags found at HEAD: " + tagsAtHead.collect { it.name }.join(", "))
System.exit(1)
} else {
// Exactly one tag found, use it. We cannot use git describe here, because that would only
// work for annotated tags, but we want it to work also with lightweight tags.
return tagsAtHead.first().name + dirtySuffix
}
}
rootProject.version = getVersionName()
System.err.println("Building Roddy version ${rootProject.version}")
test {
workingDir = projectDir
ignoreFailures = project.hasProperty("ignoreFailedTests")
testLogging {
events "failed", "skipped", "passed"
exceptionFormat "full"
showStandardStreams = true
}
}
repositories {
mavenCentral() // Most dependencies
maven { url 'https://jitpack.io' } // Github: RoddyToolLib, BatchEuphoria
maven { url "https://repo1.maven.org/maven2/" } // Some of the remaining dependencies
}
ext.roddyToolLibVersion = "2.5.0"
ext.batchEuphoriaVersion = "0.2.1"
ext.jschVersion = "0.0.9"
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, 'seconds')
resolutionStrategy.cacheDynamicVersionsFor(0, 'seconds')
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// details.useVersion is null, if Roddy is build in a multi-project build with dependency substitution.
// In this situation the substituted version-less development version has higher priority than the
// version configured via roddyToolLibVersion.
if (details.requested.name == "RoddyToolLib") {
details.useVersion(roddyToolLibVersion)
details.because("BatchEuphoria not affected by RoddyToolLib ${roddyToolLibVersion} API changes.")
}
}
}
dependencies {
implementation "com.github.theroddywms:RoddyToolLib:$roddyToolLibVersion" // MIT
implementation "com.github.theroddywms:BatchEuphoria:$batchEuphoriaVersion" // MIT
implementation 'org.codehaus.groovy:groovy-all:2.4.21' // Apache 2.0
// Note: When updating SSHJ, check the BC version in its dependencies! E.g.
// https://github.com/hierynomus/sshj/blob/master/build-publishing.gradle
implementation 'org.bouncycastle:bcpg-jdk15on:1.70' // MIT
implementation 'org.bouncycastle:bcpkix-jdk15on:1.70' // MIT
implementation 'org.bouncycastle:bcprov-ext-jdk15on:1.70' // MIT
implementation 'org.bouncycastle:bcprov-jdk15on:1.70' // MIT
implementation 'com.google.guava:guava:33.2.1-jre' // Apache 2.0
implementation 'org.apache.commons:commons-csv:1.9.0' // Apache 2.0
implementation 'commons-cli:commons-cli:1.5.0' // Apache 2.0
implementation 'commons-codec:commons-codec:1.15' // Apache 2.0
implementation 'commons-io:commons-io:2.14.0' // Apache 2.0
implementation 'commons-logging:commons-logging:1.2' // Apache 2.0
implementation 'com.jcraft:jzlib:1.1.3' // BSD
implementation 'org.bidib.com.github.markusbernhardt:proxy-vole:1.0.16' // Apache 2.0
implementation 'org.reflections:reflections:0.10.2'
implementation 'org.slf4j:slf4j-api:2.0.4' // MIT
implementation 'org.slf4j:slf4j-nop:2.0.4' // MIT
implementation 'com.hierynomus:sshj:0.38.0' // Apache 2.0
implementation 'net.vrallev.ecc:ecc-25519-java:1.0.3'
// Apache 2.0; elliptic curve cryptography (ECC) with Curve25519
implementation 'net.i2p.crypto:eddsa:0.3.0' // CC0 1.0 Universal; Ed25519
implementation "com.jcraft:jsch.agentproxy.jsch:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.pageant:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.sshj:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.usocket-nc:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.usocket-jna:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.connector-factory:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation "com.jcraft:jsch.agentproxy.sshagent:$jschVersion" // BSD-style, http://www.jcraft.com/jsch-agent-proxy/LICENSE.txt
implementation 'com.github.petitparser.java-petitparser:petitparser-core:2.2.0' // MIT
// Testing libraries
testImplementation 'junit:junit:4.13.2' // EPL 1.0
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.4' // Apache 2.0
testImplementation 'net.bytebuddy:byte-buddy:1.14.9' // Apache 2.0
testImplementation 'org.objenesis:objenesis:3.3' // Apache 2.0
// Runtime retention of @NotNull and annotations. Unfortunately, this only works for compilation by IntelliJ.
// For compilation by Gradle, we need to use an annotation processor, like SpotBugs, FindBugs, etc.
// Groovy's own @NullCheck annotation is only availabel for Groovy >= 3.
// The annotation is only used for communication.
implementation 'com.github.bbottema:jetbrains-runtime-annotations:1.0.1' // Apache 2.0
}
project.ext.developmentDistributionDir = new File(rootProject.projectDir, "dist/bin/develop")
project.ext.releaseDir = new File(project.ext.developmentDistributionDir,
"../" + rootProject.version).absoluteFile
sourceSets {
main {
groovy {
setSrcDirs(["${projectDir}/RoddyCore/src"])
}
}
test {
groovy {
setSrcDirs(["${projectDir}/RoddyCore/test/src"])
}
resources {
setSrcDirs(["${projectDir}/RoddyCore/test/resources"])
}
}
}
project.ext.librariesDirectory = new File(project.ext.developmentDistributionDir, "lib")
tasks.register("cleanRuntimeLibs", Delete) {
delete fileTree(dir: librariesDirectory, exclude: ".keep")
}
clean.dependsOn(cleanRuntimeLibs)
tasks.register("copyRuntimeLibs", Copy) {
dependsOn cleanRuntimeLibs
into librariesDirectory
from configurations.runtimeClasspath
}
jar {
archiveBaseName = "Roddy"
archiveClassifier = ""
archiveVersion = ""
destinationDirectory = layout.projectDirectory.dir(project.ext.developmentDistributionDir.absolutePath)
manifest {
attributes("Implementation-Vendor": "German Cancer Research Center (DKFZ)")
attributes 'Main-Class': application.mainClass.get()
attributes("Implementation-Title": archiveBaseName.get())
attributes 'Implementation-Version': rootProject.version
}
dependsOn copyRuntimeLibs
}
clean.doLast {
File jarFile = new File(project.ext.developmentDistributionDir, "Roddy.jar")
if (jarFile.exists()) {
jarFile.delete()
}
}
/** Produce 2 distribution packages:
*
* * Roddy-*.zip with everything that belongs into the dist/bin/develop directory & some other smaller files.
* * RoddyEnv-*.zip with the runtime environment, starter script, etc.
*/
distributions {
// IMPORTANT: When potentially changing the name of the zips, please check that the
// expression in the CI (CircleCI, GitLab-CI) that checks the consistency of
// version numbers still works!
roddy {
distributionBaseName = "Roddy"
contents {
into(rootProject.version)
from(project.ext.developmentDistributionDir) {
include("**")
}
from("./") {
include("LICENSE")
include("CONTRIBUTORS.md")
include("3RDPARTY_LICENSES")
include("CHANGELIST.md")
}
from ("RoddyCore/") {
include("buildversion.txt")
}
}
}
roddyEnvironment {
distributionBaseName = "RoddyEnv"
contents {
from("./") {
include("roddy.sh")
include("README.md")
include("LICENSE")
include("CONTRIBUTORS.md")
include("3RDPARTY_LICENSES")
include("CHANGELIST.md")
include("dist/bin")
include("dist/runtime")
include("dist/plugins")
}
}
}
}
roddyDistTar.dependsOn(jar)
roddyDistZip.dependsOn(jar)
asciidoctor {
sourceDir = file("${project.projectDir}/docs/")
sources {
include 'README.adoc', 'users/README.adoc', 'developers/README.adoc'
}
outputDir = file("${rootProject.layout.buildDirectory.get()}/site/")
baseDirFollowsSourceFile()
}
plugins.withType(PmdPlugin) {
pmd {
ignoreFailures = true
toolVersion = "6.55.0" // Specify a compatible version
incrementalAnalysis = true
}
tasks.withType(Pmd) {
reports {
xml.required = true
html.required = true
}
}
}
//codenarc {
// toolVersion = "1.2.1"
// ignoreFailures = true
//}
//
//codenarcMain {
// configFile = project.file("config/codenarc/codenarc.groovy")
//}
//
//codenarcTest {
// configFile = project.file("config/codenarc/codenarc.groovy")
//}
tasks.register("listConfigurations") {
group = "reporting"
description = "List all configurations, as needed for discerning development and production configurations by the SBOM tasks."
doLast {
configurations.each { Configuration c ->
println c.name
}
}
}
tasks.register("allBoms") {
group = "reporting"
description = "A grouping task to execute the CycloneDxTask for each configuration"
}
configurations.configureEach { Configuration configuration ->
String name = configuration.name
tasks.register("${name}Bom", CycloneDxTask) {
group = "reporting"
description = "Creates a CycloneDX SBOM for the configuration ${name}."
destination = file("${rootProject.layout.buildDirectory.get()}/reports/cyclonedx")
outputName = name
includeConfigs = [name]
schemaVersion = "1.5"
outputFormat="json"
includeLicenseText = false
projectType = "application"
}
allBoms.dependsOn tasks.named("${name}Bom")
}
// end of build.gradle