forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
174 lines (152 loc) · 7.62 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
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
plugins {
id 'base'
id 'com.github.spotbugs' version '6.0.7'
}
allprojects {
apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'java-test-fixtures'
apply plugin: 'com.github.spotbugs'
// By default gradle uses directory as the project name. That works very well in a single project environment but
// projects clobber each other in an environments with subprojects when projects are in directories named identically.
def sub = rootDir.relativePath(projectDir.parentFile).replace('/', '.')
group = "io.${rootProject.name}${sub.isEmpty() ? '' : ".$sub"}"
project.base.archivesName = "${project.group}-${project.name}"
// Produce reproducible archives
// (see https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives)
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
// Common configurations for 'assemble'.
tasks.withType(Tar).configureEach {
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
tasks.withType(Zip).configureEach {
duplicatesStrategy DuplicatesStrategy.INCLUDE
// Disabling distZip causes the build to break for some reason, so: instead of disabling it, make it fast.
entryCompression ZipEntryCompression.STORED
}
// Convenience task to list all dependencies per project
tasks.register('listAllDependencies', DependencyReportTask) {}
// Common java configurations
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
compileJava {
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing"]
}
compileTestJava {
//rawtypes and unchecked are necessary for mockito
//deprecation and removal are removed from error since we should still test those constructs.
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing,-rawtypes,-unchecked,-deprecation,-removal"]
}
compileTestFixturesJava {
//rawtypes and unchecked are necessary for mockito
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing,-rawtypes,-unchecked"]
}
}
spotbugs {
ignoreFailures = false
effort = Effort.valueOf(System.getProperty('skipSlowTests', 'false') == 'false' ? 'MAX' : 'MIN')
excludeFilter.set rootProject.file('spotbugs-exclude-filter-file.xml')
reportLevel = Confidence.valueOf('HIGH')
showProgress = false
toolVersion = '4.8.3'
}
test {
useJUnitPlatform()
testLogging() {
events 'skipped', 'started', 'passed', 'failed'
exceptionFormat 'full'
// Swallow the logs when running in airbyte-ci, rely on test reports instead.
showStandardStreams = !System.getenv().containsKey("RUN_IN_AIRBYTE_CI")
}
reports {
junitXml {
outputPerTestCase = true
}
}
// This is required by mockito, see https://github.com/mockito/mockito/issues/3037.
jvmArgs "-XX:+EnableDynamicAgentLoading"
// This is also required, to prevent stderr spam starting with
// "OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader cl..."
jvmArgs "-Xshare:off"
// Set the timezone to UTC instead of picking up the host machine's timezone,
// which on a developer's laptop is more likely to be PST.
systemProperty 'user.timezone', 'UTC'
// Enable parallel test execution in JUnit by default.
// This is to support @Execution(ExecutionMode.CONCURRENT) annotations
// See https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution for details.
systemProperty 'junit.jupiter.execution.parallel.enabled', 'true'
// Concurrency takes place at the class level.
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', 'concurrent'
// Within a class, the test methods are still run serially on the same thread.
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'same_thread'
// Effectively disable JUnit concurrency by running tests in only one thread by default.
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'fixed'
systemProperty 'junit.jupiter.execution.parallel.config.fixed.parallelism', 1
// Order test classes by annotation.
systemProperty 'junit.jupiter.testclass.order.default', 'org.junit.jupiter.api.ClassOrderer$OrderAnnotation'
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
if (!project.hasProperty('testExecutionConcurrency')) {
// By default, let gradle spawn as many independent workers as it wants.
maxParallelForks = Runtime.runtime.availableProcessors()
maxHeapSize = '3G'
} else {
// Otherwise, run tests within the same JVM.
// Let gradle spawn only one worker.
maxParallelForks = 1
maxHeapSize = '8G'
// Manage test execution concurrency in JUnit.
String concurrency = project.property('testExecutionConcurrency').toString()
if (concurrency.isInteger() && (concurrency as int) > 0) {
// Define a fixed number of threads when the property is set to a positive integer.
systemProperty 'junit.jupiter.execution.parallel.config.fixed.parallelism', concurrency
} else {
// Otherwise let JUnit manage the concurrency dynamically.
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'dynamic'
}
}
}
dependencies {
// Lombok dependencies.
def lombok = "org.projectlombok:lombok:1.18.30"
compileOnly lombok
annotationProcessor lombok
testCompileOnly lombok
testAnnotationProcessor lombok
testFixturesCompileOnly lombok
testFixturesAnnotationProcessor lombok
// JUnit dependencies.
def vAssertJ = "3.21.0"
def vJUnit = "5.9.1"
def vJUnitJupiter = "5.10.0"
def vJUnitPioneer = "1.7.1"
testFixturesImplementation "org.junit.jupiter:junit-jupiter-api:${vJUnit}"
testFixturesImplementation "org.junit.jupiter:junit-jupiter-params:${vJUnit}"
testFixturesImplementation "org.mockito:mockito-junit-jupiter:${vJUnitJupiter}"
testFixturesImplementation "org.assertj:assertj-core:${vAssertJ}"
testFixturesImplementation "org.junit-pioneer:junit-pioneer:${vJUnitPioneer}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${vJUnit}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${vJUnit}"
testImplementation "org.mockito:mockito-junit-jupiter:${vJUnitJupiter}"
testImplementation "org.assertj:assertj-core:${vAssertJ}"
testImplementation "org.junit-pioneer:junit-pioneer:${vJUnitPioneer}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${vJUnit}"
// Spotbugs dependencies.
def vSpotbugs = "4.8.3"
implementation "com.github.spotbugs:spotbugs-annotations:${vSpotbugs}"
}
tasks.withType(SpotBugsTask).configureEach {
// Reports can be found under each subproject in build/spotbugs/
reports {
xml.required = false
html.required = true
}
}
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
}