-
Notifications
You must be signed in to change notification settings - Fork 645
Migrate from kotlinOptions to compilerOptions #2746
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
Changes from 6 commits
436ffcc
a5af962
6659381
61d6c18
80f0da4
1361b36
9856ad2
5f00a50
9992343
3aaaa09
8341e3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,13 @@ | |
@file:OptIn(ExperimentalWasmDsl::class) | ||
|
||
import org.gradle.kotlin.dsl.* | ||
import org.jetbrains.kotlin.gradle.* | ||
import org.jetbrains.kotlin.gradle.dsl.* | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.* | ||
import org.jetbrains.kotlin.gradle.targets.js.dsl.* | ||
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl | ||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension | ||
import org.jetbrains.kotlin.gradle.targets.native.tasks.* | ||
import org.jetbrains.kotlin.gradle.tasks.* | ||
import org.jetbrains.kotlin.gradle.testing.* | ||
|
||
plugins { | ||
|
@@ -30,13 +33,13 @@ kotlin { | |
|
||
jvm { | ||
withJava() | ||
compilations.configureEach { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
freeCompilerArgs += "-Xjdk-release=1.8" | ||
} | ||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_1_8) | ||
qwwdfsad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
freeCompilerArgs.add("-Xjdk-release=1.8") | ||
} | ||
} | ||
jvmToolchain(jdkToolchainVersion) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't here before, why is it needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In master (2.0.20), KGP requires toolchain and and jvmTarget to be consistent. Otherwise, things like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, given that we have both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you've added
probably should use it as well instead of |
||
|
||
js { | ||
nodejs { | ||
|
@@ -46,11 +49,11 @@ kotlin { | |
} | ||
} | ||
} | ||
compilations.matching { it.name == "main" || it.name == "test" }.configureEach { | ||
kotlinOptions { | ||
sourceMap = true | ||
moduleKind = "umd" | ||
} | ||
|
||
@OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
compilerOptions { | ||
sourceMap = true | ||
moduleKind.set(JsModuleKind.MODULE_UMD) | ||
qwwdfsad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
|
||
|
@@ -154,19 +157,17 @@ kotlin { | |
optIn("kotlinx.serialization.ExperimentalSerializationApi") | ||
} | ||
} | ||
} | ||
|
||
targets.all { | ||
compilations.all { | ||
kotlinOptions { | ||
if (overriddenLanguageVersion != null) { | ||
languageVersion = overriddenLanguageVersion | ||
freeCompilerArgs += "-Xsuppress-version-warnings" | ||
} | ||
freeCompilerArgs += "-Xexpect-actual-classes" | ||
} | ||
} | ||
compilations["main"].kotlinOptions { | ||
tasks.withType(KotlinCompilationTask::class).configureEach { | ||
qwwdfsad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
compilerOptions { | ||
if (name == "main") { | ||
qwwdfsad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
allWarningsAsErrors = true | ||
} | ||
if (overriddenLanguageVersion != null) { | ||
languageVersion.set(KotlinVersion.fromVersion(overriddenLanguageVersion!!)) | ||
qwwdfsad marked this conversation as resolved.
Show resolved
Hide resolved
|
||
freeCompilerArgs.add("-Xsuppress-version-warnings") | ||
} | ||
freeCompilerArgs.add("-Xexpect-actual-classes") | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.