forked from cashapp/misk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
195 lines (174 loc) · 5.65 KB
/
build.gradle.kts
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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
}
dependencies {
classpath(Dependencies.kotlinAllOpenPlugin)
classpath(Dependencies.kotlinGradlePlugin)
classpath(Dependencies.dokkaGradlePlugin)
classpath(Dependencies.kotlinNoArgPlugin)
classpath(Dependencies.junitGradlePlugin)
classpath(Dependencies.mavenPublishGradlePlugin)
classpath(Dependencies.protobufGradlePlugin)
classpath(Dependencies.jgit)
classpath(Dependencies.wireGradlePlugin)
}
}
plugins {
id("com.autonomousapps.dependency-analysis") version Dependencies.dependencyAnalysisPluginVersion
id("org.jetbrains.kotlinx.binary-compatibility-validator") version Dependencies.kotlinBinaryCompatibilityPluginVersion
}
dependencyAnalysis {
issues {
all {
ignoreSourceSet("testFixtures")
onAny {
severity("fail")
// Due to kotlin 1.8.20 see https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/issues/884
exclude("() -> java.io.File?")
exclude("org.jetbrains.kotlin:kotlin-test:1.8.21")
}
}
// False positives.
project(":misk-aws2-dynamodb-testing") {
onAny {
exclude("org.antlr:antlr4-runtime")
}
}
project(":misk-gcp") {
onUsedTransitiveDependencies {
// Can be removed once dd-trace-ot uses 0.33.0 of open tracing.
exclude("io.opentracing:opentracing-util:0.32.0")
exclude("io.opentracing:opentracing-noop:0.33.0")
}
onRuntimeOnly {
exclude("com.datadoghq:dd-trace-ot:1.12.1")
}
}
project(":misk-grpc-tests") {
onUnusedDependencies {
exclude("javax.annotation:javax.annotation-api:1.3.2")
}
}
project(":misk-jooq") {
onIncorrectConfiguration {
exclude("org.jooq:jooq:3.18.2")
}
}
}
}
apiValidation {
ignoredProjects.addAll(listOf("exemplar", "exemplarchat"))
additionalSourceSets.addAll(listOf("testFixtures"))
}
val testShardNonHibernate by tasks.creating {
group = "Continuous integration"
description = "Runs all tests that don't depend on misk-hibernate. " +
"This target is intended for manually sharding tests to make CI faster."
}
val testShardHibernate by tasks.creating {
group = "Continuous integration"
description = "Runs all tests that depend on misk-hibernate. " +
"This target is intended for manually sharding tests to make CI faster."
}
subprojects {
apply(plugin = "org.jetbrains.dokka")
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
maven(url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}
// Only apply if the project has the kotlin plugin added:
plugins.withType<KotlinPluginWrapper> {
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
}
dependencies {
add("testRuntimeOnly", Dependencies.junitEngine)
// Platform/BOM dependencies constrain versions only.
// Enforce misk-bom -- it should take priority over external BOMs.
add("api", enforcedPlatform(project(":misk-bom")))
add("api", platform(Dependencies.grpcBom))
add("api", platform(Dependencies.guava))
add("api", platform(Dependencies.jacksonBom))
add("api", platform(Dependencies.jerseyBom))
add("api", platform(Dependencies.jettyBom))
add("api", platform(Dependencies.kotlinBom))
add("api", platform(Dependencies.nettyBom))
add("api", platform(Dependencies.prometheusClientBom))
add("api", platform(Dependencies.wireBom))
add("api", platform(Dependencies.wispBom))
}
tasks.withType<GenerateModuleMetadata> {
suppressedValidationErrors.add("enforced-platform")
}
}
tasks.withType<DokkaTask>().configureEach {
if (name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/0.x/${project.name}"))
}
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = false
}
}
plugins.withType<BasePlugin> {
tasks.findByName("check")!!.apply {
if (listOf(
"misk-aws",
"misk-events",
"misk-jobqueue",
"misk-jobqueue-testing",
"misk-jdbc",
"misk-jdbc-testing",
"misk-hibernate",
"misk-hibernate-testing"
).contains(project.name)) {
testShardHibernate.dependsOn(this)
} else {
testShardNonHibernate.dependsOn(this)
}
}
}
if (file("$rootDir/hooks.gradle").exists()) {
apply(from = file("$rootDir/hooks.gradle"))
}
if (!path.startsWith(":samples")) {
apply(plugin = "com.vanniktech.maven.publish")
apply(from = "$rootDir/gradle-mvn-publish.gradle")
}
// Workaround the Gradle bug resolving multiplatform dependencies.
// https://github.com/square/okio/issues/647
configurations.all {
if (name.contains("kapt") || name.contains("wire") || name.contains("proto") || name.contains("Proto")) {
attributes.attribute(
Usage.USAGE_ATTRIBUTE,
[email protected](Usage::class, Usage.JAVA_RUNTIME)
)
}
}
}