plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'org.jetbrains.kotlin.plugin.compose'
    id 'kotlin-parcelize'
}

android {
    namespace 'com.eternaljust.msea'
    compileSdk 36

    defaultConfig {
        applicationId "com.eternaljust.msea"
        minSdk 29
        targetSdk 36
        versionCode 20
        versionName "1.1.1"

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

        ndk {
            //noinspection ChromeOsAbiSupport
            abiFilters "arm64-v8a"
        }
    }

    buildTypes {
        release {
            // 混淆
            minifyEnabled true
            // 自动移除未使用的资源
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    buildFeatures {
        compose true
        buildConfig true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.5.8'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
        dex {
            // 当 minSdk 为 28 或更高级别时，开启后 AGP 会在 APK 中打包压缩的 DEX 文件
            useLegacyPackaging true
        }
    }
    sourceSets {
        main {
            res {
                srcDirs 'src/main/res', 'src/main/res/drawble-night', 'src/main/res/drawable-night'
            }
        }
    }
    buildToolsVersion '36.0.0'
    ndkVersion '27.0.12077973'

    android.applicationVariants.configureEach { variant ->
        variant.outputs.each { output ->
            output.outputFileName = "Msea_" + variant.versionName + ".apk"
        }
    }
}

dependencies {
    // jetpack
    implementation 'androidx.core:core-ktx:1.15.0'
    implementation 'androidx.core:core-splashscreen:1.0.1'
    implementation 'androidx.datastore:datastore-preferences:1.1.4'

    // compose
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.compose.material3:material3:1.3.1'

    implementation 'androidx.activity:activity-compose:1.10.1'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7'
    implementation 'androidx.navigation:navigation-compose:2.8.9'
    implementation 'androidx.paging:paging-runtime-ktx:3.3.6'
    implementation 'androidx.paging:paging-compose:3.3.6'

    implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
    implementation "com.google.accompanist:accompanist-swiperefresh:$accompanist_version"
    implementation "com.google.accompanist:accompanist-webview:$accompanist_version"
    implementation "com.google.accompanist:accompanist-permissions:$accompanist_version"
    implementation 'com.google.code.gson:gson:2.11.0'

    // vendor
    implementation 'org.jsoup:jsoup:1.17.2'
    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
    implementation 'io.coil-kt:coil-compose:2.5.0'

    // SDK
    implementation 'com.umeng.umsdk:common:9.6.7' // 友盟基础组件库（所有友盟业务SDK都依赖基础组件库）
    implementation 'com.umeng.umsdk:asms:1.8.6' // 必选
    implementation 'com.umeng.umsdk:apm:1.9.5' // U-APM产品包依赖(必选)
    implementation 'com.umeng.umsdk:abtest:1.0.1' // 使用U-App中ABTest能力，可选

    // debug
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}