Build a StateFlow stream using Jetpack Compose

Overview

Molecule

Build a StateFlow or Flow stream using Jetpack Compose1.

fun CoroutineScope.launchCounter(): StateFlow<Int> = launchMolecule {
  val count by remember { mutableStateOf(0) }

  LaunchedEffect(Unit) {
    while (true) {
      delay(1_000)
      count++
    }
  }

  count
}

Introduction

Jetpack Compose UI makes it easy to build declarative UI with logic.

val userFlow = db.userObservable()
val balanceFlow = db.balanceObservable()

@Composable
fun Profile() {
  val user by userFlow.subscribeAsState(null)
  val balance by balanceFlow.subscribeAsState(0L)

  if (user == null) {
    Text("Loading…")
  } else {
    Text("${user.name} - $balance")
  }
}

Unfortunately, we are mixing business logic with display logic which makes testing harder than if it were separated. The display layer is also interacting directly with the storage layer which creates undesirable coupling. Additionally, if we want to power a different display with the same logic (potentially on another platform) we cannot.

Extracting the business logic to a presenter-like object fixes these three things.

In Cash App our presenter objects traditionally expose a single stream of display models through Kotlin coroutine's Flow or RxJava Observable.

sealed interface ProfileModel {
  object Loading : ProfileModel
  data class Data(
    val name: String,
    val balance: Long,
  ) : ProfileModel
}

class ProfilePresenter(
  private val db: Db,
) {
  fun transform(events: Flow<Nothing>): Flow<ProfileModel> {
    return combine(
      db.users().onStart { emit(null) },
      db.balances().onStart { emit(0L) },
    ) { user, balance ->
      if (user == null) {
        Loading
      } else {
        Data(user.name, balance)
      }
    }
  }
}

This code is okay, but the ceremony of combining reactive streams will scale non-linearly. This means the more sources of data which are used and the more complex the logic the harder to understand the reactive code becomes.

Despite emitting the Loading state synchronously, Compose UI requires an initial value be specified for all Flow or Observable usage. This is a layering violation as the view layer is not in the position to dictate a reasonable default since the presenter layer controls the model object.

Molecule lets us fix both of these problems. Our presenter can return a StateFlow<ProfileModel> whose initial state can be read synchronously at the view layer by Compose UI. And by using Compose we also can build our model objects using imperative code built on features of the Kotlin language rather than reactive code consisting of RxJava library APIs.

@Composable
fun ProfilePresenter(
  userFlow: Flow<User>,
  balanceFlow: Flow<Long>,
): ProfileModel {
  val user by userFlow.collectAsState(null)
  val balance by balanceFlow.collectAsState(0L)

  return if (user == null) {
    Loading
  } else {
    Data(user.name, balance)
  }
}

This model-producing composable function can be run with launchMolecule.

val userFlow = db.users()
val balanceFlow = db.balances()
val models: StateFlow<ProfileModel> = scope.launchMolecule {
  ProfilePresenter(userFlow, balanceFlow)
}

At the view-layer, consuming the StateFlow of our model objects becomes trivial.

@Composable
fun Profile(models: StateFlow<ProfileModel>) {
  val model by models.collectAsState()
  when (model) {
    is Loading -> Text("Loading…")
    is Data -> Text("${model.name} - ${model.balance}")
  }
}

For more information see the launchMolecule documentation.

Flow

In addition to StateFlows, Molecule can create regular Flows. The flow-returning function does not require a CoroutineScope as it will be inherited from the collector.

Here is the presenter example updated to use a regular Flow:

val userFlow = db.users()
val balanceFlow = db.balances()
val models: Flow<ProfileModel> = moleculeFlow {
  ProfilePresenter(userFlow, balanceFlow)
}

And the counter example:

fun counter(): Flow<Int> = moleculeFlow {
  val count by remember { mutableStateOf(0) }

  LaunchedEffect(Unit) {
    while (true) {
      delay(1_000)
      count++
    }
  }

  count
}

For more information see the moleculeFlow documentation.

Usage

Add the buildscript dependency and apply the plugin to every module which wants to call launchMolecule or define @Composable functions for use with Molecule.

buildscript {
  repository {
    mavenCental()
  }
  dependencies {
    classpath 'app.cash.molecule:molecule-gradle-plugin:0.1.0'
  }
}

apply plugin: 'app.cash.molecule'
Snapshots of the development version are available in Sonatype's snapshots repository.

