-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
79 lines (66 loc) · 2.39 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.sonarqube.gradle.SonarQubeExtension
apply(plugin = "org.sonarqube")
apply(plugin = "jacoco")
apply(plugin = "com.github.ben-manes.versions")
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(Libs.buildGradle)
classpath(Libs.kotlinPlugin)
classpath(Libs.safeargs)
classpath(Libs.googleServices)
classpath(Libs.crashlyticsGradle)
classpath(Libs.sonarGradle)
classpath(Libs.jacocoGradle)
classpath(Libs.gradleVersionsPlugin)
}
}
allprojects {
repositories {
google()
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://plugins.gradle.org/m2/")
}
}
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.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
tasks.register("jacocoTestReport", JacocoReport::class) {
reports {
xml.required.set(true)
html.required.set(false)
}
}
// region Sonarqube Configuration
val sonarQubeExtension = project.extensions.getByName("sonarqube") as SonarQubeExtension
val sonarqubeFile = "sonar.properties"
val sonarProperties = gradleFileProperties(rootDir, sonarqubeFile)
sonarQubeExtension.properties {
property("sonar.projectName", sonarProperties.getProperty("projectName"))
property("sonar.projectKey", sonarProperties.getProperty("projectKey"))
property("sonar.host.url", sonarProperties.getProperty("hostUrl"))
property("sonar.language", sonarProperties.getProperty("language"))
property("sonar.sources", sonarProperties.getProperty("sources"))
property("sonar.login", sonarProperties.getProperty("loginToken"))
property("sonar.test", sonarProperties.getProperty("testSource"))
property("sonar.java.coveragePlugin", sonarProperties.getProperty("coveragePlugin"))
property("sonar.android.lint.report", sonarProperties.getProperty("lintReport"))
}
//endregion