Merge "Add the ability to download prebuilts from `androidx.dev`." into androidx-main
diff --git a/development/importMaven/build.gradle.kts b/development/importMaven/build.gradle.kts
index 97804c5..a2d6ae7 100644
--- a/development/importMaven/build.gradle.kts
+++ b/development/importMaven/build.gradle.kts
@@ -80,10 +80,15 @@
        linuxX64()
 }
 
+val androidxBuildId: String? = findProperty("androidxBuildId") as String?
 val metalavaBuildId: String? = findProperty("metalavaBuildId") as String?
+
 // Set up repositories from this to fetch the artifacts
 repositories {
-    // Metalava has to be first on the list because it is also published on google() and we
+    if (androidxBuildId != null) {
+        maven(url="https://androidx.dev/snapshots/builds/${androidxBuildId}/artifacts/repository")
+    }
+    // Metalava has to be early in the list because it is also published on google() and we
     // sometimes re-use versions
     if (metalavaBuildId != null) {
         maven(url="https://androidx.dev/metalava/builds/${metalavaBuildId}/artifacts/repo/m2repository")
diff --git a/development/importMaven/import_maven_artifacts.py b/development/importMaven/import_maven_artifacts.py
index 1b5b25f..7890964f 100755
--- a/development/importMaven/import_maven_artifacts.py
+++ b/development/importMaven/import_maven_artifacts.py
@@ -23,6 +23,11 @@
   E.g. android.arch.work:work-runtime-ktx:1.0.0-alpha07
 '''
 
+ANDROIDX_BUILD_ID_HELP = '''
+  The build id of https://ci.android.com/builds/branches/aosp-androidx-main/grid?
+  to use for fetching androidx prebuilts.
+'''
+
 METALAVA_BUILD_ID_HELP = '''
   The build id of https://ci.android.com/builds/branches/aosp-metalava-master/grid?
   to use for metalava prebuilt fetching.
@@ -44,6 +49,8 @@
         description='Helps download maven artifacts to prebuilts.')
     parser.add_argument('-n', '--name', help=NAME_HELP,
                         required=True, dest='name')
+    parser.add_argument('-ab', '--androidx-build-id', help=ANDROIDX_BUILD_ID_HELP,
+                        required=False, dest='androidx_build_id')
     parser.add_argument('-mb', '--metalava-build-id', help=METALAVA_BUILD_ID_HELP,
                         required=False, dest='metalava_build_id')
     parser.add_argument('-ajd', '--allow-jetbrains-dev', help=ALLOW_JETBRAINS_DEV_HELP,
@@ -56,6 +63,11 @@
     # Add -Dorg.gradle.debug=true to debug or --stacktrace to see the stack trace
     command = './gradlew --build-file build.gradle.kts --no-configuration-cache -PartifactNames=%s' % (
         artifact_name)
+    # AndroidX Build Id
+    androidx_build_id = parse_result.androidx_build_id
+    if (androidx_build_id):
+      command = command + ' -PandroidxBuildId=%s' % (androidx_build_id)
+    # Metalava Build Id
     metalava_build_id = parse_result.metalava_build_id
     if (metalava_build_id):
       command = command + ' -PmetalavaBuildId=%s' % (metalava_build_id)