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

Kotlin 2.0 #40

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
@file:Suppress("UnstableApiUsage")

import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.Framework
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

Expand Down Expand Up @@ -49,7 +44,6 @@ allprojects {
maven("https://jitpack.io")
}
configureCommonKotlin()
configureCommonCompose()
}

gradle.taskGraph.whenReady {
Expand All @@ -66,7 +60,6 @@ tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}

// https://github.com/cashapp/redwood/blob/trunk/build-support/src/main/kotlin/app/cash/redwood/buildsupport/RedwoodBuildPlugin.kt
private fun Project.configureCommonKotlin() {
tasks.withType(KotlinCompile::class.java).configureEach {
compilerOptions {
Expand Down Expand Up @@ -100,53 +93,4 @@ private fun Project.configureCommonKotlin() {
sourceCompatibility = Versions.javaVersion.toString()
targetCompatibility = Versions.javaVersion.toString()
}

plugins.withId("org.jetbrains.kotlin.multiplatform") {
val kotlin = extensions.getByName("kotlin") as KotlinMultiplatformExtension

// We set the JVM target (the bytecode version) above for all Kotlin-based Java bytecode
// compilations, but we also need to set the JDK API version for the Kotlin JVM targets to
// prevent linking against newer JDK APIs (the Android targets link against the android.jar).
kotlin.targets.withType(KotlinJvmTarget::class.java) {
compilations.configureEach {
compileTaskProvider.configure {
compilerOptions {
freeCompilerArgs.set(
freeCompilerArgs.getOrElse(emptyList()) + listOf(
"-Xjdk-release=${Versions.javaVersion}"
)
)
}
}
}
}

kotlin.targets.withType(KotlinNativeTarget::class.java) {
binaries.withType(Framework::class.java) {
linkerOpts += "-lsqlite3"
}
}
}
}

/**
* Force Android Compose UI and JetPack Compose UI usage to Compose compiler versions which are compatible
* with the project's Kotlin version.
*/
private fun Project.configureCommonCompose() {
tasks.withType<KotlinJsCompile>().configureEach {
compilerOptions {
freeCompilerArgs.set(
freeCompilerArgs.getOrElse(emptyList()) + listOf(
// https://github.com/JetBrains/compose-multiplatform/issues/3421
"-Xpartial-linkage=disable",
// https://github.com/JetBrains/compose-multiplatform/issues/3418
"-Xklib-enable-signature-clash-checks=false",
// Translate capturing lambdas into anonymous JS functions rather than hoisting parameters
// and creating a named sibling function. Only affects targets which produce actual JS.
"-Xir-generate-inline-anonymous-functions"
)
)
}
}
}
2 changes: 1 addition & 1 deletion gradle/moko.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# https://repo.maven.apache.org/maven2/dev/icerock/moko/resources/
resources = "0.24.0"
resources = "0.24.1"

[plugins]

Expand Down
2 changes: 1 addition & 1 deletion iosApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EXTERNAL SOURCES:
:path: "../shared"

SPEC CHECKSUMS:
shared: b0aff9d3bb868970fd514cb63f47dc4df82d3eb7
shared: 5867c983faafac88e38e53320e6c14bfbfd62efd
SwiftFormat: d30e6e1c9a85f4bce83394af184e2c1d03032605

PODFILE CHECKSUM: c865212f162b25efab1f4c3a7c4b85bdb722c41e
Expand Down
Loading