From edfd4dcddf68d488f380415adafc6b11e45f519a Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 3 Jun 2022 01:13:29 -0700 Subject: [PATCH] Fix kotlin jvmTarget --- buildSrc/src/main/java/Setup.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/java/Setup.kt b/buildSrc/src/main/java/Setup.kt index 294a0c840..567ce4c36 100644 --- a/buildSrc/src/main/java/Setup.kt +++ b/buildSrc/src/main/java/Setup.kt @@ -5,6 +5,7 @@ import org.apache.tools.ant.filters.FixCrLfFilter import org.gradle.api.Action import org.gradle.api.JavaVersion import org.gradle.api.Project +import org.gradle.api.plugins.ExtensionAware import org.gradle.api.tasks.Delete import org.gradle.api.tasks.StopExecutionException import org.gradle.api.tasks.Sync @@ -24,8 +25,8 @@ private fun Project.androidBase(configure: Action) = private fun Project.android(configure: Action) = extensions.configure("android", configure) -private fun Project.kotlinOptions(configure: Action) = - extensions.findByName("kotlinOptions")?.let { +private fun BaseExtension.kotlinOptions(configure: Action) = + (this as ExtensionAware).extensions.findByName("kotlinOptions")?.let { configure.execute(it as KotlinJvmOptions) } @@ -47,9 +48,10 @@ fun Project.setupCommon() { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } - } - kotlinOptions { - jvmTarget = "11" + + kotlinOptions { + jvmTarget = "11" + } } }