Bug 1384680 - Generalize GRADLE_MAVEN_REPOSITORY to GRADLE_MAVEN_REPOSITORIES. r=gps,sebastian draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 26 Jul 2017 11:28:07 -0700
changeset 617638 d328f9ce9299dcd80e508925314236747aee1ea3
parent 617496 16ffc1d05422a81099ce8b9b59de66dde4c8b2f0
child 617639 80cc860338132c28a22ca0a6c405484feec91136
push id71103
push usernalexander@mozilla.com
push dateFri, 28 Jul 2017 19:12:54 +0000
reviewersgps, sebastian
bugs1384680
milestone56.0a1
Bug 1384680 - Generalize GRADLE_MAVEN_REPOSITORY to GRADLE_MAVEN_REPOSITORIES. r=gps,sebastian I'm confident nobody is configuring this locally, so there's no reason to keep the existing name (and grow the new semantics) nor to deprecate the existing name explicitly. MozReview-Commit-ID: HW3epgwZFpO
build.gradle
mobile/android/config/mozconfigs/android-api-15-frontend/nightly
mobile/android/config/mozconfigs/android-api-15-gradle-dependencies/nightly
mobile/android/config/mozconfigs/android-api-15-gradle/nightly
mobile/android/gradle.configure
--- a/build.gradle
+++ b/build.gradle
@@ -25,31 +25,31 @@ allprojects {
             ANDROID_PACKAGE_NAME: mozconfig.substs.ANDROID_PACKAGE_NAME,
             ANDROID_TARGET_SDK: mozconfig.substs.ANDROID_TARGET_SDK,
             MOZ_ANDROID_MIN_SDK_VERSION: mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION,
             MOZ_ANDROID_SHARED_ID: "${mozconfig.substs.ANDROID_PACKAGE_NAME}.sharedID",
         ]
     }
 
     repositories {
-        if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
+        gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
             maven {
-                url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
+                url repository
             }
         }
     }
 }
 
 buildDir "${topobjdir}/gradle/build"
 
 buildscript {
     repositories {
-        if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) {
+        gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
             maven {
-                url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY
+                url repository
             }
         }
         // For android-sdk-manager SNAPSHOT releases.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
     }
 
--- a/mobile/android/config/mozconfigs/android-api-15-frontend/nightly
+++ b/mobile/android/config/mozconfigs/android-api-15-frontend/nightly
@@ -9,17 +9,17 @@ MOZ_AUTOMATION_UPLOAD=0
 MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 
 NO_CACHE=1
 NO_NDK=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 ac_add_options --with-gradle="$topsrcdir/gradle-dist/bin/gradle"
-export GRADLE_MAVEN_REPOSITORY="file://$topsrcdir/jcentral"
+export GRADLE_MAVEN_REPOSITORIES="file://$topsrcdir/jcentral"
 
 unset HOST_CC
 unset HOST_CXX
 unset RUSTC
 unset CARGO
 
 ac_add_options --disable-compile-environment
 ac_add_options --disable-tests
--- a/mobile/android/config/mozconfigs/android-api-15-gradle-dependencies/nightly
+++ b/mobile/android/config/mozconfigs/android-api-15-gradle-dependencies/nightly
@@ -10,18 +10,18 @@ MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 
 NO_CACHE=1
 NO_NDK=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 # We want to download Gradle.
 ac_add_options --with-gradle
-# We want to use (and populate!) the local Nexus repository.
-export GRADLE_MAVEN_REPOSITORY="http://localhost:8081/nexus/content/repositories/jcenter/"
+# We want to use (and populate!) the local Nexus repositories.
+export GRADLE_MAVEN_REPOSITORIES="http://localhost:8081/nexus/content/repositories/jcenter/"
 
 # From here on, just like ../android-api-15-frontend/nightly.
 
 ac_add_options --disable-compile-environment
 unset HOST_CC
 unset HOST_CXX
 unset RUSTC
 unset CARGO
--- a/mobile/android/config/mozconfigs/android-api-15-gradle/nightly
+++ b/mobile/android/config/mozconfigs/android-api-15-gradle/nightly
@@ -1,8 +1,8 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 . "$topsrcdir/mobile/android/config/mozconfigs/android-api-15/nightly"
 
 ac_add_options --with-gradle="$topsrcdir/gradle-dist/bin/gradle"
-export GRADLE_MAVEN_REPOSITORY="file://$topsrcdir/jcentral"
+export GRADLE_MAVEN_REPOSITORIES="file://$topsrcdir/jcentral"
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common.override"
--- a/mobile/android/gradle.configure
+++ b/mobile/android/gradle.configure
@@ -40,20 +40,27 @@ set_config('GRADLE', gradle)
 option(env='GRADLE_FLAGS', default='', help='Flags to pass to Gradle.')
 
 @depends('GRADLE_FLAGS')
 def gradle_flags(value):
     return value[0] if value else ''
 
 set_config('GRADLE_FLAGS', gradle_flags)
 
-
-# Automation will set this to file:///path/to/local via the mozconfig.
-# Local developer default is jcenter.
-option(env='GRADLE_MAVEN_REPOSITORY', default='https://jcenter.bintray.com/',
-       help='Path to Maven repository containing Gradle dependencies.')
+# Automation will set this to (file:///path/to/local, ...) via the mozconfig.
+# Local developer default is (jcenter, maven.google.com).
+option(env='GRADLE_MAVEN_REPOSITORIES',
+       nargs='+',
+       default=('https://jcenter.bintray.com/',
+                'https://maven.google.com/',
+       ),
+       help='Comma-separated URLs of Maven repositories containing Gradle dependencies.')
 
-@depends('GRADLE_MAVEN_REPOSITORY')
-def gradle_maven_repository(value):
-    if value:
-        return value[0]
+@depends('GRADLE_MAVEN_REPOSITORIES')
+@imports(_from='os.path', _import='isdir')
+def gradle_maven_repositories(values):
+    if not values:
+        die('GRADLE_MAVEN_REPOSITORIES must not be empty')
+    if not all(values):
+        die('GRADLE_MAVEN_REPOSITORIES entries must not be empty')
+    return values
 
-set_config('GRADLE_MAVEN_REPOSITORY', gradle_maven_repository)
+set_config('GRADLE_MAVEN_REPOSITORIES', gradle_maven_repositories)