allprojects {
    repositories {
        maven { url 'https://repo.huaweicloud.com/repository/maven/' }
        maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/center' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://jitpack.io' }
        google()
        mavenCentral()
    }

     // 修复由于高版本导致namespace检测为空的问题，没遇到可不添加
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }

            // 指定Kotilin的jvm版本与编译版本
             def javaVersion = JavaVersion.VERSION_1_8
             android {
                 compileOptions {
                     sourceCompatibility javaVersion
                     targetCompatibility javaVersion
                 }
                 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
                     kotlinOptions {
                         jvmTarget = javaVersion.toString()
                     }
                 }
                 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KaptGenerateStubs).configureEach {
                     kotlinOptions {
                         jvmTarget = javaVersion.toString()
                     }
                 }
             }
        }
    }
    // 修复由于高版本导致namespace检测为空的问题，没遇到可不添加
}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}
