Skip to content

Commit

Permalink
Kotlin 2.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Jun 1, 2024
1 parent fa2f2c4 commit 09d3448
Show file tree
Hide file tree
Showing 4 changed files with 568 additions and 313 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ out/
build/
reports/

.kotlin/

# Local configuration file (sdk path, etc)
local.properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

internal class ConventionPlugin : Plugin<Project> {
override fun apply(project: Project) = with(project) {
Expand Down Expand Up @@ -66,10 +68,7 @@ private fun Project.configureSubproject() {
configureTargets(this@configureSubproject)
sourceSets.configureEach {
languageSettings.apply {
languageVersion = "1.9"
progressiveMode = true
enableLanguageFeature("NewInference")
optIn("kotlin.time.ExperimentalTime")
}
}
}
Expand Down Expand Up @@ -115,19 +114,33 @@ private fun Project.configureSubproject() {

@Suppress("LongMethod", "MagicNumber")
private fun KotlinMultiplatformExtension.configureTargets(project: Project) {
jvm {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(22))
vendor.set(JvmVendorSpec.AZUL)
}
targets.configureEach {
compilations.configureEach {
compilerOptions.configure {
jvmTarget.set(JvmTarget.JVM_11)
freeCompilerArgs.addAll(
"-Xjvm-default=all"
)
compileTaskProvider.configure {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(22))
vendor.set(JvmVendorSpec.AZUL)
}
project.tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
freeCompilerArgs.addAll(
"-Xjvm-default=all"
)
}
}
project.tasks.withType<KotlinJsCompile>().configureEach {
compilerOptions {
moduleKind.set(JsModuleKind.MODULE_COMMONJS)
}
}
jvm {
val main = compilations.getByName("main")
compilations.create("lincheck") {
defaultSourceSet {
Expand All @@ -153,11 +166,6 @@ private fun KotlinMultiplatformExtension.configureTargets(project: Project) {
}
}
js {
compilations.configureEach {
compilerOptions.configure {
moduleKind.set(JsModuleKind.MODULE_COMMONJS)
}
}
browser()
nodejs()
}
Expand All @@ -182,7 +190,6 @@ private fun KotlinMultiplatformExtension.configureTargets(project: Project) {
mingwX64()
applyDefaultHierarchyTemplate()

@Suppress("UnusedPrivateProperty")
sourceSets {
val nonJvmMain by creating {
dependsOn(commonMain.get())
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.9.23"
kotlin = "2.0.0"
dokka = "1.9.10"
binaryCompabilityValidator = "0.14.0"
toolchainsResolver = "0.8.0"
Expand Down
Loading

0 comments on commit 09d3448

Please sign in to comment.