-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
80 lines (65 loc) · 2 KB
/
build.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
buildscript {
System.setProperty("java.awt.headless", "true") // mergeDebugResources spawns annoying AWT UI
ext {
versions = [
android : "3.0+",
kotlin : "1.1.51",
gradleVersions: "0.17.0",
supportTest : "1.0.1",
anko : "0.10.2",
]
}
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$versions.android"
classpath "com.github.ben-manes:gradle-versions-plugin:$versions.gradleVersions"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
}
}
apply plugin: "com.github.ben-manes.versions"
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 12
targetSdkVersion 26
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
sourceSets.each {
it.java.srcDirs += "src/${it.name}/kotlin"
}
}
repositories {
jcenter()
google()
}
configurations {
ktlint
}
dependencies {
ktlint "com.github.shyiko:ktlint:0.22.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin"
androidTestImplementation "com.android.support.test:runner:$versions.supportTest"
androidTestImplementation "io.kotlintest:kotlintest:2.0.7"
androidTestImplementation "org.jetbrains.anko:anko-commons:$versions.anko"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
// to generate report in checkstyle format prepend following args:
// "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
// see https://github.com/shyiko/ktlint#usage for more
}
check.dependsOn ktlint
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"
}