-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
187 lines (161 loc) · 8.19 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
buildscript {
apply from: './gradle/config.gradle'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:1.0.2'
classpath "com.google.dagger:hilt-android-gradle-plugin:${versions.hilt}"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:${versions.navigation}"
}
}
apply plugin: 'com.vanniktech.android.junit.jacoco'
apply from: './gradle/config.gradle'
allprojects {
repositories {
google()
jcenter()
}
afterEvaluate {
extensions.findByName('kapt')?.arguments {
// https://speakerdeck.com/jakewharton/helping-dagger-help-you-droidcon-uk-2018
arg('dagger.formatGeneratedSource', 'disabled')
arg('dagger.gradle.incremental', 'enabled')
}
}
}
def packageNameKey = "app_package_name"
def applicationNameKey = "application_name"
subprojects {
afterEvaluate { project ->
apply from: "${project.rootDir}/gradle/config.gradle"
if (project.hasProperty("android")) { //All the android projects
//Apply all the configs for the android block here.
android {
compileSdkVersion sdk.compileSdk
signingConfigs signingConfig
if (project.pluginManager.hasPlugin("com.android.application")) {
//This is the app module
defaultConfig defaultAppConfig
buildTypes {
debug {
versionNameSuffix ".debug"
testCoverageEnabled true
debuggable true
zipAlignEnabled true
signingConfig signingConfigs.debug
// Fabric config
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), './proguard-rules.pro'
debuggable false
jniDebuggable false
shrinkResources true
renderscriptDebuggable false
zipAlignEnabled true
signingConfig signingConfigs.playStore
}
}
} else if (project.pluginManager.hasPlugin("com.android.library")) {
//This is the library module
defaultConfig libDefaultConfig
buildTypes {
debug {
testCoverageEnabled true
debuggable true
signingConfig signingConfigs.debug
zipAlignEnabled true
buildConfigField "String", applicationNameKey.toUpperCase(), "\"${debugDetail.name}\""
buildConfigField "String", packageNameKey.toUpperCase(), "\"${debugDetail.packageName}\""
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), './proguard-rules.pro'
debuggable false
jniDebuggable false
renderscriptDebuggable false
zipAlignEnabled true
signingConfig signingConfigs.playStore
buildConfigField "String", applicationNameKey.toUpperCase(), "\"${releaseDetail.name}\""
buildConfigField "String", packageNameKey.toUpperCase(), "\"${releaseDetail.packageName}\""
}
}
}
//General options
kotlinOptions kotlinOption
compileOptions compileOption
dexOptions dexOption
packagingOptions packageExcludes
lintOptions lintOption
aaptOptions aaptOption
testOptions testOption
androidExtensions { experimental = true }
buildFeatures { dataBinding = true }
dexcount dexcountOptions
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}"
implementation('com.jakewharton.timber:timber:4.7.1', excludeGrp)
implementation "io.reactivex.rxjava2:rxjava:2.2.19"
//Android libs
if (project.hasProperty("android")) {
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
// Hilt dependencies
implementation "com.google.dagger:hilt-android:${versions.hilt}"
kapt "com.google.dagger:hilt-android-compiler:${versions.hilt}"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:${versions.hiltViewModel}"
kapt "androidx.hilt:hilt-compiler:${versions.hiltViewModel}"
//Support libs
implementation 'com.google.android.material:material:1.2.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// Core ktx
implementation 'androidx.core:core-ktx:1.1.0'
implementation "androidx.activity:activity-ktx:1.1.0"
implementation "androidx.fragment:fragment-ktx:1.2.5"
// Arch
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.lifecycle}"
kapt "androidx.lifecycle:lifecycle-compiler:${versions.lifecycle}"
kaptAndroidTest "androidx.lifecycle:lifecycle-compiler:${versions.lifecycle}"
// navigation
implementation "androidx.navigation:navigation-fragment-ktx:${versions.navigation}"
implementation "androidx.navigation:navigation-ui-ktx:${versions.navigation}"
// Android test
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc03'
androidTestImplementation("com.flextrade.jfixture:kfixture:0.2.0", excludeGrp)
androidTestImplementation "com.google.dagger:hilt-android-testing:${versions.hilt}"
kaptAndroidTest "com.google.dagger:hilt-android-compiler:${versions.hilt}"
kaptAndroidTest "androidx.hilt:hilt-compiler:${versions.hiltViewModel}"
}
// Unit test
testImplementation 'junit:junit:4.13'
testImplementation "androidx.test.ext:junit:1.1.1"
testImplementation "androidx.test:rules:1.2.0"
testImplementation "androidx.test:monitor:1.2.0"
testImplementation 'androidx.test:runner:1.2.0'
testImplementation('androidx.arch.core:core-testing:2.1.0', excludeGrp)
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0", excludeGrp)
testImplementation('org.robolectric:robolectric:4.3.1', excludeGrp)
testImplementation("com.flextrade.jfixture:kfixture:0.2.0", excludeGrp)
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}