apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

android {
    kotlinOptions {
        freeCompilerArgs = ["-XXLanguage:+InlineClasses", "-Xopt-in=org.mylibrary.OptInAnnotation"]
        jvmTarget = "1.8"
    }
    signingConfigs {
        testSign {
            storeFile file('../ci_keystore.jks')
            storePassword 'hunter2'
            keyAlias 'key0'
            keyPassword 'hunter2'
        }
        nightlySign {
            storeFile file('../nightly_keystore.jks')
            storePassword project.hasProperty("storePassword") ? project.storePassword : ""
            keyAlias 'key0'
            keyPassword project.hasProperty("keyPassword") ? project.keyPassword : ""
        }
    }
    compileSdk 34
    defaultConfig {
        applicationId "me.henneke.wearauthn.authenticator"
        minSdk 28
        targetSdk 33
        versionCode makeVersionCode(minSdkVersion.apiLevel, true)
        versionName makeVersionName()
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.testSign
        }
        debug {
            minifyEnabled false
        }
        signed {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.nightlySign
        }
    }
    flavorDimensions += "distribution"
    productFlavors {
        playStore {
            dimension "distribution"
        }
        nightly {
            dimension "distribution"
            applicationIdSuffix ".nightly"
            versionCode getNightlyVersionCode()
            versionName getNightlyVersionName()
        }
    }
    namespace 'me.henneke.wearauthn'
    buildFeatures {
        buildConfig true
        viewBinding true
    }
    applicationVariants.configureEach { variant ->
        variant.resValue "string", "application_id", variant.applicationId
    }
}

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

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'androidx.annotation:annotation:1.8.1'
    implementation 'androidx.core:core-ktx:1.13.1'
    implementation 'androidx.fragment:fragment-ktx:1.8.2'
    implementation 'androidx.wear:wear:1.3.0'

    implementation 'com.google.android.gms:play-services-wearable:18.2.0'
    implementation 'com.google.android.support:wearable:2.9.0'
    compileOnly 'com.google.android.wearable:wearable:2.9.0'

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.7.3'

    testImplementation 'junit:junit:4.13.1'
    testImplementation 'io.kotlintest:kotlintest-runner-junit5:3.4.2'
    testImplementation 'org.slf4j:slf4j-nop:2.0.0-alpha1'
}
