if (isBuildModule.toBoolean()) {
    apply plugin: 'com.android.application'
} else {
    apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.getName())
    }
}

android {
    compileSdkVersion 31

    sourceSets {
        main {
            // 应用
            if (isBuildModule.toBoolean()) {
                manifest.srcFile 'src/main/debug/AndroidManifest.xml'
            } else {// 插件
                manifest.srcFile 'src/main/release/AndroidManifest.xml'
            }
        }
    }

    defaultConfig {
        if (isBuildModule.toBoolean()) {
            applicationId "com.lukouguoji.module_base"
        }
        minSdkVersion 24
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled 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'
    }
    buildToolsVersion '30.0.3'
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }

    repositories {
        flatDir {
            dirs 'libs'
        }
    }

    buildFeatures {
        dataBinding = true
    }

}

dependencies {

    api fileTree(dir: 'libs', include: ['*.jar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    api(name: 'cretinautoupdatelibrary', ext: 'aar')
    api(name: 'security-release', ext: 'aar')
    api project(':MPChartLib')

    api "com.alibaba:fastjson:1.2.73"
    api 'com.squareup.retrofit2:retrofit:2.6.1'
    api('com.squareup.retrofit2:converter-gson:2.6.1') {
        exclude group: 'com.google.code.gson'
    }
    api 'com.squareup.okhttp3:okhttp:3.12.12'
    api "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.3"
    api 'com.liulishuo.filedownloader:library:1.7.6'//okhttp3connection用到

    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"//协程
    api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
    api 'com.google.code.gson:gson:2.10.1'
    api "androidx.lifecycle:lifecycle-extensions:2.2.0"//viewModel
    api "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"//liveData
    api "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"//viewModel

    api 'com.scwang.smart:refresh-layout-kernel:2.0.3'      //核心必须依赖
    api 'com.scwang.smart:refresh-header-classics:2.0.3'    //经典刷新头
    api 'com.scwang.smart:refresh-footer-classics:2.0.3'    //经典加载

    api 'com.alibaba:arouter-api:1.5.2'//ARouter路由
    kapt 'com.alibaba:arouter-compiler:1.5.2'

    api 'com.yanzhenjie:permission:2.0.2'
    api 'com.github.yuzhiqiang1993:zxing:2.2.9'//扫码

    api 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.1.7'//下拉框，日期控件
    api 'com.github.LinweiJ:LoadingDialog:V0.0.1' //加载框

    api 'io.github.mqcodedev:lib_dialog:1.3.0'//对话框

    api 'org.greenrobot:eventbus:3.1.1' //eventbus

    //日志工具
    api "com.jakewharton.timber:timber:5.0.1"

    //侧滑删除
    api 'com.github.mcxtzhang:SwipeDelMenuLayout:V1.2.1'

    // PictureSelector 基础 (必须)
    api 'io.github.lucksiege:pictureselector:v3.11.2'
    api "com.github.bumptech.glide:glide:4.15.1"

    // PDF预览库
    api 'com.github.barteksc:android-pdf-viewer:2.8.2'


    // DevApp - Android 工具类库
    api 'io.github.afkt:DevAppX:2.4.0'

    // xpop 弹窗
    api 'com.github.li-xiaojun:XPopup:2.9.19'

    // 屏幕适配
    api 'me.jessyan:autosize:1.2.+'

    // 佳博打印SDK
//    api('com.gainscha:sdk2:2.0.3@aar') {
//        exclude group: 'com.jcraft'
//    }
//    api(name: 'sdk2-2.1.6-20250901.051214-1', ext: 'aar') {
    api(name: 'sdk2-2.0.3', ext: 'aar') {
        exclude group: 'com.jcraft'
    }
}