plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

kotlin {
    jvmToolchain(17)
}

android {
    compileSdk 35
    ndkVersion "21.1.6352462"

    compileOptions {
        sourceCompatibility = 17
        targetCompatibility = 17
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }


    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "design.codeux.biometric_storage_example"
        minSdkVersion 23
        targetSdkVersion 35
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug

            minifyEnabled true
            proguardFiles getDefaultProguardFile(
                    'proguard-android-optimize.txt'),
                    // List additional ProGuard rules for the given build type here. By default,
                    // Android Studio creates and includes an empty rules file for you (located
                    // at the root directory of each module).
                    'proguard-rules.pro'
        }
    }
    lint {
        disable 'InvalidPackage'
    }
    namespace 'design.codeux.biometric_storage_example'
}

flutter {
    source '../..'
}

dependencies {
    implementation 'org.slf4j:slf4j-api:2.0.7'
    implementation 'com.github.tony19:logback-android:3.0.0'
    implementation "io.github.oshai:kotlin-logging-jvm:5.0.1"
    implementation "androidx.appcompat:appcompat:1.6.1"

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
