-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
93 lines (84 loc) · 2.69 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
buildscript {
dependencies {
classpath "org.yaml:snakeyaml:2.3"
}
}
plugins {
id 'local.std.base-project-conventions'
// Set versions for these plugins (but don't apply) so we don't have to repeat the versions in subprojects
id "org.springframework.boot" version "${spring_boot_version}" apply false
}
allprojects {
apply plugin: 'nebula.lint'
gradleLint {
alwaysRun = false
reportFormat = 'text'
// https://github.com/nebula-plugins/gradle-lint-plugin/wiki
rules = ['unused-dependency']
// criticalRules will fail the build in the event of a violation
criticalRules = [
'minimum-dependency-version',
'overridden-dependency-version',
'unused-exclude-by-dep',
'unused-exclude-by-conf',
'dependency-parentheses',
'duplicate-dependency-class',
'archaic-wrapper',
'all-nebula-renames'
]
}
afterEvaluate {
// Workaround for gradleLint failure
// https://github.com/nebula-plugins/gradle-lint-plugin/issues/336#issuecomment-844989277
// https://github.com/gradle/gradle/issues/6854
// configurations.all {
// if (name.startsWith("incrementalScalaAnalysis")) {
// extendsFrom = []
// }
// }
}
apply plugin: 'com.diffplug.spotless'
spotless {
// to format build.gradle files consistently
groovyGradle {
greclipse()
indentWithSpaces(2)
}
}
}
subprojects {
task allDependencies(type: DependencyReportTask) {}
pluginManager.withPlugin('java') {
// List all failedTest at the end of a build -- copied from https://stackoverflow.com/a/43936442
// add a collection to track failedTests
ext.failedTests = []
// add a listener to all tasks of type Test
tasks.withType(Test) {
afterTest { TestDescriptor descriptor, TestResult result ->
if (result.resultType == org.gradle.api.tasks.testing.TestResult.ResultType.FAILURE) {
failedTests << "${descriptor.className}::${descriptor.name}"
}
}
}
// print out tracked failed tests when the build has finished
// TODO: https://github.com/gradle/gradle/issues/20151#issuecomment-1551007455
// and https://docs.gradle.org/current/userguide/dataflow_actions.html#lifecycle_event_providers
gradle.buildFinished {
if (!failedTests.empty) {
println "Failed tests:"
failedTests.each { failedTest ->
println "- " + failedTest
}
println ""
}
}
}
}
ext {
jacoco_enforce_violations = true
jacoco_minimum_coverage = 0.8
}
tasks.named("dockerComposeDown").configure {
def domainProjects = subprojects.findAll { it.name.startsWith('domain-') }
mustRunAfter domainProjects*.name.collect { it + ':dockerComposeDown'}
}