forked from cashapp/misk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
139 lines (119 loc) · 4.38 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.DokkaTask
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)
classpath(Dependencies.kotlinBinaryCompatibilityPlugin)
}
}
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<org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper>() {
val compileKotlin by tasks.getting(KotlinCompile::class) {
kotlinOptions {
jvmTarget = "1.8"
// TODO(alec): Enable again once Environment enum is deleted
allWarningsAsErrors = false
}
}
val compileTestKotlin by tasks.getting(KotlinCompile::class) {
kotlinOptions {
jvmTarget = "1.8"
// TODO(alec): Enable again once Environment enum is deleted
allWarningsAsErrors = false
}
}
dependencies {
add("testImplementation", Dependencies.junitApi)
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))
}
tasks.withType<GenerateModuleMetadata> {
suppressedValidationErrors.add("enforced-platform")
}
}
tasks.withType<DokkaTask>().configureEach {
val dokkaTask = this
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
if (dokkaTask.name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/0.x"))
}
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = false
}
}
if (file("$rootDir/hooks.gradle").exists()) {
apply(from = file("$rootDir/hooks.gradle"))
}
val checkTask = tasks.findByName("check")
if (checkTask != null) {
if (listOf("misk-aws","misk-events","misk-jobqueue","misk-jobqueue-testing","misk-jdbc","misk-jdbc-testing","misk-hibernate","misk-hibernate-testing").contains(name)) {
testShardHibernate.dependsOn(checkTask)
} else {
testShardNonHibernate.dependsOn(checkTask)
}
}
if (!path.startsWith(":samples")) {
apply(plugin = "com.vanniktech.maven.publish")
apply(plugin = "org.jetbrains.kotlinx.binary-compatibility-validator")
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, this@subprojects.objects.named(Usage::class, Usage.JAVA_RUNTIME))
}
}
}