apply plugin: 'com.android.application'

android {
    compileSdkVersion rootProject.ext.android.compileSdkVersion
    buildToolsVersion rootProject.ext.android.buildToolsVersion
    defaultConfig {
        applicationId rootProject.ext.android.applicationId
        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode rootProject.ext.android.versionCode
        versionName rootProject.ext.android.versionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        //阿里路由框架配置
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [AROUTER_MODULE_NAME: project.getName()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
            if (isBuildModule.toBoolean()) {
                //独立运行
                manifest.srcFile 'src/main/alone/AndroidManifest.xml'
            } else {
                //合并到宿主
                manifest.srcFile 'src/main/AndroidManifest.xml'
                resources {
                    //正式版本时，排除debug文件夹下所有调试文件
                    exclude 'src/debug/*'
                }
            }
        }
    }
    //统一资源前缀，规范资源引用
    resourcePrefix "app_"
    dataBinding {
        enabled true
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //宿主项目中判断组件是否需要独立运行
    if (isBuildModule.toBoolean()) {
        //组件独立运行时，宿主项目直接依赖基础库，避免编译错误
        implementation project(':library-base')
    } else {
        //主业务模块
        implementation project(':module-main')
        //身份验证模块
        implementation project(':module-sign')
        //应用模块
        implementation project(':module-home')
        //工作模块
        implementation project(':module-work')
        //消息模块
        implementation project(':module-msg')
        //用户模块
        implementation project(':module-user')
    }
}
