-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
147 lines (120 loc) · 3.36 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
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
143
144
145
146
147
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
apply from: "gradle/dependencies.gradle"
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
dependencies {
classpath libs.android.gradlePlugin
classpath libs.kotlin.gradlePlugin
classpath libs.mavenPublishGradlePlugin
classpath libs.dokka.gradlePlugin
classpath libs.detekt.gradlePlugin
classpath libs.gradleVersions.gradlePlugin
classpath libs.kotlin.x.binaryCompatibility.gradlePlugin
}
}
apply plugin: libs.kotlin.x.binaryCompatibility.gradlePluginId
apiValidation {
ignoredProjects += ["sample"]
}
allprojects {
repositories {
mavenCentral()
google()
}
group GROUP
version VERSION_NAME
tasks.withType(Test) {
testLogging {
events "skipped", "failed", "passed"
}
}
tasks.withType(JavaCompile) {
sourceCompatibility JavaVersion.VERSION_1_8.toString()
targetCompatibility JavaVersion.VERSION_1_8.toString()
}
tasks.withType(KotlinCompile) {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs += [
"-progressive",
// TODO: Remove API in tests https://youtrack.jetbrains.com/issue/KT-42718
"-Xexplicit-api=strict",
]
}
}
pluginManager.withPlugin("com.android.library") {
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion versions.androidBuild.compileSdk
defaultConfig {
minSdkVersion versions.androidBuild.minSdk
targetSdkVersion versions.androidBuild.targetSdk
vectorDrawables.useSupportLibrary true
}
variantFilter { variant ->
setIgnore variant.name != "release"
}
libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "${archivesBaseName}-${version}.aar"
}
}
lintOptions {
lintConfig rootProject.file("lint.xml")
htmlReport !isCi()
xmlReport isCi()
xmlOutput file("build/reports/lint/lint-results.xml")
textReport true
textOutput "stdout"
explainIssues false
checkDependencies false
checkGeneratedSources true
checkTestSources false
checkReleaseBuilds false
}
}
}
}
apply plugin: libs.detekt.gradlePluginId
dependencies {
detekt libs.detekt.formatting
detekt libs.detekt.cli
detektPlugins libs.kurePotlin
}
tasks.withType(Detekt) {
parallel true
config.setFrom(rootProject.files("detekt-config.yml"))
setSource(files(projectDir))
exclude "**/test/**", "**/androidTest/**"
exclude subprojects.collect { "${rootDir.toPath().relativize(it.buildDir.toPath())}/" }
reports {
xml {
enabled = isCi()
destination = file("build/reports/detekt/detekt-results.xml")
}
html.enabled = !isCi()
txt.enabled = false
}
}
apply plugin: libs.gradleVersions.gradlePluginId
dependencyUpdates {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
private static def isNonStable(String version) {
def regex = /^[0-9,.v-]+(-r)?$/
return !(version ==~ regex)
}
private static def isCi() {
// noinspection GroovyPointlessBoolean
return System.getenv("CI")?.toBoolean() == true
}