-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
67 lines (55 loc) · 1.7 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
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.diffplug.gradle.spotless.SpotlessPlugin
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(kotlin("gradle-plugin", version = "1.6.10"))
classpath("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.6.10-1.0.4")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.31")
classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0")
}
}
plugins {
kotlin("jvm") version "1.6.10" apply false
id("com.diffplug.spotless")
}
allprojects {
repositories {
google()
mavenCentral()
}
}
val projectJvmTarget = JavaVersion.VERSION_11.toString()
subprojects {
pluginManager.configureSpotlessIntegration(subProject = project)
tasks.withType<KotlinCompile>().configureEach {
dependsOn("spotlessKotlinApply")
kotlinOptions {
jvmTarget = projectJvmTarget
}
}
}
fun PluginManager.configureSpotlessIntegration(subProject: Project) = apply {
val spotlessConfiguration: (AppliedPlugin) -> Unit = {
subProject.pluginManager.apply(SpotlessPlugin::class.java)
subProject.configure<SpotlessExtension> {
kotlin {
target("src/**/*.kt")
ktlint()
trimTrailingWhitespace()
endWithNewline()
}
kotlinGradle {
ktlint()
trimTrailingWhitespace()
endWithNewline()
}
}
}
withPlugin("org.jetbrains.kotlin.jvm", spotlessConfiguration)
}