// 通用配置
android {

    // 编译源码版本
    compileSdk 36
    defaultConfig {
        // Android 版本适配指南：https://github.com/getActivity/AndroidVersionAdapter
        targetSdk 36
        versionCode 1306
        versionName "13.6"
    }

    // 支持 Java JDK 8
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    // 读取 local.properties 文件配置
    def properties = new Properties()
    def localPropertiesFile = rootProject.file("local.properties")
    if (localPropertiesFile.exists()) {
        localPropertiesFile.withInputStream { inputStream ->
            properties.load(inputStream)
        }
    }

    String buildDirPath = properties.getProperty("build.dir")
    if (buildDirPath != null && buildDirPath != "") {
        // 将构建文件统一输出到指定的目录下
        project.buildDir = new File(buildDirPath, rootProject.name + "/build/${path.replaceAll(':', '/')}")
    } else {
        // 将构建文件统一输出到项目根目录下的 build 文件夹
        project.buildDir = new File(rootDir, "build/${path.replaceAll(':', '/')}")
    }
}