-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (80 loc) · 2.55 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import cab.andrew.simpsonsview.Libs
import cab.andrew.simpsonsview.Versions
buildscript {
ext {
buildConfig = [minSdk: 28, targetSdk: 30, compileSdk: 30]
}
ext.kotlin_version = "1.3.72"
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath Libs.AndroidX.Navigation.safeArgs
classpath Libs.Kotlin.gradlePlugin
classpath Libs.Kotlin.extensions
classpath Libs.gradlePlayPublisher
classpath Libs.Google.openSourceLicensesPlugin
classpath Libs.Hilt.gradlePlugin
}
}
plugins {
id 'com.diffplug.spotless' version '5.1.0'
id 'com.github.ben-manes.versions' version '0.28.0'
}
allprojects {
repositories {
google()
jcenter()
}
}
subprojects {
configurations.configureEach {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
// kotlin-stdlib-jre7 no longer exists in 1.4, so we force the
// kotlin-stdlib module instead
if (details.requested.module.name == 'kotlin-stdlib-jre7') {
details.useTarget Libs.Kotlin.stdlib
}
}
}
}
}
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target '**/*.kt'
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
ktlint(Versions.ktlint)
licenseHeaderFile rootProject.file('spotless/copyright.kt')
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true
// Enable experimental coroutines APIs, including Flow
freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.FlowPreview"
freeCompilerArgs += "-Xopt-in=kotlin.Experimental"
freeCompilerArgs += "-Xallow-jvm-ir-dependencies"
freeCompilerArgs += "-Xjvm-default=all"
// Set JVM target to 1.8
jvmTarget = "1.8"
}
}
}
Object propOrDef(String propertyName, Object defaultValue) {
def propertyValue = project.properties[propertyName]
return propertyValue != null ? propertyValue : defaultValue
}