apply plugin: 'com.android.application'

apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.oss.licenses.plugin'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'


def versionMajor = 1
def versionMinor = 4
def versionPatch = 8
def versionBuild = 0

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.alvinhkh.buseta"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        resConfigs 'en', 'zh-rHK'
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        debug {
            versionNameSuffix "-build-${versionBuild}"
        }
        release {
            // shrinkResources true
            // minifyEnabled true
        }
    }

    buildTypes.each {
        it.resValue 'string', 'AD_BANNER_UNIT_ID', AdBannerUnitId
        it.resValue 'string', 'ADMOB_APP_ID', AdmobAppId
        it.resValue 'string', 'DIRECTION_API_KEY', DirectionApiKey
    }

    lintOptions {
        checkReleaseBuilds true
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/rxjava.properties'
    }

    kapt {
        arguments {
            arg("room.schemaLocation", "$projectDir/schemas".toString())
        }
    }
}

dependencies {
    def lifecycle_version = "2.2.0"
    def preference_version = "1.1.1"
    def retrofit_version = '2.9.0'
    def room_version = "2.2.5"
    implementation platform('com.google.firebase:firebase-bom:25.12.0')

    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    implementation "androidx.room:room-rxjava2:$room_version"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.media:media:1.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation "androidx.preference:preference:$preference_version"
    implementation "androidx.preference:preference-ktx:$preference_version"
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
    implementation 'com.google.android.play:core:1.8.3'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.google.firebase:firebase-ads'
    implementation 'com.google.firebase:firebase-appindexing'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-config'
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-database-ktx'
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
    implementation 'com.google.maps.android:android-maps-utils:2.0.3'
    implementation "android.arch.work:work-runtime:1.0.1"
    implementation (group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'xpp3', module: 'xpp3'
    }
    implementation 'org.jsoup:jsoup:1.13.1'
    implementation 'com.opencsv:opencsv:4.6'
    implementation 'com.github.chrisbanes:PhotoView:2.1.4'
    implementation('com.squareup.okhttp3:okhttp:4.7.2') {
        exclude group: 'org.json'
    }
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation ("com.squareup.retrofit2:converter-gson:$retrofit_version") {
        exclude group: 'com.google.code.gson', module: 'gson'
    }
    implementation ("com.squareup.retrofit2:converter-simplexml:$retrofit_version") {
        exclude group: 'org.simpleframework', module: 'simple-xml'
    }
    implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version"
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'org.osmdroid:osmdroid-android:6.1.8'
    implementation 'org.osgeo:proj4j:0.1.0'
    implementation 'org.slf4j:slf4j-nop:1.7.30'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.0'
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
    implementation 'com.jaredrummler:colorpicker:1.1.0'
}

apply plugin: 'com.google.gms.google-services'