-
-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathbuild.gradle.kts
130 lines (114 loc) · 3.42 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.kotlin
import org.gradle.kotlin.dsl.repositories
import org.gradle.api.plugins.quality.CheckstyleExtension
import com.android.build.gradle.BaseExtension
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath(deps.plugins.android)
classpath(deps.plugins.bugsnag)
}
}
plugins {
id("org.jetbrains.kotlin.jvm") version deps.versions.kotlin
id("com.github.ben-manes.versions") version "0.17.0"
checkstyle
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
mavenCentral()
}
configurations.all {
resolutionStrategy.eachDependency {
when (requested.group) {
"com.android.support" -> {
if ("multidex" !in requested.name) {
useVersion(deps.versions.support)
}
}
"com.google.android.gms" -> useVersion(deps.versions.gms)
"org.jetbrains.kotlin" -> useVersion(deps.versions.kotlin)
}
}
}
}
subprojects {
apply {
plugin("checkstyle")
}
tasks {
val checkstyle by creating(Checkstyle::class) {
configFile = file("$rootDir/config/checkstyle/checkstyle.xml")
classpath = files()
source("src")
}
tasks.findByName("check")?.dependsOn(checkstyle)
}
extensions.configure(CheckstyleExtension::class.java) {
isIgnoreFailures = false
toolVersion = "8.8"
}
afterEvaluate {
// BaseExtension is common parent for application, library and test modules
extensions.configure(BaseExtension::class.java) {
compileSdkVersion(deps.android.compileSdkVersion)
buildToolsVersion(deps.android.buildToolsVersion)
defaultConfig {
minSdkVersion(deps.android.minSdkVersion)
targetSdkVersion(deps.android.targetSdkVersion)
multiDexEnabled = true
}
lintOptions {
isAbortOnError = true
disable("UnusedResources") // https://issuetracker.google.com/issues/63150366
disable("InvalidPackage")
}
dexOptions {
dexInProcess = true
}
compileOptions {
setSourceCompatibility(JavaVersion.VERSION_1_8)
setTargetCompatibility(JavaVersion.VERSION_1_8)
}
}
extensions.configure(KotlinProjectExtension::class.java) {
experimental.coroutines = Coroutines.ENABLE
}
kapt {
useBuildCache = true
mapDiagnosticLocations = true
}
}
configurations {
all {
exclude(group = "com.google.code.findbugs", module = "jsr305")
}
}
}
configurations {
maybeCreate("ktlint")
}
dependencies {
"ktlint"("com.github.shyiko:ktlint:0.20.0")
}
tasks {
"clean"(Delete::class) {
delete(buildDir)
}
"lintKotlin"(JavaExec::class) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations["ktlint"]
args.addAll(listOf("*/src/**/*.kt"))
}
}