-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.common.gradle
154 lines (124 loc) · 4.07 KB
/
build.common.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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
group = "com.transferwise.tasks"
apply plugin: "java-library"
apply plugin: "checkstyle"
apply plugin: "idea"
apply from: "../build.libraries.gradle"
repositories {
mavenCentral()
mavenLocal()
}
configurations {
configureEach {
exclude(group: 'junit', module: 'junit')
exclude(group: 'org.junit.vintage', module: 'junit-vintage-engine')
resolutionStrategy {
failOnVersionConflict()
preferProjectModules()
if (System.getenv("RUNS_IN_CI") == "true") {
// This is faster, than using Gradle's `--refresh-dependencies`, which will refresh also all non-dynamic things.
cacheDynamicVersionsFor 10, 'minutes'
cacheChangingModulesFor 10, 'minutes'
}
}
}
local {
canBeResolved(false)
canBeConsumed(false)
}
compileClasspath {
extendsFrom(local)
}
runtimeClasspath {
extendsFrom(local)
}
testCompileClasspath {
extendsFrom(local)
}
testRuntimeClasspath {
extendsFrom(local)
}
annotationProcessor {
extendsFrom(local)
}
testAnnotationProcessor {
extendsFrom(local)
}
}
dependencies {
local platform(libraries.springBootDependencies)
local libraries.lombok
annotationProcessor libraries.springBootConfigurationProcessor
compileOnly libraries.spotbugsAnnotations
compileOnly libraries.springBootConfigurationProcessor
compileOnly libraries.jakartaValidationApi
compileOnly libraries.javaxValidationApi
implementation libraries.slf4j
implementation libraries.apacheCommonsCollections
implementation libraries.apacheCommonsLang
implementation libraries.guava
implementation libraries.twBaseUtils
testCompileOnly libraries.spotbugsAnnotations
testImplementation libraries.junitApi
testImplementation libraries.junitEngine
testImplementation libraries.junitParams
testImplementation libraries.junitMockito
testImplementation libraries.assertJCore
if (springBootVersion.startsWith("2")) {
/*
Since hibernate-validator is depending on jakarta.validation:jakarta-validation-api and we are forcing the version to newer one to be able to compile for both javax and jakarta then we need to explicitly
add the javax variation back when running in javax environment (that is spring boot 2) for the Spring Boot autoconfiguration to work.
*/
testRuntimeOnly libraries.javaxValidationApi
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
jar {
manifest {
attributes(
"Implementation-Title": projectName,
"Implementation-Version": archiveVersion
)
}
}
compileJava {
options.encoding = 'utf-8'
options.compilerArgs << '-parameters'
options.compilerArgs << '-Xlint'
options.compilerArgs << '-Xlint:-processing'
}
test {
testLogging {
events TestLogEvent.STARTED, TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.PASSED,
TestLogEvent.STANDARD_ERROR
showExceptions = true
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
}
// When you want to rerun tests without any changes made
// outputs.upToDateWhen { false }
jvmArgs("-server", "-Djava.security.egd=file:/dev/./urandom", "-XX:+ExplicitGCInvokesConcurrent",
"-Xmx1g", "-XX:+HeapDumpOnOutOfMemoryError")
useJUnitPlatform()
}
tasks.findAll { it.name.startsWith("spotbugs") }*.configure {
excludeFilter = file('../spotbugs-exclude.xml')
reports {
xml.required = true
html.required = true
}
}
tasks.withType(Checkstyle).configureEach {
config = resources.text.fromFile(file('../google_checks.xml'))
maxWarnings = 0
reports {
xml.required = true
html.required = true
}
}