Skip to content

Commit

Permalink
api: update kotlin to 2.1 rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek-12 committed Nov 27, 2024
1 parent e356de3 commit 17acc31
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 30 deletions.
26 changes: 14 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishBasePlugin
import com.vanniktech.maven.publish.SonatypeHost
import nl.littlerobots.vcu.plugin.versionCatalogUpdate
import nl.littlerobots.vcu.plugin.versionSelector
Expand All @@ -13,7 +14,7 @@ import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension

plugins {
alias(libs.plugins.detekt)
alias(libs.plugins.gradleDoctor)
// alias(libs.plugins.gradleDoctor)
alias(libs.plugins.version.catalog.update)
alias(libs.plugins.atomicfu)
// alias(libs.plugins.dependencyAnalysis)
Expand All @@ -36,16 +37,16 @@ subprojects {
plugins.withType<ComposeCompilerGradleSubplugin>().configureEach {
the<ComposeCompilerGradlePluginExtension>().apply {
featureFlags.addAll(ComposeFeatureFlag.OptimizeNonSkippingGroups)
stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_definitions.txt")
stabilityConfigurationFiles.add(rootProject.layout.projectDirectory.file("stability_definitions.txt"))
if (properties["enableComposeCompilerReports"] == "true") {
val metricsDir = layout.buildDirectory.dir("compose_metrics")
metricsDestination = metricsDir
reportsDestination = metricsDir
}
}
}
afterEvaluate {
extensions.findByType<MavenPublishBaseExtension>()?.run {
plugins.withType<MavenPublishBasePlugin> {
the<MavenPublishBaseExtension>().apply {
val isReleaseBuild = properties["release"]?.toString().toBoolean()
configure(
KotlinMultiplatform(
Expand Down Expand Up @@ -91,14 +92,15 @@ subprojects {
}
}

doctor {
warnWhenJetifierEnabled = true
warnWhenNotUsingParallelGC = true
disallowMultipleDaemons = false
javaHome {
ensureJavaHomeMatches.set(false)
}
}
// TODO: Incompatible with gradle isolated projects
// doctor {
// warnWhenJetifierEnabled = true
// warnWhenNotUsingParallelGC = true
// disallowMultipleDaemons = false
// javaHome {
// ensureJavaHomeMatches.set(false)
// }
// }
//
// dependencyAnalysis {
// structure {
Expand Down
5 changes: 4 additions & 1 deletion buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ object Config {
"-Xbackend-threads=0", // parallel IR compilation
"-Xexpect-actual-classes",
"-Xwasm-use-new-exception-proposal",
"-Xconsistent-data-class-copy-visibility"
"-Xconsistent-data-class-copy-visibility",
"-Xsuppress-warning=NOTHING_TO_INLINE",
"-Xsuppress-warning=UNUSED_ANONYMOUS_PARAMETER",
"-Xwasm-debugger-custom-formatters"
)
val jvmCompilerArgs = buildList {
addAll(compilerArgs)
Expand Down
13 changes: 7 additions & 6 deletions buildSrc/src/main/kotlin/ConfigureMultiplatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ fun Project.configureMultiplatform(
explicitApi()
applyDefaultHierarchyTemplate(configure)
withSourcesJar(true)
compilerOptions {
extraWarnings.set(true)
}

if (linux) {
linuxX64()
Expand Down Expand Up @@ -64,12 +67,10 @@ fun Project.configureMultiplatform(
}
}

if (jvm) jvm().compilations.all {
compileTaskProvider.configure {
compilerOptions {
jvmTarget.set(Config.jvmTarget)
freeCompilerArgs.addAll(Config.jvmCompilerArgs)
}
if (jvm) jvm {
compilerOptions {
jvmTarget.set(Config.jvmTarget)
freeCompilerArgs.addAll(Config.jvmCompilerArgs)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import pro.respawn.flowmvi.api.StorePlugin
*
* @see DecoratorBuilder
*/
@ConsistentCopyVisibility
@OptIn(NotIntendedForInheritance::class)
public data class PluginDecorator<S : MVIState, I : MVIIntent, A : MVIAction> internal constructor(
/** The name of the decorator. Must be unique or `null` */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import kotlin.time.times
* @param delayInitially whether the delay should already be applied for the first retry. If not, the first retry will
* be performed immediately
*/
@ConsistentCopyVisibility
public data class RetryStrategy private constructor(
val retries: Int,
val delay: Duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ import kotlin.time.Duration
* Exception thrown when the operation in the store has timed out.
* Unlike regular `CancellationException`, is caught by the [pro.respawn.flowmvi.api.StorePlugin.onException] handler and the recover plugin.
*/
public class StoreTimeoutException(timeout: Duration) : RuntimeException(
message = "Store has timed out after $timeout."
)
public class StoreTimeoutException(
timeout: Duration,
override val cause: Throwable? = null
) : RuntimeException() {

override val message: String = "Store has timed out after $timeout."
}

/**
* Exception thrown when the state is not of desired type when using state methods that validate it, such as
* [withStateOrThrow]
*/
public class InvalidStateException(expected: String?, got: String?) : IllegalStateException(
message = "Expected state of type $expected but got $got"
)
public class InvalidStateException(
expected: String?,
got: String?,
override val cause: Throwable? = null
) : IllegalStateException() {

override val message: String = "Expected state of type $expected but got $got"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private abstract class ChannelIntentModule<I : MVIIntent>(
onUndeliveredIntent: ((intent: I) -> Unit)?,
) : IntentModule<I> {

protected val intents = Channel(capacity, overflow, onUndeliveredIntent)
val intents = Channel(capacity, overflow, onUndeliveredIntent)

override suspend fun emit(intent: I) = intents.send(intent)
override fun intent(intent: I) {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android.experimental.enableSourceSetPathsMap=true
android.experimental.cacheCompileLibResources=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.stability.nowarn=true
kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
org.gradle.unsafe.configuration-cache=true
kotlin.mpp.androidSourceSetLayoutVersion=2
android.disableResourceValidation=true
Expand All @@ -41,3 +40,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
org.gradle.configuration-cache.parallel=true
release=true
#kotlin.kmp.isolated-projects.support=enable
kotlin.incremental.wasm=true
#org.gradle.unsafe.isolated-projects=true
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ intellij-idea = "2024.1"
junit = "4.13.2"
kotest = "6.0.0.M1"
# @pin
kotlin = "2.0.21"
kotlin = "2.1.0-RC2"
kotlin-collections = "0.3.8"
kotlin-browser = "0.3"
kotlin-io = "0.6.0"
kotlinx-atomicfu = "0.26.0"
ktor = "3.0.1"
Expand Down Expand Up @@ -53,6 +54,7 @@ kotest-framework = { module = "io.kotest:kotest-framework-engine", version.ref =
kotest-junit = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" }
kotlin-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlinx-atomicfu" }
kotlin-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlin-browser" }
kotlin-collections = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlin-collections" }
kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
Expand Down
4 changes: 4 additions & 0 deletions savedstate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ kotlin {

sourceSets {
val nonBrowserMain by getting
val browserMain by getting
nativeMain.dependencies {
implementation(libs.kotlin.io)
}
Expand All @@ -40,6 +41,9 @@ kotlin {
nonBrowserMain.dependencies {
implementation(libs.kotlin.io)
}
wasmJsMain.dependencies {
implementation(libs.kotlin.browser)
}
}
}

Expand Down

0 comments on commit 17acc31

Please sign in to comment.