if (rootProject.ext.android.isApplication) {
    apply plugin: 'com.android.application'
    apply plugin: 'yac-engine'
} else {
    apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android {
    compileSdkVersion build_versions.compileSdkVersion

    defaultConfig {
        if (rootProject.ext.android.isApplication) {
            applicationId "com.yidian.shenghuoquan.bdemo"
        }
        minSdkVersion build_versions.minSdkVersion
        targetSdkVersion build_versions.targetSdkVersion
        versionCode rootProject.ext.android.versionCode
        versionName rootProject.ext.android.versionName

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    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'
    }
    sourceSets {
        main {
            if (rootProject.ext.android.isApplication) {
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
    buildFeatures {
        viewBinding true
        dataBinding true
    }
    kapt {
        generateStubs = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    rootProject.ext.dependencies.other.each {
        implementation project(it)
    }
    implementation rootProject.ext.dependencies.privateImplementation
    testImplementation rootProject.ext.dependencies.testImplementation
    androidTestImplementation rootProject.ext.dependencies.androidTestImplementation
}