Add kotlin compilers as a dependency for compiling tests

Change-Id: Ie331a9ce403a34e3ed7e191f08767cafaf7a491e
diff --git a/build.gradle b/build.gradle
index 332b74a..1328ee2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -341,8 +341,6 @@
                 "jsr223-api-1.0",
                 "rhino-1.7.10",
                 "rhino-android-1.1.1",
-                "kotlin/kotlin-compiler-1.3.11",
-                "kotlin/kotlin-compiler-1.3.41",
                 "kotlin/kotlin-compiler-1.3.72",
                 "kotlin/kotlin-compiler-1.4.20",
                 "kotlin/kotlin-compiler-1.5.0",
diff --git a/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt b/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
index 634e734..6824b3e 100644
--- a/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
+++ b/d8_r8/commonBuildSrc/src/main/kotlin/DependenciesPlugin.kt
@@ -297,6 +297,8 @@
 }
 
 object ThirdPartyDeps {
+  val androidJars : List<ThirdPartyDependency> = getThirdPartyAndroidJars()
+  val androidVMs = getThirdPartyAndroidVms()
   val apiDatabase = ThirdPartyDependency(
     "apiDatabase",
     Paths.get(
@@ -310,28 +312,27 @@
     "ddmlib",
     Paths.get("third_party", "ddmlib", "ddmlib.jar").toFile(),
     Paths.get("third_party", "ddmlib.tar.gz.sha1").toFile())
-  val jasmin = ThirdPartyDependency(
-    "jasmin",
-    Paths.get("third_party", "jasmin", "jasmin-2.4.jar").toFile(),
-    Paths.get("third_party", "jasmin.tar.gz.sha1").toFile())
-  val jdwpTests = ThirdPartyDependency(
-    "jdwp-tests",
-    Paths.get("third_party", "jdwp-tests", "apache-harmony-jdwp-tests-host.jar").toFile(),
-    Paths.get("third_party", "jdwp-tests.tar.gz.sha1").toFile())
-  val androidJars : List<ThirdPartyDependency> = getThirdPartyAndroidJars()
   val jacoco = ThirdPartyDependency(
     "jacoco",
     Paths.get("third_party", "jacoco", "0.8.6", "lib", "jacocoagent.jar").toFile(),
     Paths.get("third_party", "jacoco", "0.8.6.tar.gz.sha1").toFile()
   )
+  val jasmin = ThirdPartyDependency(
+    "jasmin",
+    Paths.get("third_party", "jasmin", "jasmin-2.4.jar").toFile(),
+    Paths.get("third_party", "jasmin.tar.gz.sha1").toFile())
   val java8Runtime = ThirdPartyDependency(
     "openjdk-rt-1.8",
     Paths.get("third_party", "openjdk", "openjdk-rt-1.8", "rt.jar").toFile(),
     Paths.get("third_party", "openjdk", "openjdk-rt-1.8.tar.gz.sha1").toFile()
   )
-  val androidVMs : List<ThirdPartyDependency> = getThirdPartyAndroidVms()
-  val jdks : List<ThirdPartyDependency> = getJdks()
-  val proguards : List<ThirdPartyDependency> = getThirdPartyProguards()
+  val jdks = getJdks()
+  val jdwpTests = ThirdPartyDependency(
+    "jdwp-tests",
+    Paths.get("third_party", "jdwp-tests", "apache-harmony-jdwp-tests-host.jar").toFile(),
+    Paths.get("third_party", "jdwp-tests.tar.gz.sha1").toFile())
+  val kotlinCompilers = getThirdPartyKotlinCompilers()
+  val proguards = getThirdPartyProguards()
 }
 
 fun getThirdPartyAndroidJars() : List<ThirdPartyDependency> {
@@ -414,7 +415,26 @@
           it,
           "bin",
           if (os.isWindows) "proguard.bat" else "proguard.sh").toFile(),
-        Paths.get("third_party", "proguard", "${it}.tar.gz.sha1").toFile()
-      )
-    }
+        Paths.get("third_party", "proguard", "${it}.tar.gz.sha1").toFile())}
+}
+
+fun getThirdPartyKotlinCompilers() : List<ThirdPartyDependency> {
+  return listOf(
+    "kotlin-compiler-1.3.72",
+    "kotlin-compiler-1.4.20",
+    "kotlin-compiler-1.5.0",
+    "kotlin-compiler-1.6.0",
+    "kotlin-compiler-1.7.0",
+    "kotlin-compiler-1.8.0",
+    "kotlin-compiler-dev")
+    .map { ThirdPartyDependency(
+      it,
+      Paths.get(
+        "third_party",
+        "kotlin",
+        it,
+        "kotlinc",
+        "lib",
+        "kotlin-stdlib.jar").toFile(),
+      Paths.get("third_party", "kotlin", "${it}.tar.gz.sha1").toFile())}
 }
\ No newline at end of file
diff --git a/d8_r8/test_modules/tests_java_8/build.gradle.kts b/d8_r8/test_modules/tests_java_8/build.gradle.kts
index a15deb5..7e41431 100644
--- a/d8_r8/test_modules/tests_java_8/build.gradle.kts
+++ b/d8_r8/test_modules/tests_java_8/build.gradle.kts
@@ -59,6 +59,7 @@
     + ThirdPartyDeps.androidJars
     + ThirdPartyDeps.androidVMs
     + ThirdPartyDeps.jdks
+    + ThirdPartyDeps.kotlinCompilers
     + ThirdPartyDeps.proguards)
 
 val sourceSetDependenciesTasks = arrayOf(
diff --git a/third_party/kotlin/kotlin-compiler-1.3.11.tar.gz.sha1 b/third_party/kotlin/kotlin-compiler-1.3.11.tar.gz.sha1
deleted file mode 100644
index 05e8466..0000000
--- a/third_party/kotlin/kotlin-compiler-1.3.11.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-b3ce5c6ba25ebbbbf62a49be56aad845eabae860
\ No newline at end of file
diff --git a/third_party/kotlin/kotlin-compiler-1.3.41.tar.gz.sha1 b/third_party/kotlin/kotlin-compiler-1.3.41.tar.gz.sha1
deleted file mode 100644
index e9de3b3..0000000
--- a/third_party/kotlin/kotlin-compiler-1.3.41.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-8d2ddeeaaf4366a419627a31ef3276a6f96afe40
\ No newline at end of file
diff --git a/third_party/kotlin/kotlin-compiler-1.5.0-M2.tar.gz.sha1 b/third_party/kotlin/kotlin-compiler-1.5.0-M2.tar.gz.sha1
deleted file mode 100644
index e0b251e..0000000
--- a/third_party/kotlin/kotlin-compiler-1.5.0-M2.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-7368d9ee73d01fc609d7ded1bf0506f72aa3ac66
\ No newline at end of file