forked from micronaut-projects/micronaut-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
227 lines (200 loc) · 8.41 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
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
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0"
classpath "org.aim42:htmlSanityCheck:${libs.versions.htmlSanityCheck.get()}"
classpath 'javax.xml.bind:jaxb-api:2.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.managed.kotlin.asProvider().get()}"
}
}
apply plugin: 'org.aim42.htmlSanityCheck'
repositories {
mavenCentral()
}
tasks.register("testReportsAggregate") {
group 'verification'
doLast() {
int totalFailures = 0
int totalErrors = 0
int totalSkipped = 0
int totalTests = 0
int itemPad = 13
int titlePad = 35
String separator = " | "
subprojects.each { subproject ->
if (subproject.tasks.find { Task task -> task.name == 'test' }) {
if (new File("${subproject.buildDir}/test-results/test").exists()) {
int failures = 0
int errors = 0
int skipped = 0
int tests = 0
new File("${subproject.buildDir}/test-results/test").eachFile() { file ->
if (file.name.endsWith('.xml')) {
def testsuite = new XmlSlurper().parseText(file.text)
failures += "${testsuite['@failures']}" as int
errors += "${testsuite['@errors']}" as int
skipped += "${testsuite['@skipped']}" as int
tests += "${testsuite['@tests']}" as int
}
}
totalFailures += failures
totalErrors += errors
totalSkipped += skipped
totalTests += tests
String subprojectStr = "${subproject.name}".padRight(titlePad)
String testStr = "tests: $tests".padRight(itemPad)
String skippedStr = "skipped: $skipped".padRight(itemPad)
String errorsStr = "errors: $errors".padRight(itemPad)
String failuresStr = "failures: $failures".padRight(itemPad)
logger.quiet("${subprojectStr}${separator}${testStr}${separator}${skippedStr}${separator}${errorsStr}${separator}${failuresStr}")
}
}
}
String title = "All Tests".padRight(titlePad)
String testStr = "tests: $totalTests".padRight(itemPad)
String skippedStr = "skipped: $totalSkipped".padRight(itemPad)
String errorsStr = "errors: $totalErrors".padRight(itemPad)
String failuresStr = "failures: $totalFailures".padRight(itemPad)
int itemsSize = [totalTests, totalSkipped, totalErrors, totalFailures].size()
logger.quiet("=" * ((itemPad * itemsSize) + titlePad + (separator.length() * itemsSize)))
logger.quiet("${title}${separator}${testStr}${separator}${skippedStr}${separator}${errorsStr}${separator}${failuresStr}")
}
}
subprojects { Project subproject ->
ext {
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
shadowJarEnabled = false
}
group projectGroupId
if (subproject.name.contains("bom") || subproject.name.contains("parent")) {
return
}
apply plugin: "io.micronaut.build.internal.common"
if (!subproject.name.startsWith('test-') &&
!subproject.name.startsWith('inject-test-') &&
!subproject.toString().contains('benchmarks')) {
apply plugin: "io.micronaut.build.internal.publishing"
}
micronautBuild {
enableBom = false
enableProcessing = false
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
jvmArgs '-Xmx2048m'
systemProperty "micronaut.cloud.platform", "OTHER"
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_15)) {
jvmArgs "--enable-preview"
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-Amicronaut.processing.group=$project.group")
options.compilerArgs.add("-Amicronaut.processing.module=micronaut-$project.name")
options.compilerArgs.add("-Amicronaut.processing.omit.confprop.injectpoints=true")
options.forkOptions.memoryMaximumSize = "2g"
}
tasks.withType(GroovyCompile).configureEach {
options.compilerArgs.add("-Amicronaut.processing.group=$project.group")
options.compilerArgs.add("-Amicronaut.processing.module=micronaut-$project.name")
groovyOptions.forkOptions.memoryMaximumSize = "2g"
}
configurations {
shadowCompile
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
String group = details.requested.group
if (group == 'org.ow2.asm') {
details.useVersion(libs.versions.asm.get())
}
}
}
}
apply plugin: 'com.github.johnrengelman.shadow'
tasks.named("shadowJar") {
configurations = [project.configurations.shadowCompile]
relocate "com.github.benmanes.caffeine", "io.micronaut.caffeine"
relocate "org.objectweb.asm", "io.micronaut.asm"
}
def isDocumented = subproject.name != 'inject' && subproject.name != 'core' && subproject.name != 'aop' && !subproject.name.contains('asciidoc-config-props')
dependencies {
if (subproject.name != "bom") {
api libs.managed.slf4j
}
if (isDocumented) {
annotationProcessor(libs.micronaut.docs) {
transitive = false
}
}
compileOnly libs.caffeine
testAnnotationProcessor project(":http-validation")
testImplementation libs.caffeine
testImplementation libs.managed.groovy
testImplementation(libs.managed.spock) {
exclude module: 'groovy-all'
}
testImplementation libs.groovy.test.junit5
compileOnly libs.bundles.asm
annotationProcessor libs.bundles.asm
testImplementation libs.bundles.asm
testAnnotationProcessor libs.bundles.asm
}
spotless {
java {
targetExclude '**/io/micronaut/core/io/scan/AnnotationClassReader.java'
targetExclude '**/io/micronaut/core/io/scan/Attribute.java'
targetExclude '**/io/micronaut/core/io/scan/Context.java'
targetExclude '**/io/micronaut/core/util/clhm/**'
targetExclude '**/io/micronaut/core/util/AntPathMatcher.java'
targetExclude '**/io/micronaut/discovery/eureka/client/v2/AmazonInfo.java'
targetExclude '**/io/micronaut/discovery/eureka/client/v2/DataCenterInfo.java'
targetExclude '**/io/micronaut/discovery/eureka/client/v2/LeaseInfo.java'
targetExclude '**/io/micronaut/support/InMemoryJavaFileManager.java'
targetExclude '**/io/micronaut/scheduling/cron/CronExpression.java'
targetExclude '**/org/atinject/tck/auto/Tck.kt'
targetExclude '**/io/micronaut/http/uri/QueryStringDecoder.java'
}
format 'javaMisc', {
targetExclude '**/io/micronaut/core/util/clhm/**'
targetExclude '**/io/micronaut/http/netty/stream/package-info.java'
}
}
}
apply plugin: "io.micronaut.build.internal.docs"
apply plugin: "io.micronaut.build.internal.version-catalog-updates"
allprojects {
version project.projectVersion
apply plugin: 'idea'
idea {
module {
outputDir file('build/classes/java/main')
testOutputDir file('build/classes/groovy/test')
}
}
}
htmlSanityCheck {
sourceDir = new File("${rootProject.buildDir}/docs/guide/")
sourceDocuments = fileTree(sourceDir) {
include "index.html"
}
}
tasks.named("docs") {
finalizedBy(htmlSanityCheck)
}
tasks.named("updateVersionCatalogs") {
// we set the list to empty because we accept upgrades which improve the status
rejectedQualifiers = []
// Invalid POM files
ignoredModules.add("io.micronaut.ignite:micronaut-ignite-core")
ignoredModules.add("io.micronaut.ignite:micronaut-ignite-cache")
// workaround Gradle variant selection problem
ignoredModules.add("com.github.ben-manes.caffeine:caffeine")
}
allprojects {
tasks.withType(JavaCompile).configureEach {
options.fork = true
options.forkOptions.memoryMaximumSize = "1048m"
}
}