-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
134 lines (117 loc) · 3.52 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
131
132
133
134
import java.util.EnumSet
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
var kotlin_version: String by extra
kotlin_version = "1.6.20-M1"
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.2.2")
classpath("dev.ahmedmourad.nocopy:nocopy-gradle-plugin:1.4.0")
classpath("org.jacoco:org.jacoco.core:0.8.7")
classpath("com.vanniktech:gradle-android-junit-jacoco-plugin:0.17.0-SNAPSHOT")
classpath("com.github.ben-manes:gradle-versions-plugin:0.42.0")
}
}
subprojects {
apply(plugin = "com.diffplug.spotless")
apply(plugin = "com.vanniktech.android.junit.jacoco")
apply(plugin = "com.github.ben-manes.versions")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
ktlint(ktlintVersion).userData(
// TODO this should all come from editorconfig https://github.com/diffplug/spotless/issues/142
mapOf(
"indent_size" to "2",
"ij_kotlin_imports_layout" to "*",
"end_of_line" to "lf",
"charset" to "utf-8"
)
)
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
format("xml") {
target("**/res/**/*.xml")
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
kotlinGradle {
target("**/*.gradle.kts", "*.gradle.kts")
ktlint(ktlintVersion).userData(
mapOf(
"indent_size" to "2",
"ij_kotlin_imports_layout" to "*",
"end_of_line" to "lf",
"charset" to "utf-8"
)
)
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
configure<com.vanniktech.android.junit.jacoco.JunitJacocoExtension> {
jacocoVersion = "0.8.7"
includeNoLocationClasses = true
includeInstrumentationCoverageInMergedReport = true
csv.isEnabled = false
xml.isEnabled = true
html.isEnabled = true
}
afterEvaluate {
tasks.withType<Test> {
extensions
.getByType<JacocoTaskExtension>()
.run {
isIncludeNoLocationClasses = true
excludes = listOf("jdk.internal.*")
}
testLogging {
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
events = EnumSet.of(
TestLogEvent.PASSED,
TestLogEvent.FAILED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR
)
exceptionFormat = TestExceptionFormat.FULL
}
}
}
}
allprojects {
tasks.withType<KotlinCompile> {
kotlinOptions {
val version = JavaVersion.VERSION_11.toString()
jvmTarget = version
sourceCompatibility = version
targetCompatibility = version
}
}
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}