Use Anvil KSP instead of the Square KAPT one (#3564)
* Use Anvil KSP instead of the Square KAPT one * Fix several configuration cache, lint and test issues * Allow incremental kotlin compilation in the CI * Workaround Robolectric + Compose issue that caused `AppNotIdleException` * Update the `enterprise` commit hash * Update screenshots --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
5fcc80a383
commit
4a43fcb69a
54 changed files with 463 additions and 348 deletions
|
|
@ -28,7 +28,6 @@ dependencies {
|
|||
// - Add every single module as a dependency of this one.
|
||||
// - Move the Konsist tests to the `app` module, but the `app` module does not need to know about Konsist.
|
||||
tasks.withType<Test>().configureEach {
|
||||
outputs.upToDateWhen {
|
||||
gradle.startParameter.taskNames.any { it.contains("check", ignoreCase = true).not() }
|
||||
}
|
||||
val isNotCheckTask = gradle.startParameter.taskNames.any { it.contains("check", ignoreCase = true).not() }
|
||||
outputs.upToDateWhen { isNotCheckTask }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2024 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.tests.testutils
|
||||
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.rules.TestRule
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
object RobolectricDispatcherCleaner {
|
||||
// HACK: Workaround for https://github.com/robolectric/robolectric/issues/7055#issuecomment-1551119229
|
||||
fun clearAndroidUiDispatcher(pkg: String = "androidx.compose.ui.platform") {
|
||||
val clazz = javaClass.classLoader!!.loadClass("$pkg.AndroidUiDispatcher")
|
||||
val combinedContextClass = javaClass.classLoader!!.loadClass("kotlin.coroutines.CombinedContext")
|
||||
val companionClazz = clazz.getDeclaredField("Companion").get(clazz)
|
||||
val combinedContext = companionClazz.javaClass.getDeclaredMethod("getMain")
|
||||
.invoke(companionClazz) as CoroutineContext
|
||||
val androidUiDispatcher = combinedContextClass.getDeclaredField("element")
|
||||
.apply { isAccessible = true }
|
||||
.get(combinedContext)
|
||||
.let { clazz.cast(it) }
|
||||
var scheduledFrameDispatch = clazz.getDeclaredField("scheduledFrameDispatch")
|
||||
.apply { isAccessible = true }
|
||||
.getBoolean(androidUiDispatcher)
|
||||
var scheduledTrampolineDispatch = clazz.getDeclaredField("scheduledTrampolineDispatch")
|
||||
.apply { isAccessible = true }
|
||||
.getBoolean(androidUiDispatcher)
|
||||
val dispatchCallback = clazz.getDeclaredField("dispatchCallback")
|
||||
.apply { isAccessible = true }
|
||||
.get(androidUiDispatcher) as Runnable
|
||||
if (scheduledFrameDispatch || scheduledTrampolineDispatch) {
|
||||
dispatchCallback.run()
|
||||
scheduledFrameDispatch = clazz.getDeclaredField("scheduledFrameDispatch")
|
||||
.apply { isAccessible = true }
|
||||
.getBoolean(androidUiDispatcher)
|
||||
scheduledTrampolineDispatch = clazz.getDeclaredField("scheduledTrampolineDispatch")
|
||||
.apply { isAccessible = true }
|
||||
.getBoolean(androidUiDispatcher)
|
||||
}
|
||||
assertFalse(scheduledFrameDispatch)
|
||||
assertFalse(scheduledTrampolineDispatch)
|
||||
}
|
||||
}
|
||||
|
||||
fun <R : TestRule, A : ComponentActivity> AndroidComposeTestRule<R, A>.setSafeContent(content: @Composable () -> Unit) {
|
||||
RobolectricDispatcherCleaner.clearAndroidUiDispatcher()
|
||||
setContent(content)
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ dependencies {
|
|||
implementation(projects.appnav)
|
||||
allLibrariesImpl()
|
||||
allServicesImpl()
|
||||
allFeaturesImpl(rootDir, logger)
|
||||
allFeaturesImpl(project)
|
||||
implementation(projects.appicon.element)
|
||||
implementation(projects.appicon.enterprise)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0a12b9a2dfafb1f8cdb329a41c422ebe913b6a8da2f48a217955f43b9f46ac4d
|
||||
size 23505
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:053b62a43c2ebec26c9d32f9cd002e01f90665be7530d281aad302377585dfae
|
||||
size 21420
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:306561dca24390baca77657839f96b63f93114e5bce523764903cf9030185320
|
||||
size 30358
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c0f023eda3a5fd9ff9584e93a6685010de35fb9464025b8c82634be801ada533
|
||||
size 27476
|
||||
Loading…
Add table
Add a link
Reference in a new issue