plugins {
    id 'com.android.application'
    id 'kotlin-android'
    // this is in documentation https://developer.android.com/training/dependency-injection/hilt-android#kts
    //kotlin("kapt")
    // but this one works
    id("kotlin-kapt")
    id("dagger.hilt.android.plugin")
}

ext {
    compose_version = '1.1.1'
    ktor_version = '1.6.8'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.dtmilano.android.culebratester2"
        minSdk 26
        targetSdk 33
        versionCode 20075
        versionName "2.0.75-alpha"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        resources {
            excludes += ['/META-INF/{AL2.0,LGPL2.1}', 'META-INF/DEPENDENCIES', 'META-INF/io.netty.versions.properties', 'META-INF/INDEX.LIST', 'META-INF/ktor-http.kotlin_module', 'META-INF/ktor-utils.kotlin_module', 'META-INF/kotlinx-coroutines-core.kotlin_module', 'META-INF/ktor-io.kotlin_module', 'META-INF/ktor-http-cio.kotlin_module', 'META-INF/ktor-client-core.kotlin_module']
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
        useIR = true
    }

    buildFeatures {
        viewBinding true
        compose true
    }

    testOptions {
        unitTests {
            returnDefaultValues = true
            includeAndroidResources = true
        }
    }

    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }

    lintOptions {
        disable "JvmStaticProvidesInObjectDetector", "FieldSiteTargetOnQualifierAnnotation", "ModuleCompanionObjects", "ModuleCompanionObjectsNotInModuleParent"
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation "com.google.dagger:hilt-android:$hilt_android_version"
    //kapt "com.google.dagger:hilt-compiler:$hilt_android_version"
    implementation("io.ktor:ktor:$ktor_version")
    implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
    implementation 'androidx.activity:activity-compose:1.4.0'
    testImplementation 'junit:junit:4.13.2'
    testImplementation('androidx.test:core:1.5.0')
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation('com.google.dagger:hilt-android:2.42')
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    kapt("com.google.dagger:hilt-android-compiler:$hilt_android_version")
    implementation("io.ktor:ktor-server-core:$ktor_version")
    implementation("io.ktor:ktor-server-netty:$ktor_version")
    implementation("ch.qos.logback:logback-classic:1.2.11")
    implementation("io.ktor:ktor-jackson:$ktor_version")
    implementation("io.ktor:ktor-locations:$ktor_version")
    implementation("io.ktor:ktor-gson:$ktor_version")
    testImplementation("io.ktor:ktor-server-tests:$ktor_version")
    androidTestImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
    testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
    testImplementation('org.mockito:mockito-core:4.6.0')
    testImplementation('org.mockito.kotlin:mockito-kotlin:4.0.0')
    testImplementation('org.jetbrains.kotlin:kotlin-test:1.6.10')
    androidTestImplementation('org.jetbrains.kotlin:kotlin-test:1.6.10')
    testImplementation 'org.robolectric:robolectric:4.8.1'
    implementation group: 'commons-io', name: 'commons-io', version: '2.6'
}

// Allow references to generated code
kapt {
    correctErrorTypes true
}
