val mirrorRepos = listOf(
    "https://maven.aliyun.com/repository/google",
    "https://maven.aliyun.com/repository/public",
    "https://maven.aliyun.com/repository/gradle-plugin",
)

fun org.gradle.api.artifacts.dsl.RepositoryHandler.addMirrorRepos() {
    mirrorRepos.forEach { url ->
        maven(url)
    }
}

settingsEvaluated {
    pluginManagement.repositories.apply {
        addMirrorRepos()
        mavenCentral()
        gradlePluginPortal()
        google()
    }
}

gradle.beforeProject {
    buildscript.repositories.apply {
        addMirrorRepos()
        mavenCentral()
        google()
    }
}
