-
Notifications
You must be signed in to change notification settings - Fork 103
/
build.gradle.kts
94 lines (78 loc) · 3.04 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
subprojects {
repositories {
mavenCentral()
google()
maven { url = uri("https://jitpack.io") }
}
}
// to print a sensible task graph, uncomment the following lines and run:
// $ gradlew :app:assembleDebug taskTree --no-repeat
// plugins {
// id("com.dorongold.task-tree") version "1.5"
// }
defaultTasks("assembleDebug")
repositories {
google()
}
buildscript {
repositories {
mavenCentral()
google()
maven("https://plugins.gradle.org/m2/")
}
dependencies {
classpath("com.android.tools.build:gradle:8.2.2")
classpath("org.aspectj:aspectjtools:1.9.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.9.20")
classpath("com.ibotta:plugin:1.4.1")
}
}
subprojects {
tasks.withType<Test> {
useJUnitPlatform() // aka JUnit 5
testLogging {
outputs.upToDateWhen { false } // always rerun tests
events("skipped", "failed")
// https://github.com/gradle/gradle/issues/5431
// https://github.com/gradle/kotlin-dsl-samples/issues/836#issuecomment-384206237
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
// print only the bottom-level test result information
if (suite.className == null) return
val details = if (result.skippedTestCount > 0 || result.failedTestCount > 0) {
": ${result.successfulTestCount} successes, " +
"${result.failedTestCount} failures, " +
"${result.skippedTestCount} skipped"
} else {
""
}
println("${suite.displayName}: ${result.resultType} " +
"(${result.testCount} tests$details)")
}
})
}
}
}
// The below is a plugin that checks for dependency updates.
// To get a plain text report, run:
// $ ./gradlew dependencyUpdates
// See https://github.com/ben-manes/gradle-versions-plugin
plugins {
id("com.github.ben-manes.versions") version "0.50.0"
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}