-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
85 lines (75 loc) · 2.46 KB
/
build.gradle
File metadata and controls
85 lines (75 loc) · 2.46 KB
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
apply plugin: "com.github.ben-manes.versions"
allprojects {
repositories {
google()
mavenCentral()
}
}
buildscript {
apply from: "$rootDir/dependencies.gradle"
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath libs.gradle.plugin.android
classpath libs.gradle.plugin.kotlin
classpath libs.gradle.plugin.crashlytics
classpath libs.gradle.plugin.ktlint
classpath libs.gradle.plugin.googleservices
classpath libs.gradle.plugin.gradleversions
classpath libs.gradle.plugin.detekt
}
}
subprojects {
// KTLint (Kotlin code style enforcer)
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
android = true
outputToConsole = true
}
// Detekt (Kotlin static analyser)
apply plugin: "io.gitlab.arturbosch.detekt"
detekt {
allRules = true // Include all rules
buildUponDefaultConfig = true // preconfigure defaults (see the rule set file below for explanations)
config = files("${project.rootDir}/config/detekt/detekt-config.yaml") // point to your custom config defining rules to run, overwriting default behavior
reports {
html.enabled = true // Create a HTML report
xml.enabled = false // XML report not needed
txt.enabled = false // txt report not needed
}
}
tasks.detekt.jvmTarget = "1.8"
afterEvaluate {
// Make sure detekt is executed with all the other linters for all modules
check.dependsOn "detekt"
}
def GROUP_VERIFICATION_TASKS = "Verification"
task checkCode(dependsOn: ["detekt", "ktlintCheck"])
checkCode.group = GROUP_VERIFICATION_TASKS
checkCode.description = "Run detekt and ktlint"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Don't show non stable updates for current stable versions
def isNonStable = { String version ->
def stableKeyword = ["RELEASE", "FINAL", "GA"].any { keyword -> version.toUpperCase().contains(keyword) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
dependencyUpdates {
checkForGradleUpdate = true
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Release candidate")
}
}
}
}
}