Fix kotlin jvmTarget

This commit is contained in:
topjohnwu 2022-06-03 01:13:29 -07:00
parent fb89cf1367
commit edfd4dcddf

View File

@ -5,6 +5,7 @@ import org.apache.tools.ant.filters.FixCrLfFilter
import org.gradle.api.Action import org.gradle.api.Action
import org.gradle.api.JavaVersion import org.gradle.api.JavaVersion
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.Delete import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.StopExecutionException import org.gradle.api.tasks.StopExecutionException
import org.gradle.api.tasks.Sync import org.gradle.api.tasks.Sync
@ -24,8 +25,8 @@ private fun Project.androidBase(configure: Action<BaseExtension>) =
private fun Project.android(configure: Action<BaseAppModuleExtension>) = private fun Project.android(configure: Action<BaseAppModuleExtension>) =
extensions.configure("android", configure) extensions.configure("android", configure)
private fun Project.kotlinOptions(configure: Action<KotlinJvmOptions>) = private fun BaseExtension.kotlinOptions(configure: Action<KotlinJvmOptions>) =
extensions.findByName("kotlinOptions")?.let { (this as ExtensionAware).extensions.findByName("kotlinOptions")?.let {
configure.execute(it as KotlinJvmOptions) configure.execute(it as KotlinJvmOptions)
} }
@ -47,10 +48,11 @@ fun Project.setupCommon() {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
} }
}
kotlinOptions { kotlinOptions {
jvmTarget = "11" jvmTarget = "11"
} }
}
} }
private fun Project.setupAppCommon() { private fun Project.setupAppCommon() {