-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
304 lines (240 loc) · 9.72 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
plugins {
id 'com.android.application'
id 'kotlin-android'
id("dagger.hilt.android.plugin")
id 'com.google.gms.google-services'
id "com.starter.easylauncher" version "$easylauncher_version"
id("de.mannodermaus.android-junit5")
}
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.application'
def getKeystoreProperties(String fileName) {
def properties = new Properties()
properties.setProperty("keyAlias", "")
properties.setProperty("keyPassword", "")
properties.setProperty("storeFile", "")
properties.setProperty("storePassword", "")
try {
def propsFile = rootProject.file(fileName)
// Attempt to get keystore properties from local file first (to build locally) before
// attempting to fetch from environment variables second (to build on the build server)
if (propsFile.exists()) {
properties.load(new FileInputStream(propsFile))
} else {
getPropertiesFromEnvironmentVariables(properties)
}
} catch (Exception e) {
properties = null
println "Unable to read KeyStore"
e.printStackTrace()
}
return properties
}
static def getPropertiesFromEnvironmentVariables(Properties properties) {
properties.setProperty("keyAlias", System.getenv("BITRISEIO_ANDROID_KEYSTORE_ALIAS"))
properties.setProperty("keyPassword", System.getenv("BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD"))
properties.setProperty("storeFile", System.getenv("BITRISE_KEY_DOWNLOAD_PATH"))
properties.setProperty("storePassword", System.getenv("BITRISEIO_ANDROID_KEYSTORE_PASSWORD"))
}
def RELEASE_KEYSTORE = getKeystoreProperties('keystore_local.properties')
def getProperties(String propFileName) {
Properties properties = new Properties()
File file = project.rootProject.file(propFileName)
if(file.exists()) {
properties.load(file.newDataInputStream())
}
return properties
}
def getLocalProperty(String propFileName, String prop) {
Properties properties = getProperties(propFileName)
String property = properties.getProperty(prop, "")
return property
}
def getMapsKey(String environment) {
def propertyName = "MAPS_KEY_" + environment
def ciValue = System.getenv(propertyName)
if(ciValue != null){
return ciValue
}else{
return getLocalProperty('local.properties', propertyName)
}
}
android {
compileSdk 31
defaultConfig {
applicationId "com.andrei.car_rental_android"
minSdk 29
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
signingConfigs {
debug {
if (RELEASE_KEYSTORE != null) {
storeFile file(RELEASE_KEYSTORE.getProperty("storeFile"))
storePassword RELEASE_KEYSTORE.getProperty("storePassword")
keyAlias RELEASE_KEYSTORE.getProperty("keyAlias")
keyPassword RELEASE_KEYSTORE.getProperty("keyPassword")
}
}
release {
if (RELEASE_KEYSTORE != null) {
storeFile file(RELEASE_KEYSTORE.getProperty("storeFile"))
storePassword RELEASE_KEYSTORE.getProperty("storePassword")
keyAlias RELEASE_KEYSTORE.getProperty("keyAlias")
keyPassword RELEASE_KEYSTORE.getProperty("keyPassword")
}
}
}
buildTypes {
debug {
testCoverageEnabled true
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
shrinkResources true
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
applicationIdSuffix ".dev"
manifestPlaceholders = [MAPS_API_KEY : getMapsKey("DEV")]
buildConfigField 'String', 'BASE_URL', '"https://car-rental-api-dev.herokuapp.com/"'
buildConfigField 'String', 'VERIFICATION_TEMPLATE_ID', '"itmpl_hzSxrEP6XvUT1wBocRTa6PHs"'
}
qa {
dimension "environment"
applicationIdSuffix ".qa"
manifestPlaceholders = [MAPS_API_KEY : getMapsKey("QA")]
buildConfigField 'String', 'BASE_URL', '"https://car-rental-api-dev.herokuapp.com/"'
buildConfigField 'String', 'VERIFICATION_TEMPLATE_ID', '"itmpl_hzSxrEP6XvUT1wBocRTa6PHs"'
//todo
//once api is sorted change to QA
// buildConfigField 'String', 'BASE_URL', '"https://car-rental-api-staging.herokuapp.com/"'
}
prod {
dimension "environment"
manifestPlaceholders = [MAPS_API_KEY : getMapsKey("PROD")]
buildConfigField 'String', 'BASE_URL', '"https://car-rental-api-prod.herokuapp.com/"'
buildConfigField 'String', 'VERIFICATION_TEMPLATE_ID', '"itmpl_hzSxrEP6XvUT1wBocRTa6PHs"'
}
}
easylauncher {
defaultFlavorNaming true
def versionLabel = "${android.defaultConfig.versionName}-${android.defaultConfig.versionCode}"
productFlavors {
dev {
// filters = [
// chromeLike(label: versionLabel),
// blueRibbonFilter()
// ]
enable false
}
staging {
filters = [
chromeLike(label: versionLabel),
grayRibbonFilter()
]
}
prod {
enable false
}
}
}
}
dependencies {
def lifecycle_version = '2.5.0-alpha06'
def mockk_version = '1.12.3'
def coroutine_version = '1.6.1'
implementation 'com.withpersona.sdk2:inquiry:2.2.13'
//logging
implementation 'com.jakewharton.timber:timber:5.0.1'
//payment
implementation 'com.stripe:stripe-android:20.0.0'
//image loading
implementation("io.coil-kt:coil-compose:2.0.0-rc02")
//data store
implementation "androidx.datastore:datastore:1.0.0"
implementation "androidx.datastore:datastore-preferences:1.0.0"
//animation
implementation "com.airbnb.android:lottie-compose:5.0.3"
//compose utils
implementation "com.google.accompanist:accompanist-systemuicontroller:0.20.2"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.9.0'
//coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutine_version"
//maps
//dependencies described here
//https://github.com/googlemaps/android-maps-ktx
implementation 'com.google.android.gms:play-services-maps:18.0.2'
implementation 'com.google.maps.android:maps-compose:2.1.0'
implementation 'com.google.android.gms:play-services-location:19.0.1'
//google play core
implementation("com.google.android.play:core:1.10.3")
implementation("com.google.android.play:core-ktx:1.8.1")
//navigation
implementation("androidx.navigation:navigation-compose:2.5.0-alpha04")
//dependency injection
implementation("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")
implementation("androidx.hilt:hilt-navigation-compose:1.0.0")
//lifecycle
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version")
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.activity:activity-compose:1.4.0"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
//-------TESTING AND DEBUGGING--------
//test implementation
testImplementation "io.mockk:mockk:$mockk_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutine_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation 'app.cash.turbine:turbine:0.7.0'
//android test implementation
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
//debug implementation
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
}