fix(deps): update android.gradle.plugin to v9 (major) (#6021)

* Update android.gradle.plugin to v9

* Separate extensions between app and library ones

`CommonExtension` has been split and its properties are now duplicated in `ApplicationExtension` and `LibraryExtension` without a shared interface, so we now need to duplicate the helper extension functions

* Bump Gradle wrapper to `9.3.1`

* Remove `kotlin-android` plugin usage: it's no longer needed

* Enable `resValues` build feature for the modules that have resources in custom variants like gplay, debug, etc.

Otherwise this now fails saying the resources are there but the feature is disabled

* Remove `retrofit` dependency from `:features:call:impl`

It wasn't in use and the build was failing

* Update kotlin to v2.4.0

* Update plugin paparazzi to v2.0.0-alpha05

* Update gradle wrapper to 9.5.1

./gradlew wrapper --gradle-version 9.5.1 --gradle-distribution-sha256-sum bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f

* Update com.android.tools.build:gradle to 9.2.1

* Update plugin sonarqube to v7.3.1.8318

* Kotlin 2.4.0

* Context parameters are enabled by default in Kotlin 2.4.0

* Fix code issue

* Fix record screenshot issue

* Workaround for https://github.com/cashapp/paparazzi/issues/2342

* Workaround for another issue with Paparazzi

* Remove unused import

* Update screenshots

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: Benoit Marty <benoitm@element.io>
Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
renovate[bot]
2026-06-11 09:51:47 +02:00
committed by GitHub
parent 37fed3e8fe
commit f0a6cba6db
165 changed files with 464 additions and 365 deletions
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package ui
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
/**
* Workaround for Paparazzi 2.0.0-alpha05 / LayoutLib 16.2.1 bug where
* HandlerThread_Delegate calls Thread.setPosixNicenessInternal which doesn't exist on JVM.
* Tracked in https://github.com/cashapp/paparazzi/issues/2342 — fixed in layoutlib 16.2.3.
* Remove this workaround once Paparazzi ships with layoutlib >= 16.2.3.
*
* Paparazzi's PaparazziLogger collects background thread errors and re-throws them via
* assertNoErrors(). This Statement wrapper catches the known NoSuchMethodError so the test
* can pass despite the LayoutLib bug.
*/
class LayoutLibErrorFilterStatement : TestRule {
override fun apply(base: Statement, description: Description): Statement {
return object : Statement() {
@Throws(Throwable::class)
override fun evaluate() {
try {
base.evaluate()
} catch (e: NoSuchMethodError) {
if (e.message?.contains("setPosixNicenessInternal") != true) throw e
} catch (npe: NullPointerException) {
// Also catch this error on `HorizontalFloatingToolbarPreview` and `HorizontalFloatingToolbarNoFabPreview`
if (npe.message?.contains("""Cannot invoke "java.util.ArrayList.size()" because "childrenList" is null""") != true) throw npe
}
}
}
}
}
@@ -29,7 +29,10 @@ class PreviewA11yTest(
@TestParameter(valuesProvider = ComposableA11yPreviewProvider::class)
val preview: ComposablePreview<AndroidPreviewInfo>,
) {
@get:Rule
@get:Rule(order = 0)
val layoutLibErrorFilterStatement = LayoutLibErrorFilterStatement()
@get:Rule(order = 1)
val paparazziRule = PaparazziPreviewRule.createFor(
preview = preview,
locale = "en",
@@ -28,7 +28,10 @@ class PreviewShard1Test(
@TestParameter(valuesProvider = Shard1ComposablePreviewProvider::class)
val preview: ComposablePreview<AndroidPreviewInfo>,
) {
@get:Rule
@get:Rule(order = 0)
val layoutLibErrorFilterStatement = LayoutLibErrorFilterStatement()
@get:Rule(order = 1)
val paparazziRule = PaparazziPreviewRule.createFor(preview, locale = "en")
@Test
@@ -28,7 +28,10 @@ class PreviewShard2Test(
@TestParameter(valuesProvider = Shard2ComposablePreviewProvider::class)
val preview: ComposablePreview<AndroidPreviewInfo>,
) {
@get:Rule
@get:Rule(order = 0)
val layoutLibErrorFilterStatement = LayoutLibErrorFilterStatement()
@get:Rule(order = 1)
val paparazziRule = PaparazziPreviewRule.createFor(preview, locale = "en")
@Test
@@ -28,7 +28,10 @@ class PreviewShard3Test(
@TestParameter(valuesProvider = Shard3ComposablePreviewProvider::class)
val preview: ComposablePreview<AndroidPreviewInfo>,
) {
@get:Rule
@get:Rule(order = 0)
val layoutLibErrorFilterStatement = LayoutLibErrorFilterStatement()
@get:Rule(order = 1)
val paparazziRule = PaparazziPreviewRule.createFor(preview, locale = "en")
@Test
@@ -28,7 +28,10 @@ class PreviewShard4Test(
@TestParameter(valuesProvider = Shard4ComposablePreviewProvider::class)
val preview: ComposablePreview<AndroidPreviewInfo>,
) {
@get:Rule
@get:Rule(order = 0)
val layoutLibErrorFilterStatement = LayoutLibErrorFilterStatement()
@get:Rule(order = 1)
val paparazziRule = PaparazziPreviewRule.createFor(preview, locale = "en")
@Test

Some files were not shown because too many files have changed in this diff Show More