-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle.kts
162 lines (146 loc) · 5.1 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
import com.diffplug.gradle.spotless.SpotlessExtension
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(libs.kotlinGradlePlugin)
classpath(libs.kotlinAllOpenPlugin)
classpath(libs.dokkaGradlePlugin)
classpath(libs.mavenPublishGradlePlugin)
classpath(libs.spotlessPlugin)
classpath(libs.wireGradlePlugin)
classpath(libs.buildConfigPlugin)
classpath(libs.shadowJarPlugin)
classpath("app.cash.backfila:client-sqldelight-gradle-plugin")
}
}
apply(plugin = "com.vanniktech.maven.publish.base")
allprojects {
group = project.property("GROUP") as String
version = project.findProperty("VERSION_NAME") as? String ?: "0.0-SNAPSHOT"
}
subprojects {
apply(plugin = "com.diffplug.spotless")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jetbrains.kotlin.plugin.allopen")
tasks.withType<KotlinCompile> {
dependsOn("spotlessKotlinApply")
kotlinOptions {
jvmTarget = "11"
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
configure<AllOpenExtension> {
annotation("javax.persistence.Entity")
annotation("javax.persistence.Embeddable")
annotation("javax.persistence.MappedSuperclass")
}
configure<SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint(libs.versions.ktlint.get()).editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "4",
"trailing_comma_on_call_site" to "true",
"trailing_comma_on_declaration_site" to "true",
"ij_kotlin_allow_trailing_comma" to "true",
"ij_kotlin_allow_trailing_comma_on_declaration_site" to "true",
"ij_kotlin_allow_trailing_comma_on_call_site" to "true",
"ij_kotlin_imports_layout" to "*",
"ktlint_disabled_rules" to "argument-list-wrapping",
)
)
}
}
repositories {
mavenCentral()
maven(url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release")
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showStackTraces = true
}
}
// SLF4J uses the classpath to decide which logger to use! Banish the Log4J to prevent this:
// org.apache.logging.slf4j.Log4jLogger cannot be cast to class ch.qos.logback.classic.Logger
configurations.all {
exclude(group = "org.apache.logging.log4j", module = "log4j-slf4j-impl")
}
// 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")) {
attributes.attribute(Usage.USAGE_ATTRIBUTE, [email protected](Usage::class, Usage.JAVA_RUNTIME))
}
}
// 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 {
tasks.withType(DokkaTask::class).configureEach {
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
if (name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/0.x"))
}
}
}
}
}
allprojects {
plugins.withId("com.vanniktech.maven.publish.base") {
configure<PublishingExtension> {
// For the Gradle plugin's tests.
repositories {
maven {
name = "testMaven"
url = rootProject.layout.buildDirectory.dir("testMaven").get().asFile.toURI()
}
}
}
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true)
signAllPublications()
pom {
description.set("Backfila is a service that manages backfill state, calling into other services to do batched work.")
name.set(project.name)
url.set("https://github.com/cashapp/backfila/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
scm {
url.set("https://github.com/cashapp/backfila/")
connection.set("scm:git:git://github.com/cashapp/backfila.git")
developerConnection.set("scm:git:ssh://[email protected]/cashapp/backfila.git")
}
developers {
developer {
id.set("square")
name.set("Square, Inc.")
}
}
}
}
}
}