-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle
131 lines (115 loc) · 5.22 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
buildscript {
repositories {
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
gradlePluginPortal() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}
dependencies {
classpath 'com.palantir.baseline:gradle-baseline-java:6.4.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.31.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0'
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.13.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:3.1.0'
classpath 'com.palantir.gradle.jdks:gradle-jdks:0.59.0'
classpath 'com.palantir.gradle.jdkslatest:gradle-jdks-latest:0.16.0'
classpath 'com.palantir.gradle.revapi:gradle-revapi:1.8.0'
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:2.50.0'
classpath 'com.palantir.metricschema:gradle-metric-schema:0.32.0'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.7.0'
classpath 'me.champeau.jmh:jmh-gradle-plugin:0.7.2'
}
}
apply plugin: 'com.palantir.external-publish'
apply plugin: 'com.palantir.failure-reports'
apply plugin: 'java'
apply plugin: 'com.palantir.baseline'
apply plugin: 'com.palantir.consistent-versions'
apply plugin: 'com.palantir.git-version'
apply plugin: 'com.palantir.jdks'
apply plugin: 'com.palantir.baseline-java-versions'
apply plugin: 'com.palantir.jdks.latest'
javaVersions {
libraryTarget = 17
runtime = 21
}
allprojects {
group 'com.palantir.tritium'
version gitVersion()
apply plugin: 'java-library'
apply plugin: 'org.inferred.processors' // installs the "processor" configuration needed for baseline-error-prone
apply plugin: 'com.palantir.baseline-class-uniqueness'
apply plugin: 'com.palantir.baseline-exact-dependencies'
apply plugin: 'com.palantir.baseline-null-away'
apply plugin: 'com.palantir.jakarta-package-alignment'
apply plugin: 'com.palantir.java-format'
apply plugin: 'com.palantir.revapi'
configurations {
testImplementationClasspath {
exclude module: 'junit'
}
}
repositories {
mavenCentral() { metadataSources { mavenPom(); ignoreGradleMetadataRedirection() } }
}
plugins.withId('com.palantir.baseline-error-prone', {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [
'-Werror',
'-Xlint:deprecation',
'-Xlint:unchecked',
]
options.errorprone {
option('NullAway:AnnotatedPackages', 'com.palantir,com.google.common')
option('NullAway:CheckOptionalEmptiness', 'true')
// warnings not explicitly provided by error-prone
error 'NullAway',
'Slf4jLogsafeArgs',
'PreferCollectionTransform',
'PreferListsPartition',
'PreferSafeLoggingPreconditions',
'PreferSafeLoggableExceptions',
'PreferSafeLogger'
disable 'AndroidJdkLibsChecker', // ignore Android
'Java7ApiChecker', // tritium requires JDK 11+
'Java8ApiChecker', // tritium requires JDK 11+
'MemberName', // false positives on ignored lambda args
'StaticOrDefaultInterfaceMethod', // Android specific
'Var', // high noise, low signal
'Varifier' // don't `var`ify everything yet as this conflicts with baseline VarUsage
errorproneArgs = [
'-XepAllSuggestionsAsWarnings',
]
}
}
})
tasks.withType(Test).configureEach {
useJUnitPlatform {
includeEngines 'jqwik', 'junit-jupiter'
}
// see https://docs.gradle.org/current/userguide/performance.html#execute_tests_in_parallel
// and https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution
// N.B. some tests depend on system properties, so cannot be concurrently executed
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
systemProperty("junit.jupiter.execution.parallel.enabled", "true")
systemProperty("junit.jupiter.execution.parallel.mode.default", "same_thread")
systemProperty("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showCauses true
showExceptions true
showStackTraces true
}
}
tasks.withType(Javadoc).configureEach {
// suppress Javadoc doclint warnings in Java 8+
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.check.dependsOn(javadoc)
tasks.check.dependsOn(checkImplicitDependencies)
tasks.check.dependsOn(checkUnusedDependencies)
tasks.check.dependsOn(checkUnusedConstraints)
}
jdks {
daemonTarget = 17
}