forked from Wolox/WoloxAndroidBootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquality.gradle
59 lines (47 loc) · 1.42 KB
/
quality.gradle
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
apply plugin: 'checkstyle'
configurations {
ktlint
}
buildscript {
ext.ktlint_version = '0.27.0'
}
dependencies {
ktlint "com.github.shyiko:ktlint:$ktlint_version"
}
task checkstyle(type: Checkstyle) {
description 'Run checkstyle'
group 'verification'
showViolations = true
configFile file('quality/checkstyle/checkstyle.xml')
// Expose ${configDir} in Checkstyle files
configProperties = ['configDir': file('quality/checkstyle')]
// empty classpath
classpath = files()
source 'src/main/java'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
ignoreFailures = false
reports {
xml.enabled = false
html.enabled = true
html.destination = file("$project.buildDir/reports/checkstyle.html")
}
}
task ktlint(type: JavaExec) {
group = 'verification'
description = 'Check Kotlin code style'
main = 'com.github.shyiko.ktlint.Main'
classpath = configurations.ktlint
args 'src/**/*.kt', "--reporter=checkstyle", "output=${project.buildDir}/reports/ktlint.xml"
}
task ktlintFormat(type: JavaExec) {
group = 'formatting'
description = 'Fix Kotlin code style deviations'
main = 'com.github.shyiko.ktlint.Main'
classpath = configurations.ktlint
args '-F', 'src/**/*.kt'
}
preBuild.dependsOn 'checkstyle', 'ktlintFormat'
check.dependsOn 'checkstyle', 'ktlintFormat', 'ktlint'