-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
43 lines (40 loc) · 1.68 KB
/
build.gradle.kts
File metadata and controls
43 lines (40 loc) · 1.68 KB
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
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.vanniktech.maven.publish.MavenPublishPlugin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.maven.publish)
}
subprojects {
apply<MavenPublishPlugin>()
apply<SpotlessPlugin>()
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
target("**/*.java")
targetExclude("**/build/**/*.java")
googleJavaFormat().aosp()
licenseHeaderFile(rootProject.file("$rootDir/spotless/copyright.java"))
}
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt")
ktlint().editorConfigOverride(mapOf("indent_size" to 2, "continuation_indent_size" to 2))
licenseHeaderFile(rootProject.file("$rootDir/spotless/copyright.kt"))
}
format("kts") {
target("**/*.kts")
targetExclude("**/build/**/*.kts")
// Look for the first line that doesn't have a block comment (assumed to be the license)
licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
}
}
}