Files
super-app/app/build.gradle

477 lines
19 KiB
Groovy

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id 'maven-publish'
id 'com.google.firebase.crashlytics'
id 'com.google.gms.google-services'
id 'com.google.firebase.firebase-perf'
id 'dagger.hilt.android.plugin'
id 'hypersdk-asset-plugin'
}
kapt {
correctErrorTypes true
}
def VERSION_CODE = 323
def VERSION_NAME = "3.4.2"
android {
namespace 'com.naviapp'
compileSdk 32
buildToolsVersion "30.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
incremental true
}
testOptions {
unitTests.returnDefaultValues = true
}
kotlinOptions {
jvmTarget = '1.8'
}
lint {
disable 'NullSafeMutableLiveData'
}
defaultConfig {
applicationId "com.naviapp"
minSdk 21
targetSdk 31
versionCode VERSION_CODE
versionName VERSION_NAME
resConfigs "en"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
}
signingConfigs {
debug {
storeFile file('../keystore/navi-debug-key.jks')
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release {
if (project.hasProperty('RELEASE_STORE_PASSWORD') && project.hasProperty('RELEASE_KEY_PASSWORD') && project.hasProperty('RELEASE_KEY_ALIAS')) {
storeFile file("navi-release-key.jks")
storePassword "$RELEASE_STORE_PASSWORD"
keyPassword "$RELEASE_KEY_PASSWORD"
keyAlias "$RELEASE_KEY_ALIAS"
}
}
}
sourceSets {
dev {
androidTest {
java.srcDirs = ['src/androidTestDev/java', 'src/androidTestMockServer/java', 'src/androidTestLibrary/java']
}
test {
java.srcDirs = ['src/test/java']
}
}
release {
java.srcDirs = ['src/main/java', 'src/release/java']
}
debug {
java.srcDirs = ['src/main/java', 'src/debug/java']
}
}
buildTypes {
debug {
versionNameSuffix "-debug"
testCoverageEnabled = true
manifestPlaceholders = [branchMode: 'true']
FirebasePerformance {
instrumentationEnabled false
}
testCoverageEnabled false
signingConfig signingConfigs.debug
}
release {
debuggable false
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
manifestPlaceholders = [branchMode: 'false']
}
}
buildFeatures {
dataBinding true
compose true
}
bundle {
language {
enableSplit = false
}
density {
enableSplit = true
}
abi {
enableSplit = true
}
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
flavorDimensions "app"
productFlavors {
qa {
dimension "app"
applicationId "com.naviapp.dev"
buildConfigField 'String', 'BASE_URL_QA', formatString('https://qa-sa.navi.com/')
buildConfigField 'String', 'BASE_URL_DEV', formatString('https://dev-sa.navi.com/')
buildConfigField 'String', 'BASE_URL', formatString('https://qa-sa.navi.com/')
buildConfigField 'String', 'MOENGAGE_KEY', formatString('2PDJ4M6TDY7ADQ5N5LU48H9Y')
buildConfigField 'String', 'APPSFLYER_KEY', formatString('ua6cppJ9oQx7aPQPNyHrHA')
buildConfigField 'String', 'HYPERVERGE_APP_KEY', formatString('c9b1e034f7c8961a3f5b')
buildConfigField 'String', 'HYPERVERGE_APP_ID', formatString('2c007b')
buildConfigField 'String', 'XIAOMI_PUSH_APP_ID', formatString('2882303761520048763')
buildConfigField 'String', 'XIAOMI_PUSH_APP_KEY', formatString('5712004833763')
manifestPlaceholders = [TRUECALLER_KEY: "6E6TX0cd28bada2b14cf28534dfce68c6a245", FACEBOOK_APP_ID: "0"]
buildConfigField 'String', 'GI_SECRET_KEY', formatString('navi-gi')
buildConfigField 'String', 'YOUTUBE_KEY', formatString('AIzaSyDlbxag2dCc-a9ac8JTfH3nnVw41pdI-1U')
buildConfigField 'String', 'GOOGLE_MAPS_KEY', formatString("AIzaSyD-7-YhOAzX4VJfVLsHUz8KEn-1MGJq46o")
}
dev {
applicationId "com.naviapp.dev"
dimension "app"
buildConfigField 'String', 'BASE_URL_QA', formatString('https://qa-sa.navi.com/')
buildConfigField 'String', 'BASE_URL_DEV', formatString('https://dev-sa.navi.com/')
buildConfigField 'String', 'BASE_URL', formatString('https://dev-sa.navi.com/')
buildConfigField "String", "MOENGAGE_KEY", formatString('2PDJ4M6TDY7ADQ5N5LU48H9Y')
buildConfigField "String", "APPSFLYER_KEY", formatString('ua6cppJ9oQx7aPQPNyHrHA')
buildConfigField 'String', 'HYPERVERGE_APP_KEY', formatString('c9b1e034f7c8961a3f5b')
buildConfigField 'String', 'HYPERVERGE_APP_ID', formatString('2c007b')
buildConfigField 'String', 'XIAOMI_PUSH_APP_ID', formatString('2882303761520048763')
buildConfigField 'String', 'XIAOMI_PUSH_APP_KEY', formatString('5712004833763')
manifestPlaceholders = [TRUECALLER_KEY: "aBkmX155b2ed283a44b008d62e8975388a4d5", FACEBOOK_APP_ID: "0"]
buildConfigField 'String', 'GI_SECRET_KEY', formatString('navi-gi')
buildConfigField 'String', 'YOUTUBE_KEY', formatString('AIzaSyDlbxag2dCc-a9ac8JTfH3nnVw41pdI-1U')
buildConfigField 'String', 'GOOGLE_MAPS_KEY', formatString("AIzaSyD-7-YhOAzX4VJfVLsHUz8KEn-1MGJq46o")
}
prod {
dimension "app"
if (project.hasProperty('BASE_URL') && project.hasProperty('MOENGAGE_KEY') && project.hasProperty('APPSFLYER_KEY') && project.hasProperty('UXCAM_KEY') && project.hasProperty('HYPERVERGE_APP_KEY') && project.hasProperty('HYPERVERGE_APP_ID') && project.hasProperty('TRUECALLER_KEY') && project.hasProperty('GI_SECRET_KEY')
&& project.hasProperty('GI_RAZORPAY_KEY') && project.hasProperty('XIAOMI_PUSH_APP_ID') && project.hasProperty('XIAOMI_PUSH_APP_KEY') && project.hasProperty('GOOGLE_MAPS_KEY') && project.hasProperty('GI_RAZORPAY_KEY') && project.hasProperty('FACEBOOK_APP_ID')) {
buildConfigField 'String', 'BASE_URL_QA', formatString('https://qa-sa.navi.com/')
buildConfigField 'String', 'BASE_URL_DEV', formatString('https://dev-sa.navi.com/')
buildConfigField 'String', 'BASE_URL', formatString("$BASE_URL")
buildConfigField 'String', 'MOENGAGE_KEY', formatString("$MOENGAGE_KEY")
buildConfigField 'String', 'APPSFLYER_KEY', formatString("$APPSFLYER_KEY")
buildConfigField 'String', 'HYPERVERGE_APP_KEY', formatString("$HYPERVERGE_APP_KEY")
buildConfigField 'String', 'HYPERVERGE_APP_ID', formatString("$HYPERVERGE_APP_ID")
buildConfigField 'String', 'XIAOMI_PUSH_APP_ID', formatString("$XIAOMI_PUSH_APP_ID")
buildConfigField 'String', 'XIAOMI_PUSH_APP_KEY', formatString("$XIAOMI_PUSH_APP_KEY")
manifestPlaceholders = [TRUECALLER_KEY : "$TRUECALLER_KEY", GOOGLE_MAPS_KEY: "$GOOGLE_MAPS_KEY", FACEBOOK_APP_ID: "$FACEBOOK_APP_ID"]
buildConfigField 'String', 'GOOGLE_MAPS_KEY', formatString("$GOOGLE_MAPS_KEY")
buildConfigField 'String', 'GI_SECRET_KEY', formatString("$GI_SECRET_KEY")
buildConfigField 'String', 'YOUTUBE_KEY', formatString("$YOUTUBE_KEY")
buildConfigField 'String', 'GI_RAZORPAY_KEY', formatString("$GI_RAZORPAY_KEY")
}
}
mockServer {
applicationId "com.naviapp.test"
dimension "app"
buildConfigField 'String', 'BASE_URL', formatString('http://localhost:7000/')
buildConfigField "String", "MOENGAGE_KEY", formatString('2PDJ4M6TDY7ADQ5N5LU48H9Y')
buildConfigField "String", "APPSFLYER_KEY", formatString('ua6cppJ9oQx7aPQPNyHrHA')
buildConfigField 'String', 'HYPERVERGE_APP_KEY', formatString('c9b1e034f7c8961a3f5b')
buildConfigField 'String', 'HYPERVERGE_APP_ID', formatString('2c007b')
buildConfigField 'String', 'XIAOMI_PUSH_APP_ID', formatString('2882303761520048763')
buildConfigField 'String', 'XIAOMI_PUSH_APP_KEY', formatString('5712004833763')
manifestPlaceholders = [TRUECALLER_KEY: "6E6TX0cd28bada2b14cf28534dfce68c6a245", FACEBOOK_APP_ID: "0"]
buildConfigField 'String', 'GI_SECRET_KEY', formatString('navi-gi')
buildConfigField 'String', 'YOUTUBE_KEY', formatString('AIzaSyDlbxag2dCc-a9ac8JTfH3nnVw41pdI-1U')
buildConfigField 'String', 'GOOGLE_MAPS_KEY', formatString("AIzaSyD-7-YhOAzX4VJfVLsHUz8KEn-1MGJq46o")
}
}
packagingOptions {
resources {
excludes += ['META-INF']
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (variant.buildType.name == 'release' && names.contains('mockServer')) {
println(names)
setIgnore(true)
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dynamicFeatures = [':navi_pl_dynamic']
}
android.applicationVariants.all { variant ->
variant.productFlavors.each { flavor ->
flavor.buildConfigFields.each { key, value ->
if (key in ['BASE_URL', 'RAZORPAY_KEY']) {
println " ${flavor.name}: ${value.name}=${value.value}"
}
}
}
}
static def formatString(String value) {
return '"' + value + '"'
}
ext {
version_kotlin_coroutines = '1.3.2'
}
repositories {
mavenCentral()
google()
}
publishing {
repositories {
if (project.hasProperty('NEXUS_URL')) {
maven {
url = "$NEXUS_URL"
credentials {
username = "$NEXUS_USERNAME"
password = "$NEXUS_PASSWORD"
}
}
}
}
publications {
if (project.hasProperty('NEXUS_URL') && project.hasProperty('FLAVOR')) {
maven(MavenPublication) {
artifactId = "$FLAVOR"
groupId = "com.naviapp"
if ("$FLAVOR" == "PROD") {
version = "navi_v$VERSION_NAME"
} else {
version = "navi_v$VERSION_NAME-SNAPSHOT"
}
if ("$FLAVOR" == "PROD")
artifact("build/outputs/bundle/prodRelease/app-prod-release.aab")
else if ("$FLAVOR" == "QA")
artifact("build/outputs/bundle/qaRelease/app-qa-release.aab")
else
artifact("build/outputs/bundle/devRelease/app-dev-release.aab")
}
}
}
}
dependencies {
implementation project(":navi-vkyc")
implementation project(":navi-common")
implementation project(":navi-chat")
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation project(":navi-amc")
implementation project(":navi-rr")
implementation project(":navi-insurance")
implementation project(":navi-hl")
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.core:core-ktx:$core_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_kotlin_coroutines"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_kotlin_coroutines"
implementation "com.google.android.material:material:$material_version"
implementation 'com.android.support:multidex:1.0.3'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
implementation glideLibs.implementation
kapt glideLibs.kapt
implementation 'com.otaliastudios:cameraview:2.7.2'
// Firebase SDK for Performance Monitoring
implementation 'com.google.firebase:firebase-appindexing:19.1.0'
implementation group: 'joda-time', name: 'joda-time', version: '2.10.5'
implementation 'org.joda:joda-money:1.0.1'
implementation 'com.android.installreferrer:installreferrer:2.2'
// Auto fetch phone number
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.android.gms:play-services-ads:22.0.0'
// finormic
implementation project(":finoramic-androidx-sdk")
implementation fragmentLibs.ktx
// Onemoney
implementation project(":one-money-sdk")
// AndroidJUnitRunner and JUnit Rules
androidTestImplementation "androidx.test:runner:$test_runner_version"
androidTestImplementation "androidx.test:rules:$test_rules_version"
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.1'
// Espresso dependencies
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-web:$espresso_version"
androidTestImplementation ("androidx.test.espresso:espresso-contrib:$espresso_version"){
exclude(group: "com.google.protobuf", module: "protobuf-lite")
}
androidTestImplementation "org.hamcrest:hamcrest:$hamcrest_version"
debugImplementation "androidx.test:monitor:$test_monitor_version"
testImplementation('com.navi.medici.test-library:database-library:0.0.26-SNAPSHOT') {
exclude group: "org.postgresql"
exclude group: "org.apache.commons"
exclude group: "junit"
}
androidTestImplementation('com.google.guava:guava:28.2-android') {
exclude group: "com.google.code.findbugs", module: "jsr305"
}
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.4.1'
androidTestImplementation 'android.arch.core:core-testing:1.1.1'
testImplementation 'android.arch.core:core-testing:1.1.1'
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$android_junit_version"
testImplementation "io.mockk:mockk:$mockk_version"
// Dependency for postgres
implementation group: 'postgresql', name: 'postgresql', version: '9.1-901-1.jdbc4'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.71"
// Facebook sdk
implementation 'com.facebook.android:facebook-applinks:13.1.0'
// for branch io deeplink
implementation 'io.branch.sdk.android:library:5.1.1'
// Digitap for Aadhaar kyc
implementation 'com.digitap.sdk:okyc:1.3.4'
// for play store in app review
api playCore.implementation
// for Trucaller
implementation "com.truecaller.android.sdk:truecaller-sdk:2.7.0"
implementation 'com.android.support:support-annotations:28.0.0'
implementation hiltLibs.implementation
kapt hiltLibs.kapt
// For instrumentation tests
androidTestImplementation hiltLibs.androidTest
kaptAndroidTest hiltLibs.kaptAndroidTest
// For local unit tests
testImplementation hiltLibs.test
kaptTest hiltLibs.kaptTest
// RestAssured
testImplementation 'io.rest-assured:rest-assured:4.3.0'
testImplementation 'org.awaitility:awaitility:4.1.0'
//Custom tabs
implementation 'androidx.browser:browser:1.3.0'
//one tap sms verification
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
implementation 'com.facebook.shimmer:shimmer:0.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation "io.finarkein.anubhav:sdk-core:$finarkein_version"
implementation "com.github.otpless-tech:otpless-android-sdk:$otp_less_version"
//Hyperion dependencies
debugImplementation hyperion.debug_core
debugImplementation hyperion.attribute
debugImplementation hyperion.build_config
debugImplementation hyperion.crash
debugImplementation hyperion.disk
debugImplementation hyperion.geiger_counter
debugImplementation hyperion.measurement
debugImplementation hyperion.phoenix
debugImplementation hyperion.reporter
debugImplementation hyperion.shared_prefrence
debugImplementation hyperion.timber
debugImplementation hyperion.menu
releaseImplementation hyperion.release_core
}
tasks.withType(Compiler) {
options.encoding = "UTF-8"
}
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
task pushArtifiactoryToNexus {
doLast {
def nexusURL = "https://nexus.cmd.navi-tech.in/repository/android-apk-artifacts/apk/"
def apkPath = "app-dev-debug-latest.apk"
def nexusAuth = "nexus-user:nexus-user"
// println("APK path " + ${devDebugApk.toString()})
// Upload app to nexus
def output = new ByteArrayOutputStream().withStream { outputStream ->
exec {
executable "/bin/sh" args "-c", "curl --write-out \"%{http_code}\" -u ${nexusAuth} --upload-file ${devDebugApk} ${nexusURL}/${apkPath}"
standardOutput = outputStream
}
outputStream.toString().stripIndent()
}
boolean ok = output == "201"
if (!ok) {
throw new GradleException("APK upload failed with status code: " + output)
}
println("new APK uploaded to nexus successfully")
}
}