forked from moxy-community/Moxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
74 lines (65 loc) · 2.18 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.35.1")
}
}
plugins {
id("com.github.ben-manes.versions") version "0.31.0"
id("org.jetbrains.dokka") version "1.4.32"
id("com.vanniktech.maven.publish") version "0.15.1" apply false
}
subprojects {
repositories {
google()
mavenCentral()
maven {
setUrl("https://kotlin.bintray.com/kotlinx")
content {
includeGroup("org.jetbrains.kotlinx")
}
}
val repo = maven {
url = rootProject.file("build/localMavenPublish").toURI()
content {
includeGroup("com.github.moxy-community")
}
}
// The only way to put the repository to the top using public api
remove(repo)
addFirst(repo)
}
}
subprojects {
apply(plugin = "checkstyle")
tasks.register<Checkstyle>("checkstyle") {
description = "Runs Checkstyle inspection"
group = "moxy"
configFile = rootProject.file("checkstyle.xml")
ignoreFailures = false
isShowViolations = true
classpath = files()
exclude("**/*.kt")
source("src/main/java")
}
// check code style after project evaluation
afterEvaluate {
tasks.named("check").configure { dependsOn("checkstyle") }
}
}
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<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask>("dependencyUpdates").configure {
rejectVersionIf { isNonStable(candidate.version) }
}