From c3f128b6f04c94ed73ca9d33e7ec73505f7042df Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Wed, 16 Sep 2026 11:27:44 +0200 Subject: [PATCH] Use patched Konsist version (forked, 0.18.0) (#7719) * Use a patched fork of Konsist The patch contains code to ignore hidden folders in the root project: by default, Konsist scans *every single file* in the root directory except for a few exceptions, and hidden folders were not a part of that. That means `.git`, `.github`, etc. would be scanned to for no good reason and even worse, hidden folders used for worktrees would get scanned too, so Konsist would end up scanning the same project with small variations several times and OOMing / taking ages to finish. * Make `Immutable/Stable` annotation check more performant. Also, fix case that was previously not found --- .../android/features/joinroom/impl/JoinRoomState.kt | 1 + gradle/libs.versions.toml | 2 +- settings.gradle.kts | 2 ++ .../android/tests/konsist/KonsistArchitectureTest.kt | 9 ++------- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomState.kt b/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomState.kt index 25f7765a7c..a1ab73486d 100644 --- a/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomState.kt +++ b/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomState.kt @@ -107,6 +107,7 @@ sealed interface LoadedDetails { ) : LoadedDetails } +@Immutable sealed interface JoinAuthorisationStatus { data object None : JoinAuthorisationStatus data class IsInvited(val inviteData: InviteData, val inviteSender: InviteSender?) : JoinAuthorisationStatus diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 62794efded..f609b5e26e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -168,7 +168,7 @@ test_arch_core = "androidx.arch.core:core-testing:2.2.0" test_junit = "junit:junit:4.13.2" test_runner = "androidx.test:runner:1.7.0" test_mockk = "io.mockk:mockk:1.14.11" -test_konsist = "com.lemonappdev:konsist:0.17.3" +test_konsist = "com.github.jmartinesp:konsist:0.18.0" test_turbine = "app.cash.turbine:turbine:1.2.1" test_truth = "com.google.truth:truth:1.4.5" test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.22" diff --git a/settings.gradle.kts b/settings.gradle.kts index 715866b5c4..8bdd4632c0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,6 +23,8 @@ dependencyResolutionManagement { includeModule("com.github.matrix-org", "matrix-analytics-events") // Required transitively by androidx.media3:media3-exoplayer-midi for MIDI playback. includeModule("com.github.philburk", "jsyn") + // This is a fork of Konsist that skips hidden folders and files, which otherwise can cause performance issues. + includeModule("com.github.jmartinesp", "konsist") } } // Check for official Android-related packages only in Google's maven repo diff --git a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt index 26f9ef50a3..23f36f014b 100644 --- a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt +++ b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistArchitectureTest.kt @@ -76,6 +76,7 @@ class KonsistArchitectureTest { .withSealedModifier() .withoutAnnotationOf(Immutable::class, Stable::class) .map { it.fullyQualifiedName } + .toSet() Konsist.scopeFromProject() .functions() .withAnnotationOf(Composable::class) @@ -85,13 +86,7 @@ class KonsistArchitectureTest { return@all if (type.startsWith("@") || type.contains("->") || type.startsWith("suspend")) { true } else { - val typePackage = param.type.sourceDeclaration?.let { declaration -> - declaration.asTypeParameterDeclaration()?.packagee - ?: declaration.asExternalDeclaration()?.packagee - ?: declaration.asClassOrInterfaceDeclaration()?.packagee - ?: declaration.asKotlinTypeDeclaration()?.packagee - ?: declaration.asObjectDeclaration()?.packagee - }?.name + val typePackage = param.type.packagee?.name if (typePackage == null) { false } else {