-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathbuild.gradle.kts
143 lines (126 loc) · 4.33 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
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.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(libs.dokkaGradlePlugin)
classpath(libs.junitGradlePlugin)
classpath(libs.kotlinGradlePlugin)
classpath(libs.mavenPublishGradlePlugin)
classpath(libs.wireGradlePlugin)
}
}
apply(plugin = "com.vanniktech.maven.publish.base")
allprojects {
group = "app.cash.tempest"
version = project.findProperty("VERSION_NAME") as? String ?: "0.0-SNAPSHOT"
plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true)
signAllPublications()
pom {
description.set("Typesafe DynamoDB in Kotlin")
name.set(project.name)
url.set("https://github.com/cashapp/tempest/")
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/tempest/")
connection.set("scm:git:git://github.com/cashapp/tempest.git")
developerConnection.set("scm:git:ssh://[email protected]/cashapp/tempest.git")
}
developers {
developer {
id.set("square")
name.set("Square, Inc.")
}
}
}
}
}
}
subprojects {
if (project.name == "tempest-bom") return@subprojects
apply(plugin = "org.jetbrains.dokka")
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 = JavaVersion.VERSION_11.toString()
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}
// dependsOn("spotlessKotlinApply")
}
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_11.toString()
targetCompatibility = JavaVersion.VERSION_11.toString()
}
dependencies {
// add("api", project(":tempest-bom"))
add("api", platform(libs.nettyBom))
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("started", "passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showStackTraces = true
}
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
}
// 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>().configureEach {
val dokkaTask = this
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(11)
externalDocumentationLink {
url.set(URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
packageListUrl.set(
URL("https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/package-list")
)
}
if (dokkaTask.name == "dokkaGfm") {
outputDirectory.set(project.file("$rootDir/docs/1.x"))
}
}
}
}
// 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)
)
}
}
}