plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlinx-serialization'
    id 'kotlin-parcelize'
    id 'com.google.protobuf' version '0.9.1'
    id 'com.google.dagger.hilt.android'
    id 'com.google.devtools.ksp'
}


android {
    namespace 'app.ice.readmanga'
    compileSdk 35

    defaultConfig {
        applicationId "app.ice.readmanga"
        minSdk 24
        targetSdk 35
        versionCode 1
        versionName "1.0-alpha1"

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

    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.5.5'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

protobuf {
    // Configures the Protobuf compilation and the protoc executable
    protoc {
        // Downloads from the repositories
        artifact = "com.google.protobuf:protoc:3.14.0"
    }

    // Generates the java Protobuf-lite code for the Protobufs in this project
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                // Configures the task output type
                java {
                    // Java Lite has smaller code size and is recommended for Android
                    option 'lite'
                }
            }
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.13.1'
    implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.3'
    implementation 'androidx.activity:activity-compose:1.10.1'
    implementation platform('androidx.compose:compose-bom:2024.06.00')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.ui:ui-graphics'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.compose.material3:material3'
    implementation("io.coil-kt:coil-compose:2.6.0")
    implementation 'androidx.navigation:navigation-compose:2.8.0-beta06'
    implementation 'org.jsoup:jsoup:1.17.2'
    implementation 'androidx.compose.runtime:runtime-livedata:1.6.8'
    implementation 'androidx.navigation:navigation-runtime-ktx:2.7.7'
    implementation 'androidx.work:work-runtime-ktx:2.9.0'

    implementation "androidx.hilt:hilt-navigation-compose:1.1.0"
    implementation "com.google.dagger:hilt-android:2.51.1"
    ksp "com.google.dagger:hilt-compiler:2.51.1"

    //data store
    implementation("androidx.datastore:datastore-preferences:1.1.1")
    implementation 'androidx.appcompat:appcompat:1.7.0'

    //ktor
    def ktorVersion = "2.3.12"
    implementation("io.ktor:ktor-client-core:$ktorVersion")
    implementation("io.ktor:ktor-client-cio:$ktorVersion")
    implementation "io.ktor:ktor-client-content-negotiation:$ktorVersion"
    implementation "io.ktor:ktor-serialization-kotlinx-json:$ktorVersion"

    //serialization
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0'


//    icon pack
    implementation("br.com.devsrsouza.compose.icons:feather:1.1.0")

    // Proto buf
    implementation "com.google.protobuf:protobuf-javalite:3.18.0"

    testImplementation 'junit:junit:4.13.2'

    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'

    debugImplementation 'androidx.compose.ui:ui-tooling'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'

}