allprojects {
    extra.apply {
        set("compileSdkVersion", 35)
        set("applicationId", "com.jianpan")
//        set("applicationId", "com.yunshu.chuangyiai")
        set("minSdkVersion", 23)
        set("targetSdkVersion", 35)
        set("ndkVersion", "27.0.12077973")
    }
    repositories {
        maven {
            url = uri("https://jitpack.io")
        }
        google()
        mavenCentral()
    }
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
    val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
    project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
    delete(rootProject.layout.buildDirectory)
}

subprojects {
    plugins.withId("com.android.application") {
        extensions.findByType<com.android.build.gradle.BaseExtension>()?.let { androidExt ->
            if (androidExt.namespace == null) {
                androidExt.namespace = project.group.toString()
            }
        }
    }
    plugins.withId("com.android.library") {
        extensions.findByType<com.android.build.gradle.BaseExtension>()?.let { androidExt ->
            if (androidExt.namespace == null) {
                androidExt.namespace = project.group.toString()
            }
        }
    }
}