Directly finding the gradle-kotlin-dsl.jar from the current running Gradle
rather than trying to autodetect the appropriate hash
In case there are multiple gradle dirs.
Change-Id: I9f18adff63410d11b2c6e8992cb8095874368554
diff --git a/buildSrc/kotlin-dsl-dependency.gradle b/buildSrc/kotlin-dsl-dependency.gradle
index 943d15f..e493a8f 100644
--- a/buildSrc/kotlin-dsl-dependency.gradle
+++ b/buildSrc/kotlin-dsl-dependency.gradle
@@ -19,17 +19,8 @@
// directly call the getGradleKotlinDsl() method.
// We're not doing that yet though because Gradle takes more time to process .kts files (at the
// time of writing, adding a .kts file adds roughly 10 addition seconds to build startup time).
- def gradleUserHome = project.gradle.getGradleUserHomeDir()
- def gradleVersion = project.gradle.getGradleVersion()
- def containingPath = "" + gradleUserHome + "/wrapper/dists/gradle-" + gradleVersion + "-bin"
- def subdirs = project.file(containingPath).listFiles()
- if (subdirs.length != 1) {
- throw new GradleException("Could not identify Gradle distribution in " + containingPath +
- "; expected 1, found " + subdirs.length + ": " + subdirs)
- }
- def gradleHashDir = subdirs[0]
- def kotlinDsl = "" + gradleHashDir + "/gradle-" + gradleVersion + "/lib/gradle-kotlin-dsl-" +
- gradleVersion + ".jar"
+ def kotlinDsl = "" + project.gradle.getGradleHomeDir() + "/lib/gradle-kotlin-dsl-" +
+ project.gradle.getGradleVersion() + ".jar"
if (!project.file(kotlinDsl).exists()) {
throw new GradleException("Kotlin dsl jar does not exist: " + kotlinDsl)
}