-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
134 lines (112 loc) · 3.8 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
buildscript {
dependencies {
classpath "com.google.guava:guava:31.0.1-jre"
}
}
plugins {
id "com.github.spotbugs" version "5.0.3"
//dependency updates
id "com.github.ben-manes.versions" version "0.40.0"
id "pmd"
id "java"
id "eclipse"
//brings versionDetails
id "com.palantir.git-version" version "0.12.3"
// formatting
id "com.diffplug.spotless" version "6.1.0"
id "jacoco"
// CVE check
id "org.owasp.dependencycheck" version "6.5.1"
id "org.ajoberstar.grgit" version "4.1.1"
// lint build
id "nebula.lint" version "17.5.0"
id "nebula.resolution-rules" version "9.0.0"
}
repositories {
gradlePluginPortal()
mavenCentral()
}
def parseVersion = {
def versionName = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '--format=%cd-%h', '--date=format:%y.%m%d', '-n', '1'
standardOutput = versionName
}
def gitDetails = versionDetails()
version = versionName.toString().trim()
if (gitDetails.branchName != null && gitDetails.branchName != 'master') {
version = "dev-" + version + "-" + gitDetails.branchName
}
def dirty = ""
status = new ByteArrayOutputStream()
exec {
commandLine 'git', 'status', '--porcelain'
standardOutput = status
}
if (status.toString().trim().length() > 0) {
dirty = "-DIRTY"
}
version = version + dirty
return version
}
ext {
buildScripts="$projectDir/buildSrc"
//make sure these files exist
jdtInputFile="${buildScripts}/template/for/eclipse/org.eclipse.jdt.core.prefs"
distributionDir="$buildDir/distributions"
artifactVersion = parseVersion()
distributionExcludes = ["*-lib.jar"]
distributionBasename = 'völundr-distribution'
slf4jVersion="1.7.32"
log4jVersion="1.2.17"
junitVersion="4.13.2"
commonsIoVersion="2.11.0"
commonsCollectionsVersion="3.2.2"
jfreechartVersion="1.5.3"
spotbugsVersion="4.5.2"
}
apply plugin : "volundr.build-conventions"
apply plugin : "volundr.lint-conventions"
apply plugin : "volundr.dependencycheck-conventions"
apply plugin : "volundr.dependencyupdates-conventions"
subprojects {
apply plugin : "volundr.library-conventions"
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) { task ->
task.reports {
xml.enabled = project.hasProperty('CI') && "${CI}".toBoolean()
}
task.reports {
html.enabled = !(project.hasProperty('CI') && "${CI}".toBoolean())
}
}
}
/*
Don't put {} around subprojects.findAll(), it'll be resolved totally different way
*/
def publishedProjects = subprojects.findAll()
task jacocoMerge(type: JacocoMerge) {
destinationFile = file("${buildDir}/jacoco/merged.exec")
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
task jacocoAggregateReport(type: JacocoReport, group: 'Coverage reports') { rep ->
description = 'Generates an aggregate report from all subprojects'
dependsOn publishedProjects.test, jacocoMerge
additionalSourceDirs.setFrom(files(publishedProjects.sourceSets.main.allSource.srcDirs))
sourceDirectories.setFrom(files(publishedProjects.sourceSets.main.allSource.srcDirs))
classDirectories.setFrom(files(publishedProjects.sourceSets.main.output))
executionData.setFrom(jacocoMerge.destinationFile)
reports {
html.enabled = true // human readable
xml.enabled = true // computer readable
}
doLast { println "Coverage report(s) can be found from file://${buildDir}/reports/jacoco/jacocoAggregateReport/html/index.html" }
}
//ALL brings also sources for Gradle API
tasks.named('wrapper') {
distributionType = Wrapper.DistributionType.ALL
}