diff --git a/android/app/build.gradle b/android/app/build.gradle index fbdde13d..04c0bd61 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -71,7 +71,9 @@ android { applicationVariants.all { variant -> def flavor = variant.productFlavors[0].name - if (flavor == "ci") { + // The ci branch reads the private-mirror properties at configuration time, + // which runs for every variant — only enter it when the mirror is configured. + if (flavor == "ci" && project.hasProperty("mavenHost")) { repositories { maven { credentials { diff --git a/android/settings.gradle b/android/settings.gradle index 20dc76c5..8cf96c5f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,29 +1,26 @@ pluginManagement { repositories { - maven { - credentials { - username "$mavenUser" - password "$mavenPassword" + // Private mirror only when its coordinates are supplied (-PmavenHost=… as in upstream CI); + // everyone else resolves plugins from the public repositories. + def mavenHost = providers.gradleProperty("mavenHost") + if (mavenHost.present) { + def mavenUser = providers.gradleProperty("mavenUser").get() + def mavenPassword = providers.gradleProperty("mavenPassword").get() + ["gradle-plugin-portal", "google-maven", "maven-central"].each { repo -> + maven { + credentials { + username mavenUser + password mavenPassword + } + url "${mavenHost.get()}/repository/${repo}/" + allowInsecureProtocol = true + } } - url "$mavenHost/repository/gradle-plugin-portal/" - allowInsecureProtocol = true - } - maven { - credentials { - username "$mavenUser" - password "$mavenPassword" - } - url "$mavenHost/repository/google-maven/" - allowInsecureProtocol = true - } - maven { - credentials { - username "$mavenUser" - password "$mavenPassword" - } - url "$mavenHost/repository/maven-central/" - allowInsecureProtocol = true + } else { + gradlePluginPortal() + google() + mavenCentral() } } } -include ':app' \ No newline at end of file +include ':app'