buildscript {
  repository {
    mavenCental()
    maven {
      url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
  }
  dependencies {
    classpath 'app.cash.molecule:molecule-gradle-plugin:0.2.0-SNAPSHOT'
  }
}

apply plugin: 'app.cash.molecule'

Frame Clock

Molecule requires a MonotonicFrameClock key in your CoroutineScope. This applies to the launchMolecule extension's receiver and the scope in which you collect the moleculeFlow function-returned flow. The clock is used to determine when recomposition occurs and a new value is produced.

On Android, AndroidUiDispatcher.Main can be used for running your composables on the main thread with recomposition synchronized to the frame rate. For any other rate or to recompose on a background thread, create a BroadcastFrameClock and a timer to invoke its sendFrame function at your desired rate.

Testing

While the created StateFlows and Flows can be tested normally, the use of the frame clock to control recomposition makes it harder than it should be. The 'molecule-testing' dependency provides a testMolecule function which simplifies your test code by managing the threading, coroutine scope, and frame clock for you.

dependencies {
  testImplementation("app.cash.molecule:molecule-testing")
  // or androidTestImplementation…
}

Validating your produced values should feel familiar to those who have used Turbine.

@Test fun counting() {
  testMolecule({ Counter(1, 3)} ) {
    assertEquals(1, awaitItem())
    assertEquals(2, awaitItem())
    assertEquals(3, awaitItem())
  }
}

For more information see the documentation.

License

Copyright 2021 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Footnotes

  1. …and NOT Jetpack Compose UI!

Comments
  • Multiplatform support

    Multiplatform support

    Shipped:

    • [x] Android (all versions)
    • [x] JS (0.3.0 and newer)
    • [x] JVM (0.3.0 and newer)
    • [x] iOS (0.5.0-beta01 and newer)
    • [x] MacOS (0.5.0-beta01 and newer)
    • [x] tvOS (0.5.0-beta01 and newer)
    • [x] watchOS (0.5.0-beta01 and newer)
    • [x] Linux (0.5.0-beta01 and newer)
    • [x] Windows (0.5.0-beta01 and newer)
    blocked 
    opened by JakeWharton 28
  • Add RecompositionClock param

    Add RecompositionClock param

    This PR is an upstream of backpressureMoleculeFlow, a tool we have been using internally at Cash App for Rx interop, but mostly for testing. We avoid molecule's testing tool suite entirely and use backpressureMoleculeFlow with Turbine (along with a distinctUntilChanged() call).

    I can't think of any good reason not to have a call to distinctUntilChanged() when consuming a Molecule, but I've left it out here anyway.

    opened by jingibus 8
  • "Trying to call 'getOrThrow' on a failed channel result: Failed" when testing moleculeFlow with Turbine

    Presenter:

    @Composable fun PortfolioPresenter(): PortfolioModel {
      var portfolioModel by remember { mutableStateOf<PortfolioModel>(PortfolioModel.Loading) }
      LaunchedEffect("get-portfolio") {
        portfolioModel = PortfolioModel.Error("Boom!")
      }
      return portfolioModel
    }
    

    Test:

    class PortfolioPresenterTest {
      @Test fun `loads portfolio`() = runBlocking {
        makePresenter().test {
          assertThat(awaitItem()).isEqualTo(PortfolioModel.Loading)
          assertThat(awaitItem()).isEqualTo(PortfolioModel.Error("Boom!"))
        }
      }
    
      private fun makePresenter(): Flow<PortfolioModel> {
        return moleculeFlow(clock = Immediate) {
          PortfolioPresenter()
        }
      }
    }
    

    The test fails with app.cash.turbine.AssertionError: Expected item but found Error(IllegalStateException), full stack trace below:

    Stacktrace
    
    Expected item but found Error(IllegalStateException)
    app.cash.turbine.AssertionError: Expected item but found Error(IllegalStateException)
    	at app//app.cash.turbine.ChannelBasedFlowTurbine.unexpectedEvent(FlowTurbine.kt:353)
    	at app//app.cash.turbine.ChannelBasedFlowTurbine.awaitItem(FlowTurbine.kt:301)
    	at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invokeSuspend(PortfolioPresenterTest.kt:14)
    	at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invoke(PortfolioPresenterTest.kt)
    	at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invoke(PortfolioPresenterTest.kt)
    	at app//app.cash.turbine.FlowTurbineKt$test$4.invokeSuspend(FlowTurbine.kt:103)
    	at app//app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
    	at app//app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
    	at app//kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
    	at app//kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
    	at app//app.cash.turbine.FlowTurbineKt.test(FlowTurbine.kt:101)
    	at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1.invokeSuspend(PortfolioPresenterTest.kt:13)
    	at app//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at app//kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    	at app//kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
    	at app//kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    	at app//kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    	at app//kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    	at app//kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    	at app//kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    	at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest.loads portfolio(PortfolioPresenterTest.kt:12)
    	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at [email protected]/java.lang.reflect.Method.invoke(Method.java:566)
    	at app//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at app//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at app//org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at app//org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at app//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at app//org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at app//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at app//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at app//org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at app//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at app//org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
    	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
    	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at [email protected]/java.lang.reflect.Method.invoke(Method.java:566)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
    	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
    	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
    	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
    	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
    	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
    Caused by: java.lang.IllegalStateException: Trying to call 'getOrThrow' on a failed channel result: Failed
    	at kotlinx.coroutines.channels.ChannelResult.getOrThrow-impl(Channel.kt:443)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:68)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:64)
    	at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:164)
    	at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:163)
    	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
    	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
    	at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2404)
    	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2585)
    	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
    	at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:247)
    	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
    	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
    	at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2547)
    	at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:620)
    	at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:786)
    	at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:105)
    	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:456)
    	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:425)
    	at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
    	at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
    	at app.cash.molecule.GatedFrameClock.sendFrame(GatedFrameClock.kt:50)
    	at app.cash.molecule.GatedFrameClock.access$sendFrame(GatedFrameClock.kt:31)
    	at app.cash.molecule.GatedFrameClock$1.invokeSuspend(GatedFrameClock.kt:36)
    	(Coroutine boundary)
    	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:425)
    	at androidx.compose.runtime.Recomposer$recompositionRunner$2$2.invokeSuspend(Recomposer.kt:682)
    	at androidx.compose.runtime.Recomposer$recompositionRunner$2.invokeSuspend(Recomposer.kt:681)
    	at app.cash.molecule.MoleculeKt$launchMolecule$2$1.invokeSuspend(molecule.kt:145)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invokeSuspend(molecule.kt:59)
    	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    	at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invokeSuspend(FlowTurbine.kt:146)
    Caused by: java.lang.IllegalStateException: Trying to call 'getOrThrow' on a failed channel result: Failed
    	at kotlinx.coroutines.channels.ChannelResult.getOrThrow-impl(Channel.kt:443)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:68)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:64)
    	at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:164)
    	at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:163)
    	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
    	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
    	at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2404)
    	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2585)
    	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
    	at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:247)
    	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
    	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
    	at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2547)
    	at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:620)
    	at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:786)
    	at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:105)
    	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:456)
    	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:425)
    	at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
    	at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
    	at app.cash.molecule.GatedFrameClock.sendFrame(GatedFrameClock.kt:50)
    	at app.cash.molecule.GatedFrameClock.access$sendFrame(GatedFrameClock.kt:31)
    	at app.cash.molecule.GatedFrameClock$1.invokeSuspend(GatedFrameClock.kt:36)
    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    	at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
    	at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:245)
    	at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
    	at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
    	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
    	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
    	at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
    	at androidx.compose.runtime.Recomposer.invalidate$runtime_release(Recomposer.kt:895)
    	at androidx.compose.runtime.CompositionImpl.invalidate(Composition.kt:700)
    	at androidx.compose.runtime.RecomposeScopeImpl.invalidateForResult(RecomposeScopeImpl.kt:148)
    	at androidx.compose.runtime.CompositionImpl.addPendingInvalidationsLocked$invalidate(Composition.kt:552)
    	at androidx.compose.runtime.CompositionImpl.addPendingInvalidationsLocked(Composition.kt:567)
    	at androidx.compose.runtime.CompositionImpl.drainPendingModificationsLocked(Composition.kt:459)
    	at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:658)
    	at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:763)
    	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:433)
    	at app.cash.molecule.MoleculeKt.launchMolecule(molecule.kt:163)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invokeSuspend(molecule.kt:64)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invoke(molecule.kt)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invoke(molecule.kt)
    	at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
    	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
    	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
    	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
    	at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invokeSuspend(molecule.kt:63)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invoke(molecule.kt)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invoke(molecule.kt)
    	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
    	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invokeSuspend(molecule.kt:59)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invoke(molecule.kt)
    	at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invoke(molecule.kt)
    	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    	at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invokeSuspend(FlowTurbine.kt:146)
    	at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invoke(FlowTurbine.kt)
    	at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invoke(FlowTurbine.kt)
    	at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
    	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
    	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
    	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
    	at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
    	at app.cash.turbine.FlowTurbineKt.collectTurbineIn(FlowTurbine.kt:143)
    	at app.cash.turbine.FlowTurbineKt.access$collectTurbineIn(FlowTurbine.kt:1)
    	at app.cash.turbine.FlowTurbineKt$test$4.invokeSuspend(FlowTurbine.kt:102)
    	at app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
    	at app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
    	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
    	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
    	at app.cash.turbine.FlowTurbineKt.test(FlowTurbine.kt:101)
    	at dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1.invokeSuspend(PortfolioPresenterTest.kt:13)
    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
    	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    	at dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest.loads portfolio(PortfolioPresenterTest.kt:12)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
    	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
    	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
    	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    	at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
    	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
    	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
    	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
    	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
    	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
    

    Repro project: https://github.com/Egorand/molecule-get-or-throw-bug

    To reproduce the issue, run ./gradlew app:testDebugUnitTest.

    opened by Egorand 6
  • Recomposition happens twice!

    Recomposition happens twice!

    I just pushed source code of a sample here. Everything looks good, except that if you run the code, and click the buttons, you'll see in the Logcat that recomposition is happening twice, once because we launched an action, which is expected, but the other one appeared to happen because of changing of the return value of the nested compose, which is unexpected! I made a workaround for the "previous page" button by launching two actions in a row!

        sealed interface PopStack : MainAction {
            object Flip : PopStack
            object Flop : PopStack
        }
    

    To clarify the problem, I created this commit, so just check out to the-infinit-loop-problem branch. In this branch, after clicking the "previous page" button, it'll call the MainPresenter in some kind of a loop until the stack becomes empty! How can I avoid that infinit loop? Pull requests are welcome. By the way, thanks guys for this awesome library.

    opened by hadilq 5
  • Document configuration for AGP to unit test Molecule

    Document configuration for AGP to unit test Molecule

    I'm trying out Molecule with AAC ViewModel. Here is how the VM code is written exposing stateFlow stream using launchMolecule()

    Molecule version used : 0.5.0-SNAPSHOT

    @HiltViewModel
    class PhotosListViewModel @Inject constructor(
        private val unsplashRepository: UnsplashRepository,
        @MoleculeScope private val scope: CoroutineScope,
        @CompositionClock private val clock: RecompositionClock,
    ) : ViewModel() {
    
        private val events = Channel<Event>()
        val stateFlow = scope.launchMolecule(clock = clock) {
            present(events.receiveAsFlow())
        }
    
        init {
            processEvent(InitialPageEvent)
        }
    
        @Composable
        fun present(events: Flow<Event>): PhotosListUIState {
            var isLoading by remember { mutableStateOf(false) }
            var error by remember { mutableStateOf<String?>(null) }
            val images = remember { mutableStateListOf<UnsplashImage>() }
    
            LaunchedEffect(Unit) {
                events.collect { event ->
                    when (event) {
                        InitialPageEvent -> {
                            isLoading = true
                            error = null
                            when (val result =
                                unsplashRepository.getPhotos(page = 1, perPage = ITEM_PER_PAGE)) {
                                is Error -> {
                                    isLoading = false
                                    error = result.message
                                }
                                is Success -> {
                                    isLoading = false
                                    images.addAll(result.data.images)
                                }
                            }
    
                        }
                    }
                }
            }
            return PhotosListUIState(
                isLoading = isLoading,
                error = error,
                images = images,
            )
        }
    
        fun processEvent(event: Event) {
            scope.launch {
                events.send(event)
            }
        }
    }
    
    // UI State
    data class PhotosListUIState(
        val isLoading: Boolean = false,
        val error: String? = null,
        val images: List<UnsplashImage> = emptyList(),
    )
    
    // Events
    sealed interface Event
    object InitialPageEvent : Event
    

    App works fine on Android devices without any issue when VM is provided with correct coroutineScope and frameClock. However, when I write Unit test for VM it requires android.os.Trace to be mocked. Added both unit test and it's error log below.

    VM's Unit Test

    import app.cash.molecule.RecompositionClock
    import app.cash.turbine.testIn
    import dev.punitd.unplashapp.data.fake.FakeUnsplashRepository
    import dev.punitd.unplashapp.model.images
    import dev.punitd.unplashapp.model.pageLinks
    import dev.punitd.unplashapp.util.CoroutineRule
    import kotlinx.coroutines.ExperimentalCoroutinesApi
    import kotlinx.coroutines.test.runTest
    import org.junit.Assert.assertEquals
    import org.junit.Rule
    import org.junit.Test
    
    
    @OptIn(ExperimentalCoroutinesApi::class)
    class PhotosListViewModelTest {
    
        @get:Rule
        val coroutineRule = CoroutineRule()
    
        @Test
        fun successStateIfApiSucceeds() = runTest {
            val viewModel = PhotosListViewModel(
                unsplashRepository = FakeUnsplashRepository(coroutineRule.testDispatcher),
                scope = this, // TestScope
                clock = RecompositionClock.Immediate,
            )
    
            // InitialPageEvent is send inside VM's init{} block by default
            // That's why we're not sending any events here.
    
            val turbine = viewModel.stateFlow.testIn(this)
            assertEquals(PhotosListUIState(isLoading = false), turbine.awaitItem())
            assertEquals(PhotosListUIState(isLoading = true), turbine.awaitItem())
            assertEquals(
                PhotosListUIState(
                    isLoading = false,
                    error = null,
                    images = images,
                    pageLinks = pageLinks
                ),
                turbine.awaitItem()
            )
            turbine.cancel()
        }
    }
    

    Test Error log

    Method beginSection in android.os.Trace not mocked. See http://g.co/androidstudio/not-mocked for details.
    java.lang.RuntimeException: Method beginSection in android.os.Trace not mocked. See http://g.co/androidstudio/not-mocked for details.
    	at android.os.Trace.beginSection(Trace.java)
    	at androidx.compose.runtime.Trace.beginSection(ActualAndroid.android.kt:30)
    	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:4357)
    	at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3119)
    	at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:584)
    	at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:811)
    	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
    	at app.cash.molecule.MoleculeKt.launchMolecule(molecule.kt:163)
    	at app.cash.molecule.MoleculeKt.launchMolecule(molecule.kt:108)
    	at dev.punitd.unplashapp.screen.photos.PhotosListViewModel.<init>(PhotosListViewModel.kt:32)
    

    I'm sure i'm doing something stupid here because unit tests written in sample app of this repo works just fine without any such error.

    Questions:

    • Is there something I need to mock which i'm missing here?
    • Are Coroutinescope and FrameClock passed to VM in test incorrect?

    Repo to reproduce it : https://github.com/punitda/Tinysplash

    Thanks!

    documentation enhancement PR welcome 
    opened by punitda 5
  • Unexpected behavior with counter example

    Unexpected behavior with counter example

    I was trying out the counter example and I got unexpected results. I've done simple stuff with compose UI, so I could very well have made a simple mistake.

    Here is the code I have:

    class CounterActivity : ComponentActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(
                ComposeView(this).apply {
                    setContent {
                        val scope = CoroutineScope(AndroidUiDispatcher.Main)
                        val count = scope.launchCounter().collectAsState()
                        Text(text = "${count.value}")
                    }
                }
            )
        }
    }
    
    private fun CoroutineScope.launchCounter(): StateFlow<Int> = this.launchMolecule(RecompositionClock.ContextClock) {
        var count by remember {
            Log.d("test", "calculating initial count")
            mutableStateOf(0)
        }
    
        LaunchedEffect(Unit) {
            while(true) {
                delay(5000L)
                Log.d("test", "updating count")
                count++
            }
        }
        Log.d("test", "recomposing with count: $count")
        count
    }
    

    And my logcat looks like this:

    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: updating count
    D/test: recomposing with count: 1
    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: updating count
    D/test: recomposing with count: 2
    D/test: updating count
    D/test: updating count
    D/test: recomposing with count: 1
    D/test: recomposing with count: 1
    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: updating count
    D/test: recomposing with count: 3
    D/test: updating count
    D/test: recomposing with count: 2
    D/test: updating count
    D/test: recomposing with count: 2
    D/test: updating count
    D/test: recomposing with count: 1
    D/test: updating count
    D/test: recomposing with count: 1
    D/test: calculating initial count
    D/test: recomposing with count: 0
    D/test: calculating initial count
    D/test: recomposing with count: 0
    

    I was surprised that the UI wasn't showing the incrementing count, but I'm more surprised that the logs do show a count incrementing AND getting reset.

    opened by lttlang 4
  • Add expectNoEvents to MoleculeTurbine

    Add expectNoEvents to MoleculeTurbine

    Please close if this is silly or useless, but I don't see another way of verifying this behavior other than expecting a timeout, which extends the runtime of a test by a full second.

    opened by abyrnes 4
  • Fix bug in frame triggering for BroadcastFrameClock contexts

    Fix bug in frame triggering for BroadcastFrameClock contexts

    Recomposer.runRecomposeAndApplyChanges always waits for a frame tick before recomposing a child composition. As a result, the call to Snapshot.sendApplyNotifications() isn't achieving the desired outcome in the existing code: under test, writes to snapshot state will fail to produce an additional output. snapshotUpdatesTickEnclosingClock illustrates the issue.

    To get the test to pass, though, the call to composition.setContent has to be moved to the beginning of launchMolecule. This is probably due to a race within Recomposer.

    Also fixes #45.

    opened by jingibus 3
  • Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.22.0

    Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.22.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | com.vanniktech:gradle-maven-publish-plugin | 0.18.0 -> 0.22.0 | age | adoption | passing | confidence |


    Release Notes

    vanniktech/gradle-maven-publish-plugin

    v0.22.0

    Compare Source

    • NEW: When publishing to maven central by setting SONATYPE_HOST or calling publishToMavenCentral(...) the plugin will now explicitly create a staging repository on Sonatype. This avoids issues where a single build would create multiple repositories
    • The above change means that the plugin supports parallel builds and it is not neccessary anymore to use --no-parallel and --no-daemon together with publish
    • NEW: When publishing with the publish or publishAllPublicationsToMavenCentralRepository tasks the plugin will automatically close the staging repository at the end of the build if it was successful.
    • NEW: Option to also automatically release the staging repository after closing was susccessful
    SONATYPE_HOST=DEFAULT # or S01
    SONATYPE_AUTOMATIC_RELEASE=true
    

    or

    mavenPublishing {
      publishToMavenCentral("DEFAULT", true)
      // or publishToMavenCentral("S01", true)
    }
    
    • in case the option above is enabled, the closeAndReleaseRepository task is not needed anymore
    • when closing the repository fails the plugin will fail the build immediately instead of timing out
    • when closing the repository fails the plugin will try to print the error messages from Nexus
    • increased timeouts for calls to the Sonatype Nexus APIs
    • fixed incompatibility with the com.gradle.plugin-publish plugin
    • added wokaround for Kotlin multiplatform builds reporting disabled build optimizations (see KT-46466)

    v0.21.0

    Compare Source

    Minimum supported Gradle version is now 7.2.0

    Minimum supported Android Gradle Plugin versions are now 7.1.2, 7.2.0-beta02 and 7.3.0-alpha01

    Behavior changes

    The com.vanniktech.maven.publish stops adding Maven Central (Sonatype OSS) as a publishing target and will not enable GPG signing by default. To continue publishing to maven central and signing artifacts either add the following to your gradle.properties:

    SONATYPE_HOST=DEFAULT
    

    v0.20.0

    Compare Source

    Upcoming behavior change

    In the next release after this the com.vanniktech.maven.publish will stop adding Maven Central (Sonatype OSS) as a publishing target and will not enable GPG signing by default. If you are currently relying on this behavior the plugin will print a warning during configuration phase. To continue publishing to maven central and signing artifacts either add this to your build files:

    mavenPublishing {
      publishToMavenCentral() // use publishToMavenCentral("S01") for publishing through s01.oss.sonatype.org
      signAllPublications()
    }
    

    or the following to your gradle.properties:

    SONATYPE_HOST=DEFAULT
    

    v0.19.0

    Compare Source

    • Behavior Change: When using version 7.1.0 or newer of the Android Gradle Plugin we will now publish all variants of a library unless androidVariantToPublish was set in the DSL. This means that for example both debug and release or all flavors.
    • Deprecated androidVariantToPublish. In the future the main plugin will always publish all variants of an Android library. If you need to publish only one variant or a subset take a look at the base plugin APIs.
    • Base plugin: Added AndroidSingleVariantLibrary and AndroidMultiVariantLibrary options that use the new AGP 7.1 APIs under the hood.
    • Base plugin: Deprecated AndroidLibrary option in favor of the above
    • The integration with Sonatype Nexus has been extracted into it's own artifact and is available as com.vanniktech:nexus:<version>

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Update dependency org.jmailen.gradle:kotlinter-gradle to v3.13.0

    Update dependency org.jmailen.gradle:kotlinter-gradle to v3.13.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | org.jmailen.gradle:kotlinter-gradle | 3.11.1 -> 3.13.0 | age | adoption | passing | confidence |


    Release Notes

    jeremymailen/kotlinter-gradle

    v3.13.0

    Compare Source

    What's Changed

    Full Changelog: https://github.com/jeremymailen/kotlinter-gradle/compare/3.12.0...3.13.0

    v3.12.0

    Compare Source

    • Upgrade to ktlint 0.47.1
    • Includes changes in 0.47.0
    • FIxes #​262 where editorconfig was sometimes cached

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Update dependency app.cash.turbine:turbine to v0.12.1

    Update dependency app.cash.turbine:turbine to v0.12.1

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | app.cash.turbine:turbine | 0.9.0 -> 0.12.1 | age | adoption | passing | confidence |


    Release Notes

    cashapp/turbine

    v0.12.1

    Compare Source

    Changed
    • Build with Kotlin 1.7.20
    Fixed
    • takeItem() no longer throws an exception when returning a null value.
    • await-prefixed methods no longer interfere with virtual time control from a TestScheduler (such as inside runTest).

    v0.12.0

    Compare Source

    Added
    • Support specifying a human-readable name for differentiating the failures of multiple Turbines
    Fixed
    • Properly catch all Throwable subtypes from failures in flows and channels as events.

    v0.11.0

    Compare Source

    Added
    • Restore timeout support. By default a 1-second timeout will be enforced when awaiting an event. This can be customized by supplying a timeout argument or by using the withTurbineTimeout wrapper function. Timeouts will always use wall clock time even when using a virtual time dispatcher.
    Changed
    • When runTest (or any TestCoroutineScheduler) is in use, switch to the UnconfinedTestScheduler internally to ensure virtual time remains working.

    v0.10.0

    Compare Source

    Changed
    • Remove ReceiveTurbine.ignoreRemainingEvents from public API.
    Fixed
    • Restore usage of Unconfined dispatcher preventing value conflation (as much as possible) so that intermediate values can always be observed.

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.23.1

    Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.23.1

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | com.vanniktech:gradle-maven-publish-plugin | 0.18.0 -> 0.23.1 | age | adoption | passing | confidence |


    Release Notes

    vanniktech/gradle-maven-publish-plugin

    v0.23.1

    Compare Source

    • Also support publishing sources for the java-test-fixtures plugin in Kotlin/JVM projects.
    • Suppress Gradle warnings when publishing a project that uses java-test-fixtures.

    v0.23.0

    Compare Source

    Updated docs can be found on the new website.

    • NEW: It is now possible to set group id, artifact id directly through the DSL
      mavenPublishing {
        coordinates("com.example", "library", "1.0.3")
      }
      
    • project.group and project.version will still be used as default values for group and version if the GROUP/VERSION_NAME Gradle properties do not exist and coordinates was not called, however there are 2 behavior changes:
      • The GROUP and VERSION_NAME Gradle properties take precedence over project.group and project.version instead of being overwritten by them. If you need to define the properties but replace them for some projects, please use the new coordinates method instead.
      • The GROUP and VERSION_NAME Gradle properties will not be explicitly set as project.group and project.version anymore.
    • NEW: Added dropRepository task that will drop a Sonatype staging repository. It is possible to specify which repository to drop by adding a --repository parameter with the id of the staging repository that was printed during publish. If no repository is specified and there is only one staging repository, that one will be dropped.
    • Added workaround to also publish sources for the java-test-fixtures plugin
    • Fixed publishing Kotlin/JS projects with the base plugin.
    • Fixed that a POM configured through the DSL is incomplete when publishing Gradle plugins.
    • The minimum supported Gradle version has been increased to 7.3.

    v0.22.0

    Compare Source

    • NEW: When publishing to maven central by setting SONATYPE_HOST or calling publishToMavenCentral(...) the plugin will now explicitly create a staging repository on Sonatype. This avoids issues where a single build would create multiple repositories
    • The above change means that the plugin supports parallel builds and it is not neccessary anymore to use --no-parallel and --no-daemon together with publish
    • NEW: When publishing with the publish or publishAllPublicationsToMavenCentralRepository tasks the plugin will automatically close the staging repository at the end of the build if it was successful.
    • NEW: Option to also automatically release the staging repository after closing was susccessful
    SONATYPE_HOST=DEFAULT # or S01
    SONATYPE_AUTOMATIC_RELEASE=true
    

    or

    mavenPublishing {
      publishToMavenCentral("DEFAULT", true)
      // or publishToMavenCentral("S01", true)
    }
    
    • in case the option above is enabled, the closeAndReleaseRepository task is not needed anymore
    • when closing the repository fails the plugin will fail the build immediately instead of timing out
    • when closing the repository fails the plugin will try to print the error messages from Nexus
    • increased timeouts for calls to the Sonatype Nexus APIs
    • fixed incompatibility with the com.gradle.plugin-publish plugin
    • added wokaround for Kotlin multiplatform builds reporting disabled build optimizations (see KT-46466)

    v0.21.0

    Compare Source

    Minimum supported Gradle version is now 7.2.0

    Minimum supported Android Gradle Plugin versions are now 7.1.2, 7.2.0-beta02 and 7.3.0-alpha01

    Behavior changes

    The com.vanniktech.maven.publish stops adding Maven Central (Sonatype OSS) as a publishing target and will not enable GPG signing by default. To continue publishing to maven central and signing artifacts either add the following to your gradle.properties:

    SONATYPE_HOST=DEFAULT
    

    v0.20.0

    Compare Source

    Upcoming behavior change

    In the next release after this the com.vanniktech.maven.publish will stop adding Maven Central (Sonatype OSS) as a publishing target and will not enable GPG signing by default. If you are currently relying on this behavior the plugin will print a warning during configuration phase. To continue publishing to maven central and signing artifacts either add this to your build files:

    mavenPublishing {
      publishToMavenCentral() // use publishToMavenCentral("S01") for publishing through s01.oss.sonatype.org
      signAllPublications()
    }
    

    or the following to your gradle.properties:

    SONATYPE_HOST=DEFAULT
    

    v0.19.0

    Compare Source

    • Behavior Change: When using version 7.1.0 or newer of the Android Gradle Plugin we will now publish all variants of a library unless androidVariantToPublish was set in the DSL. This means that for example both debug and release or all flavors.
    • Deprecated androidVariantToPublish. In the future the main plugin will always publish all variants of an Android library. If you need to publish only one variant or a subset take a look at the base plugin APIs.
    • Base plugin: Added AndroidSingleVariantLibrary and AndroidMultiVariantLibrary options that use the new AGP 7.1 APIs under the hood.
    • Base plugin: Deprecated AndroidLibrary option in favor of the above
    • The integration with Sonatype Nexus has been extracted into it's own artifact and is available as com.vanniktech:nexus:<version>

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update kotlin monorepo to v1.8.0

    Update kotlin monorepo to v1.8.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | org.jetbrains.kotlin:kotlin-test (source) | 1.7.20 -> 1.8.0 | age | adoption | passing | confidence | | org.jetbrains.kotlin:kotlin-gradle-plugin (source) | 1.7.20 -> 1.8.0 | age | adoption | passing | confidence |


    Release Notes

    JetBrains/kotlin

    v1.8.0

    Analysis API
    • KT-50255 Analysis API: Implement standalone mode for the Analysis API
    Analysis API. FIR
    • KT-54292 Symbol Light classes: implement PsiVariable.computeConstantValue for light field
    • KT-54293 Analysis API: fix constructor symbol creation when its accessed via type alias
    Android
    • KT-53342 TCS: New AndroidSourceSet layout for multiplatform
    • KT-53013 Increase AGP compile version in KGP to 4.1.3
    • KT-54013 Report error when using deprecated Kotlin Android Extensions compiler plugin
    • KT-53709 MPP, Android SSL2: Conflicting warnings for androidTest/kotlin source set folder
    Backend. Native. Debug
    • KT-53561 Invalid LLVM module: "inlinable function call in a function with debug info must have a !dbg location"
    Compiler
    New Features
    • KT-52817 Add @JvmSerializableLambda annotation to keep old behavior of non-invokedynamic lambdas
    • KT-54460 Implementation of non-local break and continue
    • KT-53916 Support Xcode 14 and new Objective-C frameworks in Kotlin/Native compiler
    • KT-32208 Generate method annotations into bytecode for suspend lambdas (on invokeSuspend)
    • KT-53438 Introduce a way to get SourceDebugExtension attribute value via JVMTI for profiler and coverage
    Performance Improvements
    • KT-53347 Get rid of excess allocations in parser
    • KT-53689 JVM: Optimize equality on class literals
    • KT-53119 Improve String Concatenation Lowering
    Fixes
    • KT-53465 Unnecessary checkcast to array of reified type is not optimized since Kotlin 1.6.20
    • KT-49658 NI: False negative TYPE_MISMATCH on nullable type with when
    • KT-48162 NON_VARARG_SPREAD isn't reported on *toTypedArray() call
    • KT-43493 NI: False negative: no compilation error "Operator '==' cannot be applied to 'Long' and 'Int'" is reported in builder inference lambdas
    • KT-54393 Change in behavior from 1.7.10 to 1.7.20 for java field override.
    • KT-55357 IllegalStateException when reading a class that delegates to a Java class with a definitely-not-null type with a flexible upper bound
    • KT-55068 Kotlin Gradle DSL: No mapping for symbol: VALUE_PARAMETER SCRIPT_IMPLICIT_RECEIVER on JVM IR backend
    • KT-51284 SAM conversion doesn't work if method has context receivers
    • KT-48532 Remove old JVM backend
    • KT-55065 Kotlin Gradle DSL: Reflection cannot find class data for lambda, produced by JVM IR backend
    • KT-53270 K1: implement synthetic Enum.entries property
    • KT-52823 Cannot access class Thread.State after upgrading to 1.7 from 1.6.1 using -Xjdk-release=1.8
    • KT-55108 IR interpreter: Error occurred while optimizing an expression: VARARG
    • KT-53547 Missing fun IrBuilderWithScope.irFunctionReference
    • KT-54884 "StackOverflowError: null" caused by Enum constant name in constructor of the same Enum constant
    • KT-47475 "IncompatibleClassChangeError: disagree on InnerClasses attribute": cross-module inlined WhenMappings has mismatched InnerClasses
    • KT-55013 State checker use-after-free with XCode 14.1
    • KT-54802 "VerifyError: Bad type on operand stack" for inline functions on arrays
    • KT-54707 "VerifyError: Bad type on operand stack" in inline call chain on a nullable array value
    • KT-48678 Coroutine debugger: disable "was optimised out" compiler feature
    • KT-54745 Restore KtToken constructors without tokenId parameter to preserve back compatibility
    • KT-54650 Binary incompatible ABI change in Kotlin 1.7.20
    • KT-52786 Frontend / K2: IndexOutOfBoundsException when opting in to K2
    • KT-54004 Builder type inference does not work correctly with variable assignment and breaks run-time
    • KT-54581 JVM: "VerifyError: Bad type on operand stack" with generic inline function and when inside try-catch block
    • KT-53794 IAE "Unknown visibility: protected/protected and package/" on callable reference to protected member of Java superclass
    • KT-54600 NPE on passing nullable Kotlin lambda as Java's generic SAM interface with super type bound
    • KT-54463 Delegating to a field with a platform type causes java.lang.NoSuchFieldError: value$delegate
    • KT-54509 Ir Interpreter: unable to evaluate string concatenation with "this" as argument
    • KT-54615 JVM: Internal error in file lowering: java.lang.AssertionError: Error occurred while optimizing an expression
    • KT-53146 JVM IR: unnecessary checkcast of null leads to NoClassDefFoundError if the type isn't available at runtime
    • KT-53712 Add mode to prevent generating JVM 1.8+ annotation targets (TYPE_USE, TYPE_PARAMETER)
    • KT-54366 K2: no JVM BE specific diagnostics (in particular CONFLICTING_JVM_DECLARATIONS) in 1.8
    • KT-35187 NullPointerException on compiling suspend inline fun with typealias to suspend function type
    • KT-54275 K2: "IllegalArgumentException: KtParameter is not a subtype of class KtAnnotationEntry for factory REPEATED_ANNOTATION"
    • KT-53656 "IllegalStateException: typeParameters == null for SimpleFunctionDescriptorImpl" with recursive generic type parameters
    • KT-46727 Report warning on contravariant usages of star projected argument from Java
    • KT-53197 K2: 'init' hides member of supertype 'UIComponent' and needs 'override' modifier
    • KT-53867 K2: @JvmRecord does not compile to a java record
    • KT-53964 K2 is unable to work with Java records
    • KT-53349 K2: TYPE_MISMATCH caused by non-local return
    • KT-54100 "Type variable TypeVariable(P) should not be fixed" crash in code with errors
    • KT-54212 K2: cannot calculate implicit property type
    • KT-53699 K2: Exception during IR lowering in code with coroutines
    • KT-54192 Warn about unsupported feature on generic inline class parameters
    • KT-53723 Friend modules aren't getting passed to cache build during box tests
    • KT-53873 K2: Duplicated diagnostics reported from user type ref checkers
    • KT-50909 "VerifyError: Bad type on operand stack" caused by smartcasting for nullable inline class property in class
    • KT-54115 Restore Psi2IrTranslator constructor from 1.7.20
    • KT-53908 K2: Self-referencing generics in Java class causes New Inference Error (IE: class Foo<T extends Foo>)
    • KT-53193 K2: compile error on project that compiles fine with normal 1.7.10
    • KT-54062 K2 Invalid serialization for type-aliased suspend function type with extension receiver
    • KT-53953 Forbid usages of super or super if in fact it accesses an abstract member
    • KT-47473 NI: Missed UPPER_BOUND_VIOLATED diagnostics if use type aliases with type parameters
    • KT-54049 K2: false positive MANY_IMPL_MEMBER_NOT_IMPLEMENTED
    • KT-30054 Wrong approximation if nullable anonymous object with implemented interface is used
    • KT-53751 Postpone IgnoreNullabilityForErasedValueParameters feature
    • KT-53324 Implement Enum.entries lowering on K/N
    • KT-44441 K2: report redeclaration error if there is a Java class with the same name as the Kotlin class
    • KT-53807 No warning about declaringClass on an enum value
    • KT-53493 K2: val on function parameter counts as just warning
    • KT-53435 K2: "IllegalArgumentException: class KtValueArgument is not a subtype of class KtExpression for factory ANNOTATION_ARGUMENT_MUST_BE_CONST" if string in nested annotation is concatenated
    • KT-52927 AssertionError: LambdaKotlinCallArgumentImpl
    • KT-53922 Make Enum.entries unstable feature to poison binaries
    • KT-53783 Exception during psi2ir when declaring expect data object
    • KT-53622 [OVERLOAD_RESOLUTION_AMBIGUITY] when enum entry called 'entries' is present in K2
    • KT-41670 JVM IR: AbstractMethodError when using inheritance for fun interfaces
    • KT-53178 K2: implement diagnostics for serialization plugin
    • KT-53804 Restore old and incorrect logic of generating InnerClasses attributes for kotlin-stdlib
    • KT-52970 Default value constant in companion object works on JVM and JS, but fails on native
    • KT-51114 FIR: Support DNN checks
    • KT-27936 Write InnerClasses attribute for all class names used in a class file
    • KT-53719 Parsing regression on function call with type arguments and labeled lambda
    • KT-53261 Evaluate effect from inline for primitive types
    • KT-53706 K2: Context receivers are not resolved on properties during type resolution stage
    • KT-39492 Kotlin.Metadata's packageName field cannot be an empty string
    • KT-53664 Ir Interpreter: unable to evaluate name of function reference marked with JvmStatic from another module
    • KT-52478 [Native] Partial linkage: Building native binary from cached KLIBs fails if one library depends on removed nested callable member from another one
    • KT-48822 CompilationException: Back-end (JVM) Internal error: Failed to generate expression: KtProperty - ConcurrentModificationException
    • KT-50281 IllegalStateException: unsupported call of reified inlined function
    • KT-50083 Different error messages in android and JVM (Intrinsics.checkNotNullParameter).
    • KT-53236 Support Enum.entries codegen on JVM/IR BE
    • KT-41017 FIR: should we support smartcast after null check
    • KT-53202 "ISE: Descriptor can be left only if it is last" after direct invoke optimization on a capturing lambda
    • KT-46969 @BuilderInference with nested DSL scopes cause false-positive scope violation in Kotlin 1.5
    • KT-53257 FIR: Improper context receiver argument is chosen when there are two extension receiver candidates
    • KT-53090 Anonymous function and extension function literals are generated as classes even with -Xlambdas=indy
    • KT-53208 K2: Cannot get annotation for default interface method parameter when compiled with -Xuse-k2
    • KT-53184 K2: NoSuchMethodError on KProperty1.get() referenced via nullable typealias
    • KT-53198 K2: Return type mismatch: expected kotlin/Unit, actual kotlin/Unit?
    • KT-53100 Optimization needed: (CONSTANT_PRIMITIVE(x: T?)) => x
    • KT-49875 [FIR] Support infering PRIVATE_TO_THIS visibility
    • KT-53024 Refactor FIR renderer to composable architecture
    • KT-50995 [FIR] Support SAM with receiver plugin
    • KT-53148 K1: introduce warning for inline virtual member in enum
    • KT-49847 Devirtualization fails to eliminate boxing in function reference context
    • KT-52875 Extension function literal creation with -Xlambdas=indy fails with incorrect arguments
    • KT-53072 INVALID_IF_AS_EXPRESSION error isn't shown in the IDE (LV 1.8)
    • KT-52985 Native: a function with type T? returned a kotlin.Unit instead of null
    • KT-52020 FIR warning message includes internal rendering
    • KT-48778 -Xtype-enhancement-improvements-strict-mode not respecting @NonNull annotation for property accesses?
    IDE
    Fixes
    • KTIJ-22357 CCE “class org.jetbrains.kotlin.fir.types.impl.FirImplicitTypeRefImpl cannot be cast to class org.jetbrains.kotlin.fir.types.FirResolvedTypeRef” in K2
    • KT-55150 Argument for @NotNull parameter 'scope' of org/jetbrains/kotlin/resolve/AnnotationResolverImpl.resolveAnnotationType must not be null
    • KTIJ-22165 IDE notification to promote users to migrate to the new Kotlin/JS toolchain
    • KTIJ-22166 IDE notification (or something else) about JPS and Maven support for Kotlin/JS is deprecated
    • KT-53543 Rework light classes for file facade
    • KT-48773 Investigate the possibility of removing dependency on old JVM backend in light classes
    • KTIJ-19699 IDE: False positive type mismatch in Java code for Kotlin nested class non-direct inheritor from external library
    • KT-51101 FIR IDE: Exception on "Show Type Info" action
    • KTIJ-22295 MPP, IDE: False positive UPPER_BOUND_VIOLATED when JVM module implements the generic interface from MPP module and the type parameter is not equal to itself.
    • KT-51656 FIR IDE: ProgressCancelled exception is masked in the compiler during resolve
    • KT-51315 FIR IDE: move out base modules from fe10 plugin to reuse in k2 plugin
    • KTIJ-22323 K2: ISE during resolve of stdlib calls from the stdlib
    • KTIJ-21391 Generate -> Override methods : don't delegate to abstract methods
    • KT-53097 Extract common part of light classes to another module
    • KTIJ-22354 FIR LC: annotation owner is always null
    • KTIJ-22157 Kotlin call resolver leaks user code when reporting exception
    IDE. Completion
    • KTIJ-22552 Kotlin: 'for loop' postfix completion doesn't work - "Fe10SuggestVariableNameMacro must be not requested from main classloader"
    • KTIJ-22503 Support code completion for data objects
    IDE. Debugger
    • KT-51755 Compilation exception with scripting compilation during debug session
    • KTIJ-21963 Debugger / IR: Expression evaluation of the debugger doesn't work
    IDE. Decompiler, Indexing, Stubs
    • KTIJ-22750 Initialize Kotlin stub element types lazily
    • KTIJ-18094 IDE: "AssertionError: Stub count doesn't match stubbed node length" with minified Android AAR library
    • KTIJ-17632 IndexOutOfBoundsException: Cannot decompile a class located in minified AAR
    IDE. Gradle Integration
    • KT-48135 In the IDE import, reuse dependency granular source set KLIBs across multi-project build to avoid duplicate external libraries
    • KTIJ-22345 False positive unresolved reference for members of subclasses of expect classes.
    • KT-53514 HMPP: False positive for None of the following functions can be called with the arguments supplied. with Enum in common module
    • KT-51583 Gradle 7.4+ | SamplesVariantRule interference: Could not resolve all files for configuration ':kotlinKlibCommonizerClasspath'
    • KTIJ-21077 Dependency matrix does not work with Jetpack compose / multiplatform projects
    IDE. Inspections and Intentions
    • KTIJ-19531 Adapt changes about new rules for method implementation requirements
    • KTIJ-22087 Support IDE inspections for upcoming data objects
    • KTIJ-20510 Quick fix to implement and call correct super method in case of inheritance with defaults
    • KTIJ-20170 Provide quickfix for deprecated resolution to private constructor of sealed class
    • KTIJ-22630 FIR IDE: Lazy resolve exception after invocation of Override members action on value class
    • KT-49643 Intentions: "Implement members" fails when base type function declaration uses unresolved generic types
    IDE. JS
    • KTIJ-22167 Make JS IR default in projects created by wizard
    • KTIJ-22332 Wizard: Kotlin/JS projects: cssSupport DSL should be updated
    IDE. KDoc
    • KTIJ-22324 K2 IDE: implement reference resolve inside KDocs
    IDE. Multiplatform
    • KTIJ-19566 New Project Wizard: Update HMPP-related flags in multiplatform wizards
    IDE. Navigation
    • KT-51314 FIR IDE: show Kotlin declarations in search symbol
    • KTIJ-22755 Find usage for constructor from kotlin library doesn't work for secondary constructor usages
    IDE. Script
    • KTIJ-22598 Add warning for standalone scripts in source roots
    • KT-54325 .settings.gradle.kts and .init.gradle.kts are reported as standalone scripts
    IDE. Structural Search
    • KTIJ-21986 KSSR: "CodeFragment with non-kotlin context should have fakeContextForJavaFile set: originalContext = null" warning shows up when replacing
    IDE. Tests Support
    • KT-50269 FIR IDE: Allow running tests via gutter
    IDE. Wizards
    • KTIJ-23537 Wizard: projects with Android modules require higher sdkCompileVersion
    • KTIJ-23525 Wizard: Compose multiplatform: project won't build and require higher compileSdkVersion
    • KTIJ-22763 New Project Wizard: remove deprecated Android extensions plugin from Android target in the project constructor
    • KTIJ-22481 Wizard: Kotlin -> Browser application (gradle groove). Build error
    JavaScript
    Fixes
    • KT-55097 KJS / IR + IC: Using an internal function from a friend module throws an unbound symbol exception
    • KT-54406 Kotlin/JS: build with dependencies fails with "Could not find "kotlin" in [~/.local/share/kotlin/daemon]"
    • KT-53074 Make JS IR BE default in toolchain (gradle & CLI)
    • KT-50589 UTF-8 Instability in kotlin.js.map
    • KT-54934 KJS / IR + IC: Suspend abstract function stubs are generated with unstable lowered ic signatures
    • KT-54895 KJS / IR + IC: broken cross module references for function default param wrappers
    • KT-54520 KJS / IR Allow IdSignature clashes
    • KT-54120 JS IR + IC: pointless invalidation of dependent code after modifying companions
    • KT-53986 KJS / IR + IC: compiler produces different JS file names with IC and without IC
    • KT-54010 JS IR + IC: Force IC cache invalidation after updating language version or features
    • KT-53931 KJS / Gradle: Regression with 1.7.20-RC: ReferenceError: println is not defined
    • KT-53968 Kotlin/JS: no UninitializedPropertyAccessException on access to non-initialized lateinit property defined in dependencies
    • KT-54686 KJS / IR: Incorrect generation of signatures when one of argument is nested class
    • KT-54479 KJS / IR + IC: Adding or removing companion fields leads java.lang.IllegalStateException in the compiler IC infrastructure
    • KT-54382 KJS / IR: Wrong type check for inheritors of suspend functions
    • KT-54323 KJS / IR + IC: Intrinsics from stdlib may lose their dependencies in incremental rebuild
    • KT-53361 KJS / IR: No debug info is generated for in-line js code
    • KT-53321 Implement Enum.entries lowering on JS/IR
    • KT-53112 KJS IR turn on IC infra by default
    • KT-50503 Kotlin/JS: IR + IC: compileTestDevelopmentExecutableKotlinJs fails with ISE: "Could not find library" after removing module dependency
    • KT-54011 JS IR + IC: EnumEntries don't work well when IC is enabled
    • KT-53672 KJS / IR: "IndexOutOfBoundsException: Index 0 out of bounds for length 0" caused by function reference to extension function of reified type variable
    • KT-43455 KJS: IR. Incremental compilation problem with unbound symbols
    • KT-53539 KJS: Exported class inherited non-exported class shows warning
    • KT-53443 KJS/IR: NullPointerException caused by anonymous objects inside lambdas
    • KT-52795 K/JS and K/Native IR-validation/compilation errors for a valid kotlin code
    • KT-52805 KJS/IR: Invalid call of inline function in also block
    • KT-51151 KJS / IR: Wrong overloaded generic method with receiver is called
    • KT-52830 KJS/IR: Sourcemap disabling doesn't work
    • KT-52968 KJS / IR: Buggy generation of overridden methods
    • KT-53063 KJS / IR + IC: undefined cross module reference for implemented interface functions
    • KT-51099 KJS / IR + IC: Cache invalidation doesn't check generic class variance annotations (in, out)
    • KT-51090 KJS / IR + IC: Cache invalidation doesn't check suspend qualifier
    • KT-51088 KJS / IR + IC: Cache invalidation doesn't check class qualifiers (data, inline)
    • KT-51083 KJS / IR + IC: Cache invalidation doesn't check inline function which was non inline initially
    • KT-51896 KJS / IR + IC: Cache invalidation doesn't trigger rebuild for fake overridden inline functions
    Language Design
    • KT-48385 Deprecate confusing grammar in when-with-subject
    • KT-48516 Forbid @Synchronized annotation on suspend functions
    • KT-41886 Ability to require opt-in for interface implementation, but not for usage
    • KT-34943 OVERLOAD_RESOLUTION_AMBIGUITY inconsistent with the equivalent Java code
    • KT-51334 Implement type-bound label this@Type
    Libraries
    New Features
    • KT-21007 Provide Kotlin OSGI Bundle with extensions for JRE8 (and JRE7)
    • KT-54082 Comparable and subtractible TimeMarks
    • KT-52928 Provide copyToRecursively and deleteRecursively extension functions for java.nio.file.Path
    • KT-49425 Update OptIn documentation to reflect latest design changes
    • KT-54005 Allow calling declaringJavaClass on Enum
    • KT-52933 rangeUntil members in built-in types
    Performance Improvements
    • KT-53508 Cache typeOf-related KType instances when kotlin-reflect is used
    Fixes
    • KT-51907 Switch JVM target of the standard libraries to 1.8
    • KT-54835 Document that Iterable.all(emptyCollection) returns TRUE.
    • KT-54168 Expand on natural order in comparator docs
    • KT-53277 Stabilize experimental API for 1.8
    • KT-53864 Review deprecations in stdlib for 1.8
    • KT-47707 Remove the system property and the brittle contains optimization code itself
    • KT-52336 Different behavior on JVM and Native in stringBuilder.append(charArray, 0, 1)
    • KT-53927 Remove deprecation from ConcurrentModificationException constructors
    • KT-53152 Introduce EnumEntries to stdlib as backing implementation of Enum.entries
    • KT-53134 stdlib > object Charsets > not thread safe lazy initialization
    • KT-51063 Gradle project with JPS runner: "JUnitException: Failed to parse version" JUnit runner internal error with JUnit
    • KT-52908 Native: setUnhandledExceptionHook swallows exceptions
    Native
    • KT-51043 Kotlin Native: ObjC-Interop: kotlin.ClassCastException: null cannot be cast to kotlin.Function2
    • KT-50786 Native: prohibit suspend calls inside autoreleasepool {}
    • KT-52834 Implement test infrastructure for K2/Native
    Native. C Export
    • KT-36878 Reverse C Interop: incorrect headers generation for primitive unassigned type arrays
    • KT-53599 [Reverse C Interop] Provide box/unbox API for unsigned primitive types
    • KT-41904 Kotlin/Native : error: duplicate member for interface and function with the same name
    • KT-42830 [Reverse C Interop] Add API to get value of boxed primitives
    • KT-39496 K/N C: optional unsigned types as function parameters crash the compiler
    • KT-39015 Cannot compile native library with nullable inline class
    Native. C and ObjC Import
    • KT-54738 Cocoapods cinterop: linking platform.CoreGraphics package
    • KT-54001 Kotlin/Native: support header exclusion in cinterop def files
    • KT-53151 Native: Custom declarations in .def don't work with modules, only headers
    Native. ObjC Export
    • KT-53680 Obj-C refinement annotations
    • KT-54119 Native: runtime assertion failed due to missing thread state switch
    • KT-42641 Don't export generated component* methods from Kotlin data classes to Obj-C header
    Native. Platform Libraries
    • KT-54225 Native: update to Xcode 14.1
    • KT-54164 Native: commonizer fails on CoreFoundation types
    • KT-39747 Why is there no WinHttp API in Kotlin/Native's Windows API?
    Native. Runtime
    • KT-49228 Kotlin/Native: Allow to unset unhandled exception hook
    • KT-27305 Fix FILE macro inside RuntimeCheck and RuntimeAssert
    Native. Runtime. Memory
    • KT-54498 Deprecation message of 'FreezingIsDeprecated' is not really helpful
    • KT-53182 New memory manager: Unexpected memory usage on IOS
    Native. Stdlib
    • KT-52429 Small Usability Improvements for Worker API
    Reflection
    • KT-54629 Incorrectly cached class classifier
    • KT-54611 KTypeImpl does not take into account class loader from the classifier property
    • KT-48136 Make Reflection.getOrCreateKotlinPackage use cache when kotlin-reflect is used
    • KT-50705 Use ClassValue to cache KClass objects in kotlin-reflect
    • KT-53454 Properly cache the same class's KClass when it's loaded by multiple classloaders in getOrCreateKotlinClass
    Specification
    • KT-54210 Update Kotlin specification to mention that since 1.8 generics in value classes are allowed
    Tools. CLI
    • KT-54116 Add JVM target bytecode version 19
    • KT-53278 Support values 6 and 8 for -Xjdk-release
    • KT-46312 CLI: Kotlin runner should use platform class loader to load JDK modules on Java 9+
    Tools. Commonizer
    • KT-54310 Commonizer fails on 1.8.0-dev K/N distributions
    • KT-48576 [Commonizer] platform.posix.pselect not commonized in Ktor
    Tools. Compiler Plugins
    • KT-46959 Kotlin Lombok: Support generated builders (@Builder)
    • KT-53683 Unresolved reference compilation error occurs if a file is annotated with @ Singular and has any guava collection type : ImmutableTable, ImmutableList or else
    • KT-53657 [K2] Unresolved reference compilation error occurs if a field is annotated with @ Singular and has type NavigableMap without explicit types specification
    • KT-53647 [K2] Unresolved reference compilation error occurs if a field is annotated with @ Singular and has type Iterable<>
    • KT-53724 Param of the @ Singular lombok annotation ignoreNullCollections=true is ignored by kotlin compiler
    • KT-53451 [K2] References to methods generated by @ With lombok annotation can't be resolved with enabled K2 compiler
    • KT-53721 [K2] There is no compilation error while trying to add null as a param of the field with non-null type
    • KT-53370 Kotlin Lombok compiler plugin can't resolve methods generated for java boolean fields annotated with @ With annotation
    Tools. Compiler plugins. Serialization
    • KT-54878 JVM/IR: java.lang.ClassCastException: class org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl cannot be cast to class org.jetbrains.kotlin.ir.types.IrTypeProjection on serializer<Box<*>>()
    • KT-55340 Argument for kotlinx.serialization.UseSerializers does not implement KSerializer or does not provide serializer for concrete type
    • KT-55296 Improve exceptions in serialization plugin
    • KT-55180 KJS: regression in serialization for Kotlin 1.8.0-beta
    • KT-53157 Recursion detected in a lazy value under LockBasedStorageManager in kotlinx.serialization
    • KT-54297 Regression in serializable classes with star projections
    • KT-49660 kotlinx.serialization: IndexOutOfBoundsException for parameterized sealed class
    • KT-43910 JS IR: Serialization with base class: "IndexOutOfBoundsException: Index 0 out of bounds for length 0"
    Tools. Daemon
    • KT-52622 Kotlin/JS, Kotlin/Common compilations start Kotlin daemon incompatible with Kotlin/JVM compilation on JDK 8
    Tools. Gradle
    New Features
    • KT-27301 Expose compiler flags via Gradle lazy properties
    • KT-53357 Change single build metrics property
    • KT-50673 Gradle: KotlinCompile task(s) should use @NormalizeLineEndings
    • KT-34464 Kotlin build report path not clickable in the IDE
    Performance Improvements
    • KT-51525 [Gradle] Optimize evaluating args for compile tasks
    • KT-52520 Remove usage of reflection from CompilerArgumentsGradleInput
    Fixes
    • KT-48843 Add ability to disable Kotlin daemon fallback strategy
    • KT-55334 kaptGenerateStubs passes wrong android variant module names to compiler
    • KT-55255 Gradle: stdlib version alignment fails build on dynamic stdlib version.
    • KT-55363 [K1.8.0-Beta] Command line parsing treats plugin parameters as source files
    • KT-54993 Raise kotlin.jvm.target.validation.mode check default level to error when build is running on Gradle 8+
    • KT-54136 Duplicated classes cause build failure if a dependency to kotlin-stdlib specified in an android project
    • KT-50115 Setting toolchain via Java extension does not configure 'kotlinOptions.jvmTarget' value when Kotlin compilation tasks are created eagerly
    • KT-55222 Migrate AndroidDependencyResolver to the new Gradle API
    • KT-55119 There is no validation for different jvmTarget and targetCompatibility values in multiplatform projects with jvm target and used java sources
    • KT-55102 Compile java task fails with different target version in pure kotlin project
    • KT-54995 [1.8.0-Beta] compileAppleMainKotlinMetadata fails on default parameters with No value passed for parameter 'mustExist'
    • KT-35003 Automatically set targetCompatibility for kotlin-jvm projects to work with gradle 6 metadata
    • KT-45335 kotlinOptions.jvmTarget conflicts with Gradle variants
    • KT-48798 Android: going from one to more than one productFlavor causes inputs of commonSourceSet$kotlin_gradle_plugin property of compileKotlin task to change
    • KT-55019 Gradle sync: UnknownConfigurationException when adding implementation dependencies to a Kotlin with Java compilation
    • KT-55004 jvmTarget value is ignored by depending modules if a task "UsesKotlinJavaToolchain" is configured for all project modules using allProjects {}
    • KT-54888 Add Gradle property to suppress kotlinOptions.freeCompilerArgs modification on execution phase
    • KT-54399 Undeprecate 'kotlinOptions' DSL
    • KT-54306 Change the naming of newly added Compiler*Options classes and interfaces
    • KT-54580 KotlinOptions in AbstractKotlinCompilation class are deprecated
    • KT-54653 java.lang.NoClassDefFoundError: kotlin/jdk7/AutoCloseableKt exception if a dependency to the kotlin-stdlib is added
    • KT-52624 Compatibility with Gradle 7.3 release
    • KT-54703 Stdlib substitution does not work with JPMS modules
    • KT-54602 Prevent leaking Gradle Compile DSL types into compiler cli runtime
    • KT-54439 Project failed to sync Native LaguageSettings to compiler options in afterEvaluate
    • KT-53885 Bump minimal supported Gradle version to 6.8.3
    • KT-53773 Protect and system properties can contain sensitive data
    • KT-53732 Add custom values limits for build scan reports
    • KT-52623 Compatibility with Gradle 7.2. release
    • KT-51831 Gradle: remove kotlin.compiler.execution.strategy system property
    • KT-51679 Change deprecation level to error for KotlinCompile setClasspath/getClasspath methods
    • KT-54335 Kotlin build report configuration. There is no validation for SINGLE_FILE output if the required kotlin.build.report.single_file property is empty or absent
    • KT-54356 Kotlin build report configuration. Wrong path is used for the property kotlin.internal.single.build.metrics.file
    • KT-53617 KotlinCompilerExecutionStrategy value is ignored by depending modules if configure once for all project modules using allProjects {}
    • KT-53823 Kotlin Gradle Plugin uses deprecated Gradle API: Provider.forUseAtConfigurationTime()
    • KT-54142 Increase Kotlin Gradle plugin Gradle target API to 7.5
    • KT-50161 Android variant filter breaks KotlinCompile cache compatibility
    • KT-54113 LanguageSettings to KotlinNativeLink.toolOptions sync are executed on the wrong context
    • KT-53830 Versions of kotlin-stdlib-jdk8 and kotlin-stdlib-jdk7 aren't overrided if added as transitive dependencies to kotlin-stdlib
    • KT-54112 Missing target input on KotlinNativeLink task
    • KT-45879 Documentation: Wrong kotlin languageVersion "1.6 (EXPERIMENTAL)"
    • KT-54103 Remove JvmTarget.JVM_1_6 from generated Gradle compiler type
    • KT-52959 KMP code is breaking Gradle project isolation
    • KT-50598 MULTIPLE_KOTLIN_PLUGINS_SPECIFIC_PROJECTS_WARNING is only shown on first build
    • KT-53246 Gradle: Special characters in paths of errors and warnings should be escaped
    • KT-47730 How to avoid stdlib coming from Kotlin gradle plugin
    • KT-52209 Corrupted cache and non-incremental build if produce caches "in process" and restore then compiling with kotlin daemon
    • KT-41642 "TaskDependencyResolveException: Could not determine the dependencies" when trying to apply stdlib
    • KT-53390 Drop usage of -Xjava-source-roots when passing java sources required for Kotlin compilation
    • KT-52984 Kotlin Gradle plugin is misbehaving by resolving DomainObjectCollection early
    • KT-38622 Non-incremental compilation because of R.jar with Android Gradle plugin 3.6
    • KT-38576 AnalysisResult.RetryWithAdditionalRoots crashes during incremental compilation with java classes in classpath
    Tools. Gradle. Cocoapods
    • KT-54314 Cocoapods: Signing pod dependency for Xcode 14
    • KT-54060 Xcode 14: disable bitcode embedding for Apple frameworks
    • KT-53340 Change default linking type for frameworks registered by cocoapods plugin
    • KT-53392 Deprecate and delete downloading pod dependencies by direct link
    • KT-53695 Build of macOS application fails if a framework is integrated via Cocoapods plugin
    Tools. Gradle. JS
    • KT-53367 KJS: Migrate cssSupport API
    • KT-45789 KJS / IR: Transitive NPM dependencies are not included in PublicPackageJsonTask output
    • KT-55099 K/JS: Second declaration of JS target without compiler type report warning incorrectly
    • KT-52951 [KGP/JS] Browser test target registration via properties
    • KT-52950 KJS: Report if yarn.lock was updated during built
    • KT-53374 KJS / Gradle: Implement IDEA sync detection logic via ValueSource to improve configuration cache support
    • KT-53381 Kotlin/JS: with erased kotlin-js-store/ and reportNewYarnLock = true the task kotlinUpgradeYarnLock always fails
    • KT-53788 KJS / Gradle: Disable Gradle build cache for KotlinJsDce when development mode is enabled
    • KT-53614 Kotlin/JS upgrade npm dependencies
    Tools. Gradle. Multiplatform
    New Features
    • KT-53396 Support 'implementation platform()' by gradle kotlin mpp plugin for JVM target
    • KT-40489 MPP / Gradle: support BOM (enforcedPlatform) artifacts in source set dependencies DSL
    Performance Improvements
    • KT-52726 [MPP] Optimize caching/performance/call-sites of 'compilationsBySourceSets'
    Fixes
    • KT-54634 MPP: Test Failure causes: KotlinJvmTest$Executor$execute$1 does not define failure
    • KT-35916 Gradle MPP plugin: Configurations for a main compilation and its default source set have different naming
    • KT-46960 Repeated kotlin/native external libraries in project
    • KT-27292 MPP: jvm { withJava() }: Gradle build: Java source under Kotlin root is resolved while building, but does not produce output class files
    • KT-34650 Naming clash in MPP+Android: androidTest vs androidAndroidTest
    • KT-54387 Remove MPP alpha stability warning
    • KT-31468 Targets disambiguation doesn't work if a depending multiplatform module uses withJava() mode
    • KT-54090 Take an Apple test device from the device list
    • KT-54301 KotlinToolingVersionOrNull: IllegalArgumentException
    • KT-53256 Implement K/N compiler downloading for KPM
    • KT-45412 KotlinCompilation: Make sure .kotlinSourceSets and .allKotlinSourceSets include the default source set
    • KT-49202 Tests on android target can't be executed in multiplatform project if dependency to kotlin-test framework is provided as a single dependency and tests configured to be executed via Junit5
    Tools. Gradle. Native
    New Features
    • KT-43293 Support Gradle configuration caching with Kotlin/Native
    • KT-53107 Add arm64 support for watchOS targets (Xcode 14)
    Fixes
    • KT-53704 Native cinterop: eager header path calculation
    • KT-54814 Kotlin/Native: Github Actions: Testing watchOSX64 with Xcode 14 — Invalid device: Apple Watch Series 5
    • KT-54627 Native: :commonizeNativeDistribution with configuration cache enabled fails even when set to warn on JDK 17
    • KT-54339 Link tasks fail if Gradle Configuration Cache is enabled
    • KT-53191 Native cinterop sync problem with gradle
    • KT-54583 watchosDeviceArm64 target shouldn't register test tasks
    • KT-52303 Gradle / Native: Build tasks ignore project.buildDir
    • KT-54442 Gradle iOS test tasks fail if a device is not selected explicitly
    • KT-54177 Gradle: Deprecate enableEndorsedLibs flag
    • KT-47355 Support macos target for FatFramework task
    • KT-53339 MPP / CocoaPods: The static framework fails to install on a real iOS device
    • KT-31573 Missing description for Native Gradle tasks
    • KT-53131 Gradle Sync: "NoSuchElementException: Array contains no element matching the predicate" with CocoaPods
    • KT-53686 Task assembleReleaseXCFramework fails with "error: the path does not point to a valid framework" if project name contains a dash
    Tools. Incremental Compile
    • KT-54144 New IC: "IllegalStateException: The following LookupSymbols are not yet converted to ProgramSymbols" when changing an inline function with custom JvmName
    • KT-53871 New IC: "IllegalStateException: The following LookupSymbols are not yet converted to ProgramSymbols" when changing an inline property accessor
    • KT-19804 Relocatable IC caches
    Tools. JPS
    • KT-45474 False positive NO_ELSE_IN_WHEN on sealed class with incremental compilation
    • KT-54228 Switching abstract to sealed classes causes incremental issue
    • KT-38483 JPS: Stopping compilation causes IDE CompilationCanceledException
    • KT-50310 False positive NO_ELSE_IN_WHEN on incremental build when adding sealed classes
    • KT-48813 Move cache version to compiler
    • KTIJ-921 JPS: FileNotFoundException on project build in mixed Kotlin/Scala project
    Tools. Kapt
    • KT-54187 JVM IR + kapt: incorrect modifier final is generated for nested enum in interface
    • KT-48827 Remove 'kapt.use.worker.api' property
    Tools. Scripts
    • KT-54355 Scripts: Internal compiler error (languageVersion=1.9)
    • KT-53009 Scripting: NDFDE “Descriptor wasn't found for declaration SCRIPT” on using script definition with kotlin from master

    v1.7.22: Kotlin 1.7.22

    Compare Source

    This is a technical release. It doesn't contain any fixes that aren't included in Kotlin 1.7.21. Version 1.7.22 of the Kotlin plugin will not be available for downloading or installing in any IDEs.

    Checksums

    | File | Sha256 | |


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about these updates again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 1
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

    Detected dependencies

    github-actions
    .github/workflows/build.yaml
    • actions/checkout v3
    • gradle/wrapper-validation-action v1.0.5
    • actions/setup-java v3
    • maxim-lobanov/setup-xcode v1
    • reactivecircus/android-emulator-runner v2
    .github/workflows/release.yaml
    • actions/checkout v3
    • gradle/wrapper-validation-action v1.0.5
    • actions/setup-java v3
    • ffurrer2/extract-release-notes v1
    • softprops/action-gh-release v1
    gradle
    gradle.properties
    settings.gradle
    build.gradle
    build-logic/settings.gradle
    build-logic/build.gradle
    gradle/libs.versions.toml
    • com.android.tools.build:gradle 7.3.1
    • androidx.core:core-ktx 1.9.0
    • androidx.test:runner 1.5.2
    • org.jetbrains.compose.compiler:compiler 1.3.2.2
    • org.jetbrains.compose.runtime:runtime 1.2.2
    • androidx.compose.runtime:runtime-rxjava2 1.3.2
    • org.jetbrains.dokka:dokka-gradle-plugin 1.7.20
    • com.github.gmazzo:gradle-buildconfig-plugin 3.1.0
    • junit:junit 4.13.2
    • org.jetbrains.kotlin:kotlin-gradle-plugin 1.7.20
    • org.jetbrains.kotlin:kotlin-test 1.7.20
    • org.jmailen.gradle:kotlinter-gradle 3.13.0
    • org.jetbrains.kotlinx:kotlinx-coroutines-core 1.6.4
    • org.jetbrains.kotlinx:kotlinx-coroutines-test 1.6.4
    • org.jetbrains.kotlinx:kotlinx-coroutines-rx2 1.6.4
    • com.vanniktech:gradle-maven-publish-plugin 0.18.0
    • io.reactivex.rxjava2:rxjava 2.2.21
    • com.diffplug.spotless:spotless-plugin-gradle 6.12.1
    • com.squareup.okhttp3:okhttp 4.10.0
    • com.squareup.okhttp3:logging-interceptor 4.10.0
    • com.squareup.retrofit2:retrofit 2.9.0
    • com.squareup.retrofit2:converter-scalars 2.9.0
    • com.google.truth:truth 1.1.3
    • app.cash.turbine:turbine 0.12.1
    molecule-gradle-plugin/gradle.properties
    molecule-gradle-plugin/build.gradle
    molecule-runtime/gradle.properties
    molecule-runtime/build.gradle
    sample/build.gradle
    gradle-wrapper
    gradle/wrapper/gradle-wrapper.properties
    • gradle 7.6

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
  • Add foundation of sample that uses AAC ViewModel

    Add foundation of sample that uses AAC ViewModel

    A common request I've heard from folks is an example of how to use Molecule to drive presentation logic when using androidx's ViewModel.

    The plan here is to build a single screen sample app that hits this API that displays random images of different dog breeds. I haven't actually implemented any of the actual logic yet, but that's not really the important part. What matters more is the skeleton proposed here.

    opened by chris-horner 4
Releases(0.6.1)
  • 0.6.1(Nov 16, 2022)

  • 0.6.0(Nov 8, 2022)

    New:

    • Support for Kotlin 1.7.20
    • Update to JetBrains Compose runtime 1.2.1 (AndroidX Compose runtime 1.2.1).
    • Switch to JetBrains Compose compiler 1.3.2.1 (AndroidX Compose compiler 1.3.2 + JS fix)

    Fixed:

    • When applying the Compose compiler plugin to Kotlin/JS targets, ensure decoys are used.
    • Add cacheKind=none Gradle configuration which ensures downstream Kotlin/Native projects can link.
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0(Oct 13, 2022)

    New:

    • Update to JetBrains Compose runtime 1.2.0 (this uses AndroidX Compose runtime 1.2.1).
    • Add iOS, MacOS, tvOS, watchOS, linux, and windows targets for Kotlin/Native.

    Changed:

    • The 'molecule-testing' artifact has been removed.
    Source code(tar.gz)
    Source code(zip)
  • 0.5.0-beta01(Sep 16, 2022)

    New:

    • Update to JetBrains Compose runtime 1.2.0-beta01 (this uses AndroidX Compose runtime 1.2.1).
    • Add iOS, MacOS, tvOS, watchOS, linux, and windows targets for Kotlin/Native.

    Changed:

    • The 'molecule-testing' artifact has been removed.
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Aug 10, 2022)

    New:

    • Update to Compose compiler 1.3.0 which supports Kotlin 1.7.10.

    Fixed:

    • Prevent "Trying to call 'getOrThrow' on a failed channel result: Failed" exceptions when using the immediate recompose clock.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Aug 10, 2022)

  • 0.4.0-beta01(Jul 27, 2022)

  • 0.3.0(Jul 27, 2022)

    New:

    • Enable Kotlin multiplatform usage on JVM and JS targets (in addition to Android). All native targets are blocked on JetBrains' Compose runtime supporting them (with a stable release).
    • Update to Compose compiler 1.2.0 which supports Kotlin 1.7.0.
    • Add RecomposeClock parameter to both moleculeFlow and launchMolecule which allows choosing between a frame-based clock for recomposition or a clock which immediately recomposes for any change.
    • The 'molecule-testing' library is deprecated. The recommendation is to use the new immediate clock mode and Turbine. If you have a use case which cannot be handled by this change please comment on this issue.
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Feb 9, 2022)

    New:

    • Update to Compose 1.1.0 which supports Kotlin 1.6.10

    Fixed:

    • Explicitly dispose internal Composition allowing DisposableEffects to fire.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Nov 10, 2021)

a Facebook Messenger clone using Stream SDK & Jetpack Compose

Messenger Clone Built for Android using Stream SDK & Jetpack Compose This project is developed by MathRoda for more projects GitHub . Showcase Video w

MathRoda 90 Dec 22, 2022
📱 WhatsApp clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat SDK for Compose.

This is a WhatsApp clone app built with Jetpack Compose and Stream Chat SDK for Compose. The purpose of this repository is to demonstrate below: Imple

Stream 689 Dec 25, 2022
Example Jetpack Compose Android App, that uses the newest mechanisms, like StateFlow, SharedFlow, etc. to manage states and handle events. ViewModel, UI and Screenshot tests included :)

AndroidMVIExample Example Jetpack Compose Android App, that uses the newest mechanisms, like StateFlow, SharedFlow, etc. to manage states and handle e

Patryk Kosieradzki 55 Nov 18, 2022
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop 🚀, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

Mori Atsushi 3 Dec 15, 2022
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens

This library provides a set of Settings like composable items to help android Jetpack Compose developers build complex settings screens without all the boilerplate

Bernat Borrás Paronella 178 Jan 4, 2023
PapriCoin demonstrates Jetpack Compose usage to build modern app based on Clean Architecture and newest Tech-Stack

PapriCoin demonstrates Jetpack Compose usage to build modern app based on Clean Architecture and newest Tech-Stack. Repository also has loca

Malik Mukhametzyanov 15 Nov 9, 2022
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Md. Mahmudul Hasan Shohag 186 Jan 1, 2023
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

BHAVNA THACKER 3 Dec 31, 2022
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

omar 1 Aug 11, 2022
Butterfly - Butterfly helps to build adaptive and responsive UIs for Android with Jetpack WindowManager

?? Butterfly helps to build adaptive and responsive UIs for Android with Jetpack

Stream 200 Dec 13, 2022
Desktop app build with compose UI

Desktop App POS UI desktop app build with compose ui

null 9 Dec 7, 2022
Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

MindOrks 382 Jan 5, 2023
Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose

Jetpack-compose-animations-examples This repository consists of 4 animations: St

Canopas Software 180 Jan 2, 2023
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
Fractal Trees 🌴 using recursion | Demonstrated using Jetpack Compose 🚀

Fractal Trees ?? Description Implementing Fractal Trees ?? with recursion ➰ and using Jetpack Compose to demonstrate it ?? ?? Motivation and Context H

Vivek Sharma 28 Oct 5, 2022
Compose-Instagram-Profile-UI - Instagram profile screen UI using android jetpack compose

Compose-Intsgram-Profile-UI Instagram profile screen UI using android jetpack co

TILLERN 1 Mar 8, 2022
Luis David Orellana 3 Jun 20, 2022