plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion env.compileSdkVersion
    buildToolsVersion env.buildToolsVersion

    defaultConfig {
        applicationId env.applicationId
        minSdkVersion env.minSdkVersion
        targetSdkVersion env.targetSdkVersion
        versionCode env.versionCode
        versionName env.versionName

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "armeabi-v7a"/*, "arm64-v8a", "x86"*/
        }
    }

    signingConfigs {
        signing {
            keyAlias 'winds'
            keyPassword '039468'
            storeFile file('../config/winds.jks')
            storePassword '039468'
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            multiDexEnabled true
            signingConfig signingConfigs.signing
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            multiDexEnabled true
            signingConfig signingConfigs.signing
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility env.jdk_version
        targetCompatibility env.jdk_version
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    kotlin {
        experimental {
            coroutines 'enable'
        }
    }
    viewBinding {
        enabled = true
    }
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
    applicationVariants.all { variant ->
//        variant.getPackageApplication().outputDirectory = new File("${rootDir.absolutePath}/Apk")
        variant.outputs.all {
            def buildType = variant.buildType.name
            def buildTime = new Date().format("yyyyMMddHHmm", TimeZone.getDefault())
            outputFileName = "Eboard_${buildType}_v${variant.versionCode}_${variant.versionName}_${buildTime}.apk"
        }
    }
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':HttpCoreLibrary')
    implementation project(':RcCore')

    implementation dep.kotlinStdlib
    implementation dep.androidxCoreKtx
    implementation dep.androidxAppCompat
    implementation dep.androidxConstraintlayout
    implementation dep.androidMaterial
    implementation dep.androidxLocalbroadcastmanager
    implementation dep.rxpermissions
    implementation dep.androidxSwipeRefreshLayout
    implementation dep.RecyclerViewAdapterHelper
    implementation dep.glide

    implementation dep.kotlinxCoroutinesCore
    implementation dep.kotlinxCoroutinesAndroid

    implementation dep.androidMultidex
    implementation dep.buglySDK
    implementation dep.buglyNDK
    implementation dep.mqttv3
    implementation dep.eventbus
    implementation dep.bgaZxing

    implementation 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    // CameraX core library using the camera2 implementation
    def camerax_version = "1.0.1"
    // The following line is optional, as the core library is included indirectly by camera-camera2
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    // If you want to additionally use the CameraX Lifecycle library
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    // If you want to additionally use the CameraX View class
    implementation "androidx.camera:camera-view:1.0.0-alpha20"
    // If you want to additionally use the CameraX Extensions library
    implementation "androidx.camera:camera-extensions:1.0.0-alpha20"

    implementation 'com.github.NodeMedia:NodeMediaClient-Android:2.9.23'
    implementation(name: 'facedetector-1.0.0', ext: 'aar')
    implementation 'io.fotoapparat:fotoapparat:2.7.0'
    //饼行统计图
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
//    implementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'

}