apply plugin: 'com.android.application'

Boolean willCompileAliyun = Boolean.valueOf(property('aliyun.compile'))
if (willCompileAliyun) {
    apply from: 'dependency.gradle'
}

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "h5.espressif.esp32"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 51
        versionName "1.2.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        if (willCompileAliyun) {
            ndk {
                abiFilters "armeabi-v7a", "arm64-v8a", "x86"//过滤除 armeabi 和 x86 以外的 so 文件
            }
        }
        multiDexEnabled true
    }
    signingConfigs {
        debug {
            if (Boolean.valueOf(property('sign.useInDebug'))) {
                storeFile file(property('sign.storeFile'))
                storePassword property('sign.storePassword')
                keyAlias property('sign.keyAlias')
                keyPassword property('sign.keyPassword')
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            if (Boolean.valueOf(property('sign.useInDebug'))) {
                signingConfig signingConfigs.debug
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    sourceSets {
        main {
            java {
                if (!willCompileAliyun) {
                    exclude 'aliyun/espressif/mesh/**'
                }
            }
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'

    // RxJAVA
    implementation "io.reactivex.rxjava3:rxjava:3.0.6"
    implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
    // QR Code
    implementation "com.journeyapps:zxing-android-embedded:3.6.0"
    // EventBus
    implementation "org.greenrobot:eventbus:3.1.1"

    // Modules
    implementation project(':appmesh')
}
