plugins {
    alias(libs.plugins.android.application)
}

android {
    namespace 'cn.gov.xivpn2'
    compileSdk 36

    defaultConfig {
        applicationId "io.github.exclude0122.xivpn"
        minSdk 28
        targetSdk 35
        versionCode 36
        versionName "1.7.1"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }


    signingConfigs {
        githubaction {
            storeFile file("../sign/keystore.jks")
            storePassword System.getenv("RELEASE_KEYSTORE_PASSWORD")
            keyAlias System.getenv("RELEASE_KEYSTORE_ALIAS")
            keyPassword System.getenv("RELEASE_KEY_PASSWORD")
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    packagingOptions {
        jniLibs {
            keepDebugSymbols += ['**/*.so']
            useLegacyPackaging true
        }
    }


    buildFeatures {
        buildConfig true
    }

    flavorDimensions += "version"
    productFlavors {
        universal {
            signingConfig signingConfigs.githubaction
            ndk {
                abiFilters "arm64-v8a", "x86_64", "armabi-v7a"
            }
            versionCode = defaultConfig.versionCode * 10 + 1
        }

        x86_64 {
            signingConfig signingConfigs.githubaction
            ndk {
                abiFilters "x86_64"
            }
            versionCode = defaultConfig.versionCode * 10 + 2
        }

        arm64_v8a {
            signingConfig signingConfigs.githubaction
            ndk {
                abiFilters "arm64-v8a"
            }
            versionCode = defaultConfig.versionCode * 10 + 3
        }

        armabi_v7a {
            signingConfig signingConfigs.githubaction
            ndk {
                abiFilters "armeabi-v7a"
            }
            versionCode = defaultConfig.versionCode * 10 + 4
        }


    }

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

    dependenciesInfo {
        includeInApk false
        includeInBundle false
    }
    lint {
        showAll true
    }

    androidResources {
        generateLocaleConfig true
    }


}

dependencies {
    implementation libs.room.runtime
    annotationProcessor libs.room.compiler
    implementation libs.google.guava
    implementation libs.gson
    implementation libs.appcompat
    implementation libs.material
    implementation libs.activity
    implementation libs.constraintlayout
    testImplementation libs.junit
    androidTestImplementation libs.ext.junit
    androidTestImplementation libs.espresso.core
    implementation libs.work.runtime
    implementation libs.okhttp
    implementation libs.preference
    implementation libs.commons.io
    implementation libs.recyclerview
    implementation libs.commons.collections4
}
