Upgrade kotlin to 1.7.20, coroutines to 1.6.4 and compose compiler to 1.3.2.
Replace deprecated Xopt-in with op-in.
Replace deprecated Xjvm-default=enable with Xjvm-default=all.
Remove useIR property that is now default true.
Used `runTestOnMain` where `MainCoroutineRule` was used or needed to be used,
`runTest` elsewhere.
Extra effort for removing all `runBlocking` occurrences in unit tests.
`kotlinx.coroutines.test.runTest` is a test specific API that seems like a more
appropriate way for running tests in a coroutine than the general
`kotlinx.coroutines.runBlocking` api.
- Refactor out all usages of TestCoroutineDispatcher and TestCoroutineScope
- Refactor MainCoroutineRule to now use UnconfinedTestDispatcher by default.
This dispatcher will eagerly enter all launch or async blocks being more suited
to our codebase.
This also required updating room to >= 2.4.0.
This new version adds a deprecation of the `MigrationTestHelper` api used in
`LoginExceptionStorageTest` that is to be later fixed in https://github.com/mozilla-mobile/android-components/issues/11765.
`activity_compose` was also update to the latest stable version to ensure a
better match with the latest stable version for compose.
Used 1.6.10 for Kotlin although 1.6.20 is available to prevent any issues with
Compose 1.1.1 reported as an error at compile time:
"e: This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10
but you appear to be using Kotlin version 1.6.20 which is not known to be
compatible. Please fix your configuration (or
`suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!)."
This also required updating room to >= 2.4.0.
This new version adds a deprecation of the `MigrationTestHelper` api used in
`LoginExceptionStorageTest` that is to be later fixed in https://github.com/mozilla-mobile/android-components/issues/11765.
activity_compose was also update to the latest stable version to ensure a
better match with the latest stable version for compose.
These follow a few more simple patterns I was able to find:
- the testDispatcher is not used anywhere else: remove it
- the testDispatcher is used to set a main dispatcher: this is redundant
to the test rule so remove it both the dispatcher & the main dispatcher
- the testDispatcher is actually used elsewhere: for simplicity, change
the reference to point at the MainCoroutineRule.
This is redundant to the built-in TestCoroutineDispatcher() method.
TestCoroutineDispatcher is also preferred because it has enhanced
testing functionality including defining a context-specific
`runBlockingTest` function, the ability to control `delay` timings, etc.
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
Issue https://github.com/mozilla-mobile/android-components/pull/8121: Replace MigrationStore with MigrationContext and prevent usage outside of a Middleware.
* Before executing the reducer chain we now verify that we are on the store thread and throw if we are on a different thread.
* MigrationContext now provides a store property that returns the underlying Store instance. This can be used to pass it to
other components and threads that are not part of the Middleware.
* Fixed existing Middleware implementations to use the MiddlewareContext or pass the actual Store instance around.