plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.devtools.ksp'
    id 'org.jetbrains.kotlin.plugin.serialization' version "2.2.20"
}

android {
    compileSdk 36

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 34

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    ksp {
        // ROOM export schema
        arg("room.schemaLocation", "$projectDir/schemas")
        arg("room.incremental", "true")
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_19
        targetCompatibility JavaVersion.VERSION_19
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_19
    }
    namespace 'net.xzos.upgradeall.core'

}

dependencies {

    implementation project(path: ':core-utils')
    api project(path: ':core-websdk')  // 传递 API 返回值的数据结构
    implementation project(path: ':core-android-utils')

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'


    // Kotlin
    implementation "androidx.core:core-ktx:$android_ktx_version"
    //noinspection DifferentStdlibGradleVersion
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    // database
    def room_version = '2.8.0'
    api "androidx.room:room-runtime:$room_version"
    ksp 'org.xerial:sqlite-jdbc:3.50.3.0' //Work around on Apple Silicon
    ksp "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    // Test helpers
    testImplementation "androidx.room:room-testing:$room_version"

    // Gson
    implementation 'com.google.code.gson:gson:2.13.2'
    
    // Kotlinx Serialization
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0'

    // OkHttp
    implementation 'com.squareup.okhttp3:okhttp:5.1.0'
}
