import java.text.SimpleDateFormat

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.greenrobot.greendao'

android {
    compileSdkVersion 32

    defaultConfig {
        applicationId "com.casic.detector"
        minSdkVersion 22
        targetSdkVersion 32
        versionCode 1
        versionName "1.0.0.0"
    }

    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'
    }

    kotlin {
        experimental {
            coroutines 'enable'
        }
    }

    viewBinding {
        enabled true
    }

    applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "COM_TCY" + getBuildDate() + "_" + defaultConfig.versionName + ".apk"
        }
    }

    greendao {
        schemaVersion 1//数据库版本号
        targetGenDir 'src/main/java'//设置DaoMaster、DaoSession、Dao目录
        daoPackage 'com.casic.detector.greendao'//设置DaoMaster、DaoSession、Dao包名
    }
}

static def getBuildDate() {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd", Locale.CHINA)
    return dateFormat.format(System.currentTimeMillis())
}

dependencies {
    //基础依赖库
    implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.4.5'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.core:core-ktx:1.9.0'
    //Google官方授权框架
    implementation 'pub.devrel:easypermissions:3.0.0'
    //腾讯Android UI框架
    implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
    implementation 'com.qmuiteam:arch:0.3.1'
    //沉浸式状态栏。基础依赖包，必须要依赖
    implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
    //fragment快速实现
    implementation 'com.gyf.immersionbar:immersionbar-components:3.0.0'
    //官方Json解析库
    implementation 'com.google.code.gson:gson:2.9.0'
    //Kotlin协程
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    //MVVM+LiveData
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    //返回值转换器
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
    //okhttp3日志拦截器
    implementation 'com.squareup.okhttp3:logging-interceptor:4.6.0'
    //网络请求和接口封装
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.okhttp3:okhttp:4.9.0'
    //数据库框架
    implementation 'org.greenrobot:greendao:3.3.0'
    //高德导航、定位、地图三合一
    implementation 'com.amap.api:navi-3dmap:latest.integration'
    //经纬度逆编码
    implementation 'com.amap.api:search:8.1.0'
    //excel
    implementation 'net.sourceforge.jexcelapi:jxl:2.6.12'
}