-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
142 lines (121 loc) · 3.44 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
135
136
137
138
139
140
141
142
import com.android.build.api.variant.VariantFilter
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.LibraryPlugin
import com.android.build.gradle.internal.plugins.BasePlugin
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id(Libs.Detekt.GradlePluginId) version Libs.Detekt.Version
id(Libs.GradleVersions.GradlePluginId) version Libs.GradleVersions.Version
}
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
dependencies {
classpath(Libs.AndroidGradlePlugin)
classpath(Libs.Kotlin.GradlePlugin)
classpath(Libs.MavenPublishGradlePlugin)
classpath(Libs.Kotlin.DokkaGradlePlugin)
classpath(Libs.Detekt.GradlePlugin)
classpath(Libs.GradleVersions.GradlePlugin)
classpath(Libs.Wire.GradlePlugin)
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
group = properties["GROUP"]!!
version = properties["VERSION_NAME"]!!
tasks.withType<Test> {
testLogging {
events("skipped", "failed", "passed")
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf(
"-progressive",
"-Xjvm-default=enable",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlin.time.ExperimentalTime"
)
}
}
plugins.withType<LibraryPlugin> {
extensions.findByType<BaseExtension>()?.apply {
variantFilter = Action<VariantFilter> {
ignore = name != "release"
}
}
}
plugins.withType<BasePlugin<*, *>> {
extension.compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
extensions.findByType<BaseExtension>()?.apply {
compileSdkVersion(Build.CompileSdk)
defaultConfig {
minSdkVersion(Build.MinSdk)
targetSdkVersion(Build.TargetSdk)
vectorDrawables.useSupportLibrary = true
}
lintOptions {
lintConfig = rootProject.file("lint.xml")
htmlReport = !isCi()
xmlReport = isCi()
xmlOutput = file("build/reports/lint/lint-results.xml")
textReport = true
textOutput("stdout")
isExplainIssues = false
isCheckDependencies = false
isCheckGeneratedSources = true
isCheckTestSources = false
isCheckReleaseBuilds = false
}
}
}
}
dependencies {
detekt(Libs.Detekt.Formatting)
detekt(Libs.Detekt.Cli)
}
tasks.withType<Detekt> {
parallel = true
config.setFrom(rootProject.file("detekt-config.yml"))
setSource(files(projectDir))
exclude("**/test/**", "**/androidTest/**")
exclude("buildSrc/")
exclude("**/*.kts")
exclude(subprojects.map { "${it.buildDir.relativeTo(rootDir).path}/" })
reports {
xml {
enabled = isCi()
destination = file("build/reports/detekt/detekt-results.xml")
}
html.enabled = !isCi()
txt.enabled = false
}
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
fun isNonStable(version: String): Boolean {
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return !regex.matches(version)
}