Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change kotlinOptions to compilerOptions #1401

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions build-logic/convention/build.gradle.kts
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -29,8 +30,8 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

Expand Down
Expand Up @@ -54,10 +54,10 @@ internal fun Project.configureAndroidCompose(
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += buildComposeMetricsParameters()
freeCompilerArgs += stabilityConfiguration()
freeCompilerArgs += strongSkippingConfiguration()
compilerOptions {
freeCompilerArgs.addAll(buildComposeMetricsParameters())
freeCompilerArgs.addAll(stabilityConfiguration())
freeCompilerArgs.addAll(strongSkippingConfiguration())
}
}
}
Expand Down
Expand Up @@ -24,6 +24,7 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/**
Expand Down Expand Up @@ -75,17 +76,16 @@ internal fun Project.configureKotlinJvm() {
private fun Project.configureKotlin() {
// Use withType to workaround https://youtrack.jetbrains.com/issue/KT-55947
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
compilerOptions {
// Set JVM target to 11
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget.set(JVM_11)
// Treat all Kotlin warnings as errors (disabled by default)
// Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties
val warningsAsErrors: String? by project
allWarningsAsErrors = warningsAsErrors.toBoolean()
freeCompilerArgs = freeCompilerArgs + listOf(
// Enable experimental coroutines APIs, including Flow
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
)
allWarningsAsErrors.set(warningsAsErrors.toBoolean())

// Enable experimental coroutines APIs, including Flow
freeCompilerArgs.add("-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi")
}
}
}
5 changes: 3 additions & 2 deletions lint/build.gradle.kts
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -30,8 +31,8 @@ java {
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
compilerOptions {
jvmTarget.set(JVM_11)
}
}

Expand Down