-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
build.gradle.kts
82 lines (72 loc) · 2.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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://maven.google.com")
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN_GRADLE_PLUGIN}")
classpath("org.jlleitschuh.gradle:ktlint-gradle:${Versions.KTLINT_GRADLE}")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.NAVIGATION_GRAPH}")
classpath("com.google.gms:google-services:${Versions.GOOGLE_SERVICES}")
classpath("com.google.firebase:firebase-crashlytics-gradle:${Versions.FIREBASE_CRASHLYTICS_GRADLE}")
classpath("org.jacoco:org.jacoco.core:${Versions.JACOCO}")
classpath("com.github.ben-manes:gradle-versions-plugin:${Versions.BEN_MANES_VERSION_PLUGIN}")
classpath("com.vanniktech:gradle-maven-publish-plugin:${Versions.GRADLE_MAVEN_PUBLISH}")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2")
}
}
apply(from = "$rootDir/scripts/autoUpdateDeps.gradle.kts")
apply(plugin = "com.github.ben-manes.versions")
ktlint {
version.set(Versions.KTLINT)
additionalEditorconfigFile.set(file("./.editorconfig"))
}
plugins {
id("io.gitlab.arturbosch.detekt").version(Versions.DETEKT)
id("com.google.devtools.ksp").version(Versions.KSP)
id("org.jlleitschuh.gradle.ktlint").version(Versions.KTLINT_GRADLE)
id("org.jetbrains.kotlin.android") version "1.8.0" apply false
jacoco
}
allprojects {
repositories {
google()
mavenCentral()
maven("https://plugins.gradle.org/m2/")
maven("https://maven.google.com")
maven(url = "https://jitpack.io")
}
}
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent
// Optionally configure plugin
ktlint {
disabledRules.set(setOf("no-wildcard-imports"))
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
tasks.withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> {
val nonStableKeywords = listOf("rc", "Alpha", "Beta", "SNAPSHOT", "ea", "preview")
fun isNonStable(version: String): Boolean {
val containsNonStableKeyword =
nonStableKeywords.any { version.toUpperCase().contains(it.toUpperCase()) }
val containsHyphen = version.contains("-")
return containsNonStableKeyword || containsHyphen
}
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Non-stable version")
}
}
}
}
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")