This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
121 lines (109 loc) · 3.4 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
/*
* Copyright (C) 2022 Slack Technologies, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.dokka)
alias(libs.plugins.detekt)
alias(libs.plugins.lint)
alias(libs.plugins.mavenPublish)
alias(libs.plugins.spotless)
alias(libs.plugins.binaryCompatibilityValidator)
alias(libs.plugins.moshix)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.retry)
alias(libs.plugins.ksp)
}
spotless {
format("misc") {
target("*.md", ".gitignore")
trimTrailingWhitespace()
endWithNewline()
}
val ktfmtVersion = libs.versions.ktfmt.get()
kotlin {
target("**/*.kt")
ktfmt(ktfmtVersion).googleStyle()
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile("spotless/spotless.kt")
targetExclude("**/spotless.kt")
}
kotlinGradle {
ktfmt(ktfmtVersion).googleStyle()
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile(
"spotless/spotless.kt",
"(import|plugins|buildscript|dependencies|pluginManagement)",
)
}
}
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(22)) } }
tasks.withType<JavaCompile>().configureEach {
options.release.set(libs.versions.jvmTarget.get().toInt())
}
tasks.withType<Detekt>().configureEach { jvmTarget = libs.versions.jvmTarget.get() }
tasks.withType<DokkaTask>().configureEach {
outputDirectory.set(rootProject.layout.projectDirectory.dir("docs/2.x"))
dokkaSourceSets.configureEach { skipDeprecated.set(true) }
}
mavenPublishing {
publishToMavenCentral(automaticRelease = true)
signAllPublications()
}
kotlin {
explicitApi()
compilerOptions {
jvmTarget.set(libs.versions.jvmTarget.map(JvmTarget::fromTarget))
allWarningsAsErrors.set(true)
progressiveMode.set(true)
optIn.add("kotlin.ExperimentalStdlibApi")
}
}
lint { baseline = file("lint-baseline.xml") }
moshi { enableSealed.set(true) }
// We have a couple flaky tests on CI right now
if (System.getenv("CI") != null) {
tasks.test {
retry {
maxRetries.set(2)
maxFailures.set(20)
failOnPassedAfterRetry.set(false)
}
}
}
dependencies {
ksp(libs.autoService.ksp)
api(libs.clikt)
implementation(libs.autoService.annotations)
implementation(libs.tikxml.htmlEscape)
implementation(libs.kotlinx.serialization.core)
implementation(libs.xmlutil.serialization)
implementation(libs.kotlinShell)
implementation(libs.okio)
implementation(libs.okhttp)
implementation(libs.bugsnag)
implementation(libs.moshi)
implementation(libs.kotlin.reflect)
implementation(libs.sarif4k)
// To silence this stupid log https://www.slf4j.org/codes.html#StaticLoggerBinder
implementation(libs.slf4jNop)
testImplementation(libs.junit)
testImplementation(libs.truth)
}