-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
98 lines (81 loc) · 2.55 KB
/
Copy pathbuild.gradle
File metadata and controls
98 lines (81 loc) · 2.55 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
86
87
88
89
90
91
92
93
94
95
96
97
98
buildscript {
ext {
kotlinVersion = '1.3.21'
}
ext.deps = [
kotlinRuntime: "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion",
junit: 'junit:junit:4.12',
testRunner: 'androidx.test:runner:1.1.1',
testRules: 'androidx.test:rules:1.1.1',
junitAndroidTest: 'androidx.test.ext:junit:1.1.0',
espressoCore: 'androidx.test.espresso:espresso-core:3.1.1',
mockitoAndroid: 'org.mockito:mockito-android:2.21.0',
]
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
configureAndroidPlugin(it)
configureKotlinLint(it)
}
def configureAndroidPlugin(Project project) {
def closure = {
project.android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/*.kotlin_module'
exclude 'kotlin/**'
exclude 'META-INF/*.version'
}
}
}
project.plugins.withId('com.android.application', closure)
project.plugins.withId('com.android.library', closure)
}
static def configureKotlinLint(Project project) {
def closure = {
project.configurations {
ktlint
}
project.dependencies {
ktlint 'com.github.shyiko:ktlint:0.31.0'
}
def ktlintCheck = project.tasks.create('ktlintCheck', JavaExec.class) {
main = 'com.github.shyiko.ktlint.Main'
classpath = project.configurations.ktlint
args 'src/**/*.kt'
}
project.check.dependsOn ktlintCheck
project.tasks.create('ktlintFormat', JavaExec.class) {
main = 'com.github.shyiko.ktlint.Main'
classpath = project.configurations.ktlint
args '-r', 'src/**/*.kt'
}
}
project.plugins.withId('kotlin-android', closure)
project.plugins.withId('kotlin', closure)
}