-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.gradle.kts
106 lines (97 loc) · 3.87 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
buildscript {
repositories {
mavenLocal()
google()
mavenCentral()
gradlePluginPortal()
// maven("https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
classpath(libs.ruler.gradlePluginClasspath)
}
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.gms) apply false // must be defined BEFORE firebase
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.firebase.perf) apply false
alias(libs.plugins.room) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.licenseManager) apply false
alias(libs.plugins.detekt) apply false
alias(libs.plugins.kover) apply false
alias(libs.plugins.versions)
alias(libs.plugins.dependencyAnalysis)
}
allprojects {
// Gradle Dependency Reports
// ./gradlew -q app:dependencies --configuration debugCompileClasspath > deps.txt
// ./gradlew app:dependencies --scan.
// Gradle Dependency Check
// ./gradlew dependencyUpdates -Drevision=release
// ./gradlew dependencyUpdates -Drevision=release --refresh-dependencies
apply(plugin = rootProject.libs.plugins.versions.get().pluginId)
val excludeVersionContaining = listOf("alpha", "eap", "M1", "dev") // example: "alpha", "beta"
// some artifacts may be OK to check for "alpha"... add these exceptions here
val ignoreArtifacts = buildList {
addAll(listOf("room-compiler"))
// Compose
// addAll(listOf("material3", "ui", "ui-tooling-preview", "ui-test-junit4", "ui-test-manifest", "material3-window-size-class", "compiler"))
// addAll(listOf("window")) // material3 uses latest 1.1.0-alpha
}
tasks.named<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask>("dependencyUpdates") {
resolutionStrategy {
componentSelection {
all {
if (ignoreArtifacts.contains(candidate.module).not()) {
val rejected = excludeVersionContaining.any { qualifier ->
candidate.version.matches(Regex("(?i).*[.-]$qualifier[.\\d-+]*"))
}
if (rejected) {
reject("Release candidate")
}
}
}
}
}
}
}
// ===== Dependency Analysis =====
// ./gradlew projectHealth
dependencyAnalysis {
issues {
all {
onAny {
ignoreKtx(true)
severity("fail")
}
onUnusedDependencies {
exclude(
depGroupAndName(libs.xerial.sqlite), // loaded in tests via JDBC reflection
depGroupAndName(libs.leakCanary),
"androidx.test:core" // work around for supporting tests on Android 33 devices (https://issuetracker.google.com/issues/240993946) till ui-test-junit4 updates its dependencies (fixed with ui-test:1.4.0-alpha03+)
)
}
onUsedTransitiveDependencies { severity("ignore") }
onIncorrectConfiguration { severity("ignore") }
onCompileOnly { severity("ignore") }
onRuntimeOnly { severity("ignore") }
onUnusedAnnotationProcessors {
exclude(
depGroupAndName(libs.google.hilt.compiler)
)
}
}
}
}
fun depGroupAndName(dependency: Provider<MinimalExternalModuleDependency>): String {
return dependency.get().let { "${it.group}:${it.name}" }
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}