-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
141 lines (117 loc) · 4.68 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
// ----------------------------------------------------------------------------
// plugins
// ----------------------------------------------------------------------------
plugins {
// See https://github.com/diffplug/spotless-changelog
// id 'com.diffplug.spotless-changelog' version '2.4.1'
id 'com.diffplug.spotless' version '6.17.0'
// This plugin helps collate findings between the subprojects
id 'org.kordamp.gradle.jacoco' version '0.49.0'
// This plugin renders a test results summary line to the console
id 'org.kordamp.gradle.testing' version '0.49.0'
id 'java'
// id 'idea' -- don't use. This drops an IML and IPR file inside each module, making things a mess
id 'jacoco'
// See https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html
// Gradle's built-in test suite plugin
id 'jvm-test-suite'
// These 2 plugins require gradle:7.4-rc-1
// ./gradlew wrapper --gradle-version=7.4-rc-1
id 'test-report-aggregation'
id 'jacoco-report-aggregation'
// this enables lombok
id 'io.freefair.lombok' version '6.6.1'
// Integration test plugin
// id "org.kordamp.gradle.integration-test" version "0.47.0"
// provides detailed test reports
// This plugin seems to hide the output of integrationTests or, at least,
// not make the results of integrationTests obvious.
// id "com.monnage.test-report" version "1.4"
// creates a 'fat-jar' (one-jar)
id "com.github.johnrengelman.shadow" version "7.1.2"
id "org.sonarqube" version "4.0.0.2929"
id "com.github.ben-manes.versions" version "0.46.0"
}
// -------------------------------------
// repositories
// -------------------------------------
repositories {
mavenCentral()
}
// standard project set-up
apply from: "gradle/standard-setup.gradle"
/* taking this out
spotlessChangelog {
changelogFile 'CHANGELOG.md'
enforceCheck true
}
*/
// ----------------------------------------------------------------------------
// Use Java 11, for the sake of supporting the oldest LTS Java version.
// Since Java8 and Java11 are still the most used versions in production
// systems, we'll go with a version most developers are likely to have.
// ----------------------------------------------------------------------------
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
// ----------------------------------------------------------------------------
// basics
// ----------------------------------------------------------------------------
group 'mmm.coffee.metacode'
version 'alpha'
allprojects {
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'jacoco'
// apply plugin: 'com.coditory.integration-test'
apply plugin: 'io.freefair.lombok'
configurations.all {
// See https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
resolutionStrategy {
// fail fast on version conflicts (including transitive dependencies)
// failOnVersionConflict()
// cache dynamic versions for 10 minutes
cacheDynamicVersionsFor 10*60, 'seconds'
// don't cache changing modules at all
cacheChangingModulesFor 0, 'seconds'
}
}
}
// ----------------------------------------------------------------------------
// Sub-projects
// ----------------------------------------------------------------------------
subprojects {
tasks.withType(Test) {
// Ensure Junit5 is used
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" }
}
sonarqube {
properties {
property "sonar.sources", "src/main"
property "sonar.tests", [ "src/test", "src/integrationTest" ]
property "sonar.coverage.jacoco.xmlReportPaths",[
"${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml",
"${project.buildDir}/reports/jacoco/integrationTest/jacocoTestReport.xml" ]
}
}
}
// ----------------------------------------------------------------------------
// Make all tests use JUnit5
// ----------------------------------------------------------------------------
tasks.withType(Test) {
useJUnitPlatform()
testLogging { events "passed", "skipped", "failed" }
}
// ----------------------------------------------------------------------------
// Define an allIn task run compile thru to sonarqube
// ----------------------------------------------------------------------------
task allIn(type: GradleBuild) {
group = 'Build'
description = 'Run a complete build and test cycle, then publish to SonarQube.'
tasks = [ 'clean', 'build', 'integrationTest', 'jacocoTestReport', 'sonarqube' ]
}