Bug 1384680 - Generalize GRADLE_MAVEN_REPOSITORY to GRADLE_MAVEN_REPOSITORIES. r=gps,sebastian
authorNick Alexander <nalexander@mozilla.com>
Wed, 26 Jul 2017 11:28:07 -0700
changeset 420459 781e8d0045d096947f419441b88a380902b4753f
parent 420458 b822fd4c1977a6ee7a6f8f054aa3c15646c320f1
child 420460 547273e23ee4e888356414063c0a82e30f39573f
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, sebastian
bugs1384680
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)