-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle.kts
61 lines (56 loc) · 1.78 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://cdn.reproio.com/android")
}
dependencies {
classpath(Dependencies.ProjectDependencies.androidGradlePlugin)
classpath(Dependencies.ProjectDependencies.Kotlin.gradlePlugin)
}
}
plugins {
id("com.diffplug.spotless") version Versions.spotless
id("org.jetbrains.kotlin.android") version "1.8.0" apply false
}
allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://cdn.reproio.com/android")
}
}
subprojects {
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target ("**/*.kt")
targetExclude("$buildDir/**/*.kt")
targetExclude("bin/**/*.kt")
trimTrailingWhitespace()
endWithNewline()
// 允許 import 路徑使用萬用字元
ktlint("0.39.0").userData(mapOf("disabled_rules" to "no-wildcard-imports"))
}
java {
target ("src/*/java/**/*.java")
googleJavaFormat("1.7").aosp()
// 移除沒用到的 Import
removeUnusedImports()
// 刪除多餘的空白
trimTrailingWhitespace()
importOrder("android", "androidx", "com", "junit", "net", "org", "java", "javax")
}
}
task("format") {
dependsOn("spotlessApply")
group = "Verification"
}
task("formatCheck") {
dependsOn("spotlessCheck")
group = "Verification"
}
}