diff --git a/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt index 40a0b52e..da553fe9 100644 --- a/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt @@ -4,7 +4,9 @@ import com.android.build.api.dsl.CommonExtension import org.gradle.api.JavaVersion import org.gradle.api.Project import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile private object Constants { val JAVA_VERSION = JavaVersion.VERSION_17 @@ -30,12 +32,18 @@ internal fun Project.configureKotlinAndroid( } private fun Project.configureKotlin() { - tasks.withType().configureEach { - kotlinOptions { - jvmTarget = Constants.JAVA_VERSION.toString() - freeCompilerArgs += listOf( - "-Xopt-in=kotlin.RequiresOptIn", - "-Xopt-in=com.mirego.pilot.components.InternalPilotComponentsApi" + tasks.withType().configureEach { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } + } + tasks.withType> { + compilerOptions { + optIn.addAll( + listOf( + "kotlin.RequiresOptIn", + "com.mirego.pilot.components.InternalPilotComponentsApi", + ), ) } } diff --git a/build.gradle.kts b/build.gradle.kts index f47dc439..ee3b7a86 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask plugins { alias(libs.plugins.kotlin.android) apply false @@ -16,6 +17,12 @@ allprojects { google() mavenCentral() } + + tasks.withType> { + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") + } + } } subprojects {