-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
213 lines (172 loc) · 6.17 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
apply plugin: 'com.android.application'
apply plugin: 'com.github.triplet.play'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
def ext = rootProject.extensions.ext
compileSdkVersion ext.android.compileSdk
defaultConfig {
minSdkVersion ext.android.minSdk
targetSdkVersion ext.android.targetSdk
applicationId ext.application.package
versionCode ext.application.versionCode
versionName ext.application.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resValue "string", "default_package_name", ext.application.package
// Api Keys
def (fabricApiKey, flowUpApiKey) = apiKeysFromFile()
manifestPlaceholders = [fabricApiKey: fabricApiKey]
resValue "string", "flow_up_api_key", flowUpApiKey
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
compileOptions {
sourceCompatibility ext.compiler.java
targetCompatibility ext.compiler.java
}
// Enables long timeouts required on slow environments as Travis
adbOptions {
timeOutInMs 20 * 60 * 1000 // 20 minutes
installOptions "-d", "-t"
}
dexOptions {
preDexLibraries true
javaMaxHeapSize '4G'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
ignore 'InvalidPackage'
}
signingConfigs {
debug {
storeFile file("../debug.keystore.jks")
}
release {
storeFile file("../app.keystore.jks")
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig = signingConfigs.release
}
}
flavorDimensions "sdk"
productFlavors {
fastBuild {
dimension "sdk"
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 21
}
regular {
dimension "sdk"
minSdkVersion ext.android.minSdk
}
}
}
dependencies {
def presentationDependencies = rootProject.ext.presentationDependencies
def presentationTestDependencies = rootProject.ext.presentationTestDependencies
implementation project(':domain')
implementation project(':data')
implementation presentationDependencies.kotlinStdLib
implementation presentationDependencies.kotlinReflect
implementation presentationDependencies.multiDex
implementation presentationDependencies.flowUp
implementation presentationDependencies.supportVersion
implementation presentationDependencies.appCompat
implementation presentationDependencies.design
implementation presentationDependencies.recyclerView
implementation presentationDependencies.preferenceCompat
implementation presentationDependencies.fab
implementation presentationDependencies.dexter
implementation presentationDependencies.zxingAndroidEmbedded
implementation presentationDependencies.robinHoodTicker
implementation presentationDependencies.materialDialogs
implementation(presentationDependencies.materialDrawer) {
transitive = true
}
implementation(presentationDependencies.crashlytics) {
transitive = true
}
kapt presentationDependencies.daggerCompiler
implementation presentationDependencies.dagger
implementation presentationDependencies.rxJava
implementation presentationDependencies.rxAndroid
compileOnly presentationDependencies.javaxAnnotation
androidTestImplementation presentationTestDependencies.androidAnnotations
androidTestImplementation presentationTestDependencies.supportRunner
androidTestImplementation presentationTestDependencies.supportRules
androidTestImplementation presentationTestDependencies.espressoCore
androidTestImplementation presentationTestDependencies.espressoIntents
}
play {
jsonFile = file('../gplay-secret.json')
track = 'beta'
}
def (debugPassword, releaseKeystorePassword, releaseKeyAlias, releaseKeyPassword) =
signingConfigFromFile()
if (debugPassword != null && releaseKeystorePassword != null && releaseKeyAlias != null && releaseKeyPassword != null) {
android.signingConfigs.debug.storePassword = debugPassword
android.signingConfigs.debug.keyPassword = debugPassword
android.signingConfigs.release.storePassword = releaseKeystorePassword
android.signingConfigs.release.keyAlias = releaseKeyAlias
android.signingConfigs.release.keyPassword = releaseKeyPassword
} else {
println "Unable to find the right credentials to sign the apk :("
android.buildTypes.release.signingConfig = null
}
def signingConfigFromFile() {
println '-> signingConfigFromFile'
Properties props = new Properties()
def propFile = file('../signing.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null &&
props.containsKey('DEBUG_PASSWORD') &&
props.containsKey('RELEASE_STORE_PASSWORD') &&
props.containsKey('RELEASE_KEY_ALIAS') &&
props.containsKey('RELEASE_KEY_PASSWORD')) {
def debugPassword = props['DEBUG_PASSWORD']
def releaseKeystorePassword = props['RELEASE_STORE_PASSWORD']
def releaseKeyAlias = props['RELEASE_KEY_ALIAS']
def releaseKeyPassword = props['RELEASE_KEY_PASSWORD']
return [debugPassword, releaseKeystorePassword, releaseKeyAlias, releaseKeyPassword]
} else {
println 'signing.properties found but some entries are missing'
}
} else {
println 'signing.properties not found'
}
return [null, null, null]
}
def apiKeysFromFile() {
println '-> apiKeysFromFile'
Properties props = new Properties()
def propFile = file('../api-keys.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('FABRIC') && props.containsKey('FLOW_UP')) {
def fabricApiKey = props['FABRIC']
def flowUpApiKey = props['FLOW_UP']
return [fabricApiKey, flowUpApiKey]
} else {
println 'api-keys.properties found but some entries are missing'
}
} else {
println 'api-keys.properties not found'
}
return [null, null]
}