-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
188 lines (170 loc) · 5.51 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
import com.diffplug.gradle.spotless.SpotlessExtension
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import java.net.URI
import java.net.URL
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript {
repositories {
mavenCentral()
google()
gradlePluginPortal()
}
dependencies {
classpath(libs.binary.compatibility.validator.gradle.plugin)
classpath(libs.mavenPublish.gradle.plugin)
classpath(libs.kotlin.gradlePlugin)
classpath(libs.dokka.gradle.plugin)
classpath(libs.google.ksp)
}
}
plugins {
alias(libs.plugins.buildconfig)
alias(libs.plugins.spotless)
}
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "com.vanniktech.maven.publish.base")
configure<SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint()
.editorConfigOverride(
mapOf(
"ktlint_standard_filename" to "disabled",
)
)
}
}
allprojects {
group = "app.cash.burst"
version = project.property("VERSION_NAME") as String
repositories {
mavenCentral()
google()
}
}
subprojects {
tasks.withType(Test::class).configureEach {
testLogging {
if (System.getenv("CI") == "true") {
events = setOf(TestLogEvent.STARTED, TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.PASSED)
}
exceptionFormat = TestExceptionFormat.FULL
}
}
}
tasks.named("dokkaHtmlMultiModule", DokkaMultiModuleTask::class.java).configure {
moduleName.set("Burst")
}
allprojects {
tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
documentedVisibilities.set(setOf(
Visibility.PUBLIC,
Visibility.PROTECTED
))
reportUndocumented.set(false)
jdkVersion.set(8)
perPackageOption {
matchingRegex.set("app\\.cash\\.burst\\.internal\\..*")
suppress.set(true)
}
sourceLink {
localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL("https://github.com/cashapp/burst/tree/main/"))
remoteLineSuffix.set("#L")
}
}
}
// Don't attempt to sign anything if we don't have an in-memory key. Otherwise, the 'build' task
// triggers 'signJsPublication' even when we aren't publishing (and so don't have signing keys).
tasks.withType<Sign>().configureEach {
enabled = project.findProperty("signingInMemoryKey") != null
}
val javaVersion = JavaVersion.VERSION_1_8
plugins.withId("org.jetbrains.kotlin.multiplatform") {
val kotlin = extensions.getByName("kotlin") as KotlinMultiplatformExtension
kotlin.targets.withType(KotlinJvmTarget::class.java) {
compilerOptions {
freeCompilerArgs.add("-Xjdk-release=$javaVersion")
}
}
}
tasks.withType(JavaCompile::class.java).configureEach {
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
}
tasks.withType(KotlinJvmCompile::class.java).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(javaVersion.toString()))
}
}
plugins.withId("com.vanniktech.maven.publish.base") {
configure<PublishingExtension> {
repositories {
maven {
name = "testMaven"
url = rootProject.layout.buildDirectory.dir("testMaven").get().asFile.toURI()
}
/*
* Want to push to an internal repository for testing?
* Set the following properties in ~/.gradle/gradle.properties.
*
* internalUrl=YOUR_INTERNAL_URL
* internalUsername=YOUR_USERNAME
* internalPassword=YOUR_PASSWORD
*
* Then run the following command to publish a new internal release:
*
* ./gradlew publishAllPublicationsToInternalRepository -DRELEASE_SIGNING_ENABLED=false
*/
val internalUrl = providers.gradleProperty("internalUrl").orNull
if (internalUrl != null) {
maven {
name = "internal"
url = URI(internalUrl)
credentials {
username = providers.gradleProperty("internalUsername").get()
password = providers.gradleProperty("internalPassword").get()
}
}
}
}
}
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true)
signAllPublications()
pom {
description.set("Adds parameters to tests")
name.set(project.name)
url.set("https://github.com/cashapp/burst/")
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")
}
}
developers {
developer {
id.set("cashapp")
name.set("Cash App")
}
}
scm {
url.set("https://github.com/cashapp/burst/")
connection.set("scm:git:https://github.com/cashapp/burst.git")
developerConnection.set("scm:git:ssh://[email protected]/cashapp/burst.git")
}
}
}
}
}