Add support for downloading r8 mappings file for retrace tests

Bug: 132850880
Change-Id: I69940222b58c5d1fb3c8f77727473f260c6b26c6
diff --git a/build.gradle b/build.gradle
index d3ba4fa..87bae70 100644
--- a/build.gradle
+++ b/build.gradle
@@ -476,6 +476,22 @@
     }
 }
 
+task downloadMappingFilesForRetraceTests {
+    def hashes = [
+            "82710798b61fd70910d76d23a71e436356becb66",
+            "dab96bbe5948133f0ae6e0a88fc133464421cf47"
+    ]
+    outputs.files hashes.each { hash -> file("${buildDir}/retrace/${hash}-r8lib.jar.map") }
+    hashes.each { hash ->
+        def outputDir = new File("${buildDir}/retrace")
+        outputDir.mkdirs()
+        def output = new File("${buildDir}/retrace/${hash}-r8lib.jar.map")
+        output.createNewFile()
+        new URL("http://storage.googleapis.com/r8-releases/raw/master/${hash}/r8lib.jar.map")
+                .withInputStream { i -> output.withOutputStream { it << i } }
+    }
+}
+
 allprojects {
     sourceCompatibility = JavaVersion.VERSION_1_8
     targetCompatibility = JavaVersion.VERSION_1_8