apply plugin: 'com.android.application'

android {
    compileSdkVersion versions.compileSdk
    defaultConfig {
        versionCode 34
        versionName "2021-06-30"

        // Requires API level 23 (Android 6.0) to use Android keystore system for cryptography.
        minSdkVersion 23
        targetSdkVersion versions.targetSdk

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        vectorDrawables.useSupportLibrary = true

        javaCompileOptions {
            annotationProcessorOptions {
                // Export database schema history as JSON files.
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
        sourceSets {
            // Include database schema history for migration testing.
            androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
        }
    }

    buildFeatures {
        viewBinding = true
    }

    buildTypes {
        debug {
            // Don't mess with the release versions during debugging, so use a different appId.
            applicationIdSuffix ".debug"
            debuggable true
        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "client", "environment"
    productFlavors {
        prod {
            dimension "environment"
        }

        qs {
            dimension "environment"
            // To be able to install a second app variant, we must change the applicationId.
            // Otherwise it would not be possible to use the same device for testing and production.
            applicationIdSuffix ".QS"
        }

        EFD {
            // Demo portal efdis-online.de (extern) / dailybuild.efdis-online.de (intern)
            dimension "client"
            applicationId "de.efdis.activeTAN"
        }

        VAR {
            dimension "client"
            applicationId "de.varengold.activeTAN"
        }

    }
    compileOptions {
        // ZXing uses Java 8 language features from the core library
        coreLibraryDesugaringEnabled true

        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

}

tasks.withType(JavaCompile) {
    options.deprecation = true
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation project(':material-design-icons')
    implementation project(":barcodescanner")

    implementation 'com.google.android.material:material:1.3.0'

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'androidx.biometric:biometric:1.1.0'

    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'

    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
    implementation 'com.google.zxing:core:' + versions.zxing

    def room_version = '2.3.0'
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    androidTestImplementation "androidx.room:room-testing:$room_version"

    testImplementation 'junit:junit:4.13.1'

    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
}
