-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
77 lines (68 loc) · 2.34 KB
/
build.gradle
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
import dev.mkeeda.spaceship.buildsrc.GradlePlugins
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath GradlePlugins.kotlin
classpath GradlePlugins.serialization
classpath GradlePlugins.android
classpath GradlePlugins.hilt
classpath GradlePlugins.spotless
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
subprojects {
configurations.configureEach {
// We forcefully exclude AppCompat + MDC from any transitive dependencies.
// This is a Compose app, so there's no need for these
exclude group: 'androidx.appcompat'
exclude group: 'com.google.android.material', module: 'material'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Enable experimental coroutines APIs, including Flow
freeCompilerArgs += "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
freeCompilerArgs += "-opt-in=kotlinx.coroutines.FlowPreview"
freeCompilerArgs += "-opt-in=kotlin.Experimental"
// Set JVM target to 1.8
jvmTarget = "1.8"
}
}
apply plugin: "com.diffplug.spotless"
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
kotlin {
target '**/*.kt'
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
/**
* ktlint's default import ordering rule is not expected for Android Studio.
* To fix this issue needs to refer .editorconfig file,but spotless dose not support to refer .editorconfig.
* So disabled ktlint import ordering rule.
* https://github.com/diffplug/spotless/issues/142
*/
ktlint().userData([disabled_rules:'import-ordering'])
}
kotlinGradle {
target '*.gradle.kts'
ktlint()
}
}
}
Object propertyOrDefault(String propertyName, Object defaultValue) {
def propertyValue = project.properties[propertyName]
println(propertyName + ": " + propertyValue)
return propertyValue != null ? propertyValue : defaultValue
}