Skip to content

Commit

Permalink
Merge pull request #777 from arkivanov/kotlin-2
Browse files Browse the repository at this point in the history
Updated Kotlin to 2.0.0, coroutines to 1.8.1, Detekt to 1.23.6, AGP to 8.2.0
  • Loading branch information
CherryPerry authored Jun 3, 2024
2 parents 8aaa172 + bf68e74 commit d089611
Show file tree
Hide file tree
Showing 17 changed files with 695 additions and 419 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build
*/node_modules
*/package-lock.json
*.hprof
.kotlin
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ android.useAndroidX=true
android.enableJetifier=true

kotlin.mpp.applyDefaultHierarchyTemplate=false

# For compatibility with Kotlin 1.9.0, see https://github.com/badoo/Reaktive/issues/697
android.experimental.lint.version=8.1.0
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin = "1.9.22"
kotlinx-coroutines = "1.8.0"
detekt = "1.22.0"
kotlin = "2.0.0"
kotlinx-coroutines = "1.8.1"
detekt = "1.23.6"

[libraries]
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
Expand All @@ -10,11 +10,11 @@ kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-annotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations", version.ref = "kotlin" }

kotlinx-compatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.13.2"
kotlinx-compatibility = "org.jetbrains.kotlinx:binary-compatibility-validator:0.14.0"
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }

android-plugin = "com.android.tools.build:gradle:8.0.2"
android-plugin = "com.android.tools.build:gradle:8.2.0"

androidx-appcompat = "androidx.appcompat:appcompat:1.4.2"
androidx-constraintLayout = "androidx.constraintlayout:constraintlayout:1.1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@ class JsPlugin : Plugin<Project> {
private fun configureJsCompilation(target: Project) {
target.extensions.configure(KotlinMultiplatformExtension::class.java) {
js {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
nodejs {
testTask {
useCommonJs()
}
}
browser()
nodejs()

disableIfUndefined(Target.JS)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ class MppConfigurationPlugin : Plugin<Project> {

targets.configureEach {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
compileTaskProvider.configure {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
Expand Down Expand Up @@ -157,8 +159,8 @@ class MppConfigurationPlugin : Plugin<Project> {
}
}
project.tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
project.kotlin {
Expand All @@ -178,8 +180,10 @@ class MppConfigurationPlugin : Plugin<Project> {
jvm {
disableIfUndefined(Target.JVM)
compilations.getByName("main").apply {
compilerOptions.configure {
jvmTarget.set(JvmTarget.JVM_1_8)
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
fun KotlinTarget.disableIfUndefined(target: Target) {
if (!shouldDefineTarget(project, target)) {
compilations.all {
compileKotlinTask.enabled = false
compileTaskProvider.configure {
enabled = false
}
}

if (target == Target.LINUX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ class DetektConfigurationPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("io.gitlab.arturbosch.detekt")
target.extensions.configure(DetektExtension::class.java) {
source = target.files(
target
.file("src")
.listFiles()
?.filter { it.isDirectory && it.name.endsWith("main", ignoreCase = true) }
source.setFrom(
target.files(
target
.file("src")
.listFiles()
?.filter { it.isDirectory && it.name.endsWith("main", ignoreCase = true) }
)
)
config = target.rootProject.files("detekt.yml")

config.setFrom(target.rootProject.files("detekt.yml"))
buildUponDefaultConfig = true
}
target.dependencies.add(CONFIGURATION_DETEKT_PLUGINS, target.getLibrary("detekt-ktlint"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget
import java.net.URI

class PublishConfigurationPlugin : Plugin<Project> {
Expand Down Expand Up @@ -125,7 +125,7 @@ class PublishConfigurationPlugin : Plugin<Project> {
private fun createConfigurationMap(project: Project): Map<String, Boolean> {
return mapOf(
"kotlinMultiplatform" to Target.shouldPublishTarget(project, Target.META),
KotlinMultiplatformPlugin.METADATA_TARGET_NAME to Target.shouldPublishTarget(project, Target.META),
KotlinMetadataTarget.METADATA_TARGET_NAME to Target.shouldPublishTarget(project, Target.META),
"jvm" to Target.shouldPublishTarget(project, Target.JVM),
"js" to Target.shouldPublishTarget(project, Target.JS),
"wasmJs" to Target.shouldPublishTarget(project, Target.WASM_JS),
Expand Down
Loading

0 comments on commit d089611

Please sign in to comment.