diff --git a/build.gradle.kts b/build.gradle.kts index f3f42ae4..4c0a6766 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 @@ -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) @@ -36,7 +37,7 @@ subprojects { plugins.withType().configureEach { the().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 @@ -44,8 +45,8 @@ subprojects { } } } - afterEvaluate { - extensions.findByType()?.run { + plugins.withType { + the().apply { val isReleaseBuild = properties["release"]?.toString().toBoolean() configure( KotlinMultiplatform( @@ -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 { diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 9dfb2371..c7246904 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -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) diff --git a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt index 748c137d..b0a94cc1 100644 --- a/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt +++ b/buildSrc/src/main/kotlin/ConfigureMultiplatform.kt @@ -28,6 +28,9 @@ fun Project.configureMultiplatform( explicitApi() applyDefaultHierarchyTemplate(configure) withSourcesJar(true) + compilerOptions { + extraWarnings.set(true) + } if (linux) { linuxX64() @@ -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) } } diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorator/PluginDecorator.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorator/PluginDecorator.kt index 95d57197..423e174f 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorator/PluginDecorator.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorator/PluginDecorator.kt @@ -18,7 +18,6 @@ import pro.respawn.flowmvi.api.StorePlugin * * @see DecoratorBuilder */ -@ConsistentCopyVisibility @OptIn(NotIntendedForInheritance::class) public data class PluginDecorator internal constructor( /** The name of the decorator. Must be unique or `null` */ diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorators/RetryDecorator.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorators/RetryDecorator.kt index 208df85e..8cbd0175 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorators/RetryDecorator.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/decorators/RetryDecorator.kt @@ -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, diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/exceptions/StoreExceptions.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/exceptions/StoreExceptions.kt index c82bfd34..fa516c09 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/exceptions/StoreExceptions.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/exceptions/StoreExceptions.kt @@ -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" +} diff --git a/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/IntentModule.kt b/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/IntentModule.kt index 242006ff..dce6a1d5 100644 --- a/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/IntentModule.kt +++ b/core/src/commonMain/kotlin/pro/respawn/flowmvi/modules/IntentModule.kt @@ -29,7 +29,7 @@ private abstract class ChannelIntentModule( onUndeliveredIntent: ((intent: I) -> Unit)?, ) : IntentModule { - 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) { diff --git a/gradle.properties b/gradle.properties index 6aba699e..c2f555b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 @@ -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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a08ec638..99a0197e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" @@ -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" } diff --git a/savedstate/build.gradle.kts b/savedstate/build.gradle.kts index dd0476a6..14e77d16 100644 --- a/savedstate/build.gradle.kts +++ b/savedstate/build.gradle.kts @@ -26,6 +26,7 @@ kotlin { sourceSets { val nonBrowserMain by getting + val browserMain by getting nativeMain.dependencies { implementation(libs.kotlin.io) } @@ -40,6 +41,9 @@ kotlin { nonBrowserMain.dependencies { implementation(libs.kotlin.io) } + wasmJsMain.dependencies { + implementation(libs.kotlin.browser) + } } }