buildscript { repositories { // 阿里云云效仓库:https://maven.aliyun.com/mvn/guide maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } // 华为开源镜像:https://mirrors.huaweicloud.com/ maven { url 'https://repo.huaweicloud.com/repository/maven/' } // JitPack 远程仓库:https://jitpack.io maven { url 'https://jitpack.io' } mavenCentral() google() // noinspection JcenterRepositoryObsolete jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.1.2' // Kotlin 插件:https://plugins.jetbrains.com/plugin/6954-kotlin // noinspection GradleDependency // classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31' } } allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://repo.huaweicloud.com/repository/maven/' } maven { url 'https://jitpack.io' } mavenCentral() google() // noinspection JcenterRepositoryObsolete jcenter() } // 读取 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 != "") { // 将构建文件统一输出到指定的目录下 setBuildDir(new File(buildDirPath, rootProject.name + "/build/${path.replaceAll(':', '/')}")) } else { // 将构建文件统一输出到项目根目录下的 build 文件夹 setBuildDir(new File(rootDir, "build/${path.replaceAll(':', '/')}")) } } tasks.register('clean', Delete) { delete rootProject.buildDir }