//****************************************
//******** module模块的公共脚本配置 *********
//****************************************

import com.quyunshuo.androidbaseframemvvm.buildsrc.*

android {
    compileSdk ProjectBuildConfig.compileSdkVersion

    defaultConfig {
        minSdk ProjectBuildConfig.minSdkVersion
        targetSdk ProjectBuildConfig.targetSdkVersion
        versionCode ProjectBuildConfig.versionCode
        versionName ProjectBuildConfig.versionName
        testInstrumentationRunner DependencyConfig.AndroidX.AndroidJUnitRunner

        ndk {
            // 设置支持的SO库架构
            //abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = "17"
    }

    buildFeatures {
        viewBinding = true
    }

    sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
            java {
                //排除debug文件夹下的所有文件
                exclude 'debug/**'
            }
        }
    }

    buildTypes {
        // 对应 ALPHA 版本
        debug {
            buildConfigField "String", "VERSION_TYPE", "\"${ProjectBuildConfig.Version.ALPHA}\""
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        beta {
            buildConfigField "String", "VERSION_TYPE", "\"${ProjectBuildConfig.Version.BETA}\""
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            buildConfigField "String", "VERSION_TYPE", "\"${ProjectBuildConfig.Version.RELEASE}\""
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.name)
        arg("eventBusIndex", "${ProjectBuildConfig.applicationId}.eventbus.index.${project.name}EventIndex")
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    api project(path: ':lib_common')

    testImplementation DependencyConfig.Android.Junit
    androidTestImplementation DependencyConfig.AndroidX.TestExtJunit
    androidTestImplementation DependencyConfig.AndroidX.TestEspresso
    implementation DependencyConfig.JetPack.HiltCore

    kapt DependencyConfig.GitHub.ARouteCompiler
    kapt DependencyConfig.GitHub.EventBusAPT
    kapt DependencyConfig.GitHub.AutoServiceAnnotations
    kapt DependencyConfig.JetPack.HiltApt
    kapt DependencyConfig.JetPack.LifecycleCompilerAPT
}