forked from cashapp/misk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
129 lines (112 loc) · 4.02 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
jcenter()
maven(url = "https://plugins.gradle.org/m2/")
}
dependencies {
classpath(Dependencies.kotlinAllOpenPlugin)
classpath(Dependencies.kotlinGradlePlugin)
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 = "java")
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.dokka")
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
repositories {
mavenCentral()
jcenter()
maven(url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}
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.
add("api", enforcedPlatform(Dependencies.grpcBom))
add("api", enforcedPlatform(Dependencies.guava))
add("api", enforcedPlatform(Dependencies.jacksonBom))
add("api", enforcedPlatform(Dependencies.jerseyBom))
add("api", enforcedPlatform(Dependencies.jettyBom))
add("api", enforcedPlatform(Dependencies.kotlinBom))
add("api", enforcedPlatform(Dependencies.nettyBom))
}
// We have to set the dokka configuration after evaluation since the com.vanniktech.maven.publish
// plugin overwrites our dokka configuration on projects where it's applied.
afterEvaluate {
val dokka by tasks.getting(DokkaTask::class) {
reportUndocumented = false
skipDeprecated = true
jdkVersion = 8
}
}
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")
}
// 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))
}
}
}