From ef33a1a05d8631cb4b2820dec706342047043f7d Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 Oct 2025 09:40:48 +0200 Subject: [PATCH 1/8] Remove unused dependencies and update dependency scopes in build.gradle --- WooCommerce-Wear/build.gradle | 16 +++------------- WooCommerce/build.gradle | 12 +++++------- libs/apifaker/build.gradle | 6 ++---- libs/cardreader/build.gradle | 6 +++--- libs/fluxc-plugin/build.gradle | 19 +++++++++++-------- libs/fluxc/build.gradle | 14 ++++++-------- libs/login/build.gradle | 14 ++++++-------- 7 files changed, 36 insertions(+), 51 deletions(-) diff --git a/WooCommerce-Wear/build.gradle b/WooCommerce-Wear/build.gradle index 21e8115aaff6..901d087be738 100644 --- a/WooCommerce-Wear/build.gradle +++ b/WooCommerce-Wear/build.gradle @@ -135,15 +135,10 @@ dependencies { exclude group: "com.mcxiaoke.volley" exclude group: "com.android.support" } - implementation(libs.automattic.tracks.android) implementation(libs.automattic.tracks.crashlogging) // WearOS implementation(libs.google.play.services.wearable) - implementation(libs.androidx.wear.tiles.main) - implementation(libs.androidx.wear.tiles.material) - implementation(libs.google.horologist.compose.tools) - implementation(libs.google.horologist.tiles) implementation(libs.google.horologist.compose.layout) implementation(libs.androidx.wear.watchface.complications.data.source.ktx) implementation(libs.androidx.wear.compose.material) @@ -162,32 +157,27 @@ dependencies { implementation(libs.androidx.compose.ui.text.google.fonts) // Android Support - implementation(libs.androidx.work.runtime.ktx) implementation(libs.androidx.lifecycle.viewmodel.savedstate) - implementation(libs.androidx.lifecycle.livedata.ktx) implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.navigation.compose) implementation(libs.androidx.activity.compose) implementation(libs.androidx.preference.ktx) implementation(libs.androidx.datastore.preferences) - implementation(libs.androidx.datastore.main) implementation(libs.google.gson) // Coroutines implementation(libs.kotlinx.coroutines.core) - implementation(libs.kotlinx.coroutines.android) + runtimeOnly(libs.kotlinx.coroutines.android) implementation(libs.kotlinx.coroutines.play.services) testImplementation(libs.kotlinx.coroutines.test) // Dagger & Hilt implementation(libs.google.dagger.hilt.android.main) - implementation(libs.androidx.hilt.navigation.fragment) - implementation(libs.androidx.hilt.common) - implementation(libs.androidx.hilt.work) implementation(libs.androidx.hilt.navigation.compose) + compileOnly(libs.androidx.hilt.common) + implementation(libs.androidx.hilt.work) ksp(libs.androidx.hilt.compiler) ksp(libs.google.dagger.hilt.compiler) - implementation(libs.google.dagger.android.support) ksp(libs.google.dagger.android.processor) // Testing diff --git a/WooCommerce/build.gradle b/WooCommerce/build.gradle index 541e27804d1d..4d341670529b 100644 --- a/WooCommerce/build.gradle +++ b/WooCommerce/build.gradle @@ -281,12 +281,11 @@ dependencies { // Dagger implementation(libs.google.dagger.hilt.android.main) implementation(libs.androidx.hilt.navigation.fragment) - implementation(libs.androidx.hilt.common) + compileOnly(libs.androidx.hilt.common) implementation(libs.androidx.hilt.work) ksp(libs.androidx.hilt.compiler) ksp(libs.google.dagger.hilt.compiler) - implementation(libs.google.dagger.android.support) ksp(libs.google.dagger.android.processor) implementation(libs.mpandroidchart) @@ -294,7 +293,6 @@ dependencies { implementation(libs.bumptech.glide.main) ksp(libs.bumptech.glide.compiler) implementation(libs.bumptech.glide.volley.integration) - implementation(libs.bumptech.glide.avif.integration) implementation(libs.google.play.app.update) implementation(libs.google.play.review) @@ -376,7 +374,6 @@ dependencies { because("version shipped with WireMock 2.26.3 contains security vulnerabilities") } } - androidTestImplementation(libs.apache.http.client.android) implementation(libs.zendesk.support) { exclude group: 'com.android.support', module: 'support-annotations' @@ -386,10 +383,11 @@ dependencies { implementation(libs.androidx.fragment.ktx) implementation(libs.androidx.lifecycle.viewmodel.savedstate) implementation(libs.androidx.lifecycle.process) + implementation(libs.androidx.paging.runtime) // Coroutines implementation(libs.kotlinx.coroutines.core) - implementation(libs.kotlinx.coroutines.android) + runtimeOnly(libs.kotlinx.coroutines.android) implementation(libs.kotlinx.coroutines.play.services) testImplementation(libs.kotlinx.coroutines.test) @@ -425,7 +423,7 @@ dependencies { implementation(libs.coil.svg) androidTestImplementation(libs.androidx.compose.ui.test.junit4) - debugImplementation(libs.androidx.compose.ui.test.manifest) + debugRuntimeOnly(libs.androidx.compose.ui.test.manifest) coreLibraryDesugaring(libs.android.desugar) @@ -433,7 +431,7 @@ dependencies { implementation(libs.lottie.compose) // CameraX - implementation(libs.androidx.camera.camera2) + runtimeOnly(libs.androidx.camera.camera2) implementation(libs.androidx.camera.lifecycle) implementation(libs.androidx.camera.view) diff --git a/libs/apifaker/build.gradle b/libs/apifaker/build.gradle index f51745358094..2574adf96113 100644 --- a/libs/apifaker/build.gradle +++ b/libs/apifaker/build.gradle @@ -36,18 +36,16 @@ dependencies { implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.compose.material.main) - implementation(libs.androidx.compose.runtime.livedata) - implementation(libs.androidx.compose.ui.tooling.preview) implementation(libs.androidx.compose.material.icons.extended) + implementation(libs.androidx.compose.ui.tooling.preview) debugImplementation(libs.androidx.compose.ui.tooling.main) - implementation(libs.google.gson) + api(libs.google.gson) implementation(project(":libs:fluxc")) implementation(project(":libs:fluxc-plugin")) implementation(libs.androidx.room.runtime) - implementation(libs.androidx.room.ktx) ksp(libs.androidx.room.compiler) implementation(libs.google.dagger.hilt.android.main) diff --git a/libs/cardreader/build.gradle b/libs/cardreader/build.gradle index ad42c0e416c3..fbc61d0f8398 100644 --- a/libs/cardreader/build.gradle +++ b/libs/cardreader/build.gradle @@ -28,15 +28,15 @@ android { } dependencies { - implementation(libs.stripe.terminal.taptopay) + runtimeOnly(libs.stripe.terminal.taptopay) implementation(libs.stripe.terminal.core) // Coroutines implementation(libs.kotlinx.coroutines.core) - implementation(libs.kotlinx.coroutines.android) + runtimeOnly(libs.kotlinx.coroutines.android) testImplementation(libs.mockito.kotlin) - testImplementation(libs.kotlin.test.junit) + testRuntimeOnly(libs.kotlin.test.junit) testImplementation(libs.assertj.core) testImplementation(libs.kotlinx.coroutines.test) } diff --git a/libs/fluxc-plugin/build.gradle b/libs/fluxc-plugin/build.gradle index be69facf011f..46351832243f 100644 --- a/libs/fluxc-plugin/build.gradle +++ b/libs/fluxc-plugin/build.gradle @@ -47,7 +47,7 @@ tasks.withType(KotlinCompile).configureEach { } dependencies { - implementation project(":libs:fluxc") + api project(":libs:fluxc") testFixturesCompileOnly project(":libs:fluxc") testFixturesCompileOnly libs.mockito.kotlin @@ -57,6 +57,8 @@ dependencies { testFixturesCompileOnly libs.wordpress.utils testFixturesCompileOnly libs.assertj.core testFixturesCompileOnly libs.junit + testFixturesCompileOnly libs.kotlinx.coroutines.core + testFixturesCompileOnly libs.androidx.room.runtime // WordPress libs implementation(libs.wordpress.utils) { @@ -65,27 +67,28 @@ dependencies { exclude group: "com.android.support" } - api libs.wellsql + implementation libs.androidx.core.ktx + + implementation libs.wellsql kapt libs.wellsql.processor // FluxC annotations api project(":libs:fluxc-annotations") kapt project(":libs:fluxc-processor") - implementation libs.google.gson + api libs.google.gson // Dagger - implementation libs.google.dagger + api libs.google.dagger ksp libs.google.dagger.compiler compileOnly libs.glassfish.javax.annotation // Coroutines implementation libs.kotlinx.coroutines.core - implementation libs.kotlinx.coroutines.android + runtimeOnly libs.kotlinx.coroutines.android implementation libs.androidx.room.runtime ksp libs.androidx.room.compiler - api libs.androidx.room.ktx testImplementation libs.junit testImplementation libs.robolectric @@ -93,10 +96,10 @@ dependencies { testImplementation libs.assertj.core testImplementation libs.mockito.kotlin testImplementation libs.kotlinx.coroutines.test - testImplementation libs.kotlin.test.junit + testRuntimeOnly libs.kotlin.test.junit androidTestImplementation libs.androidx.room.testing - androidTestImplementation libs.androidx.test.main.runner + androidTestRuntimeOnly libs.androidx.test.main.runner androidTestImplementation libs.androidx.test.ext.junit androidTestImplementation libs.assertj.core } diff --git a/libs/fluxc/build.gradle b/libs/fluxc/build.gradle index 1a5c03ddc909..1cbff4075d43 100644 --- a/libs/fluxc/build.gradle +++ b/libs/fluxc/build.gradle @@ -88,32 +88,30 @@ dependencies { implementation libs.squareup.okhttp3.urlconnection implementation libs.squareup.okhttp3.tls api libs.volley - implementation libs.google.gson + api libs.google.gson implementation libs.apache.commons.text - api libs.androidx.paging.runtime + implementation libs.androidx.paging.runtime implementation libs.androidx.room.runtime ksp libs.androidx.room.compiler - implementation libs.androidx.room.ktx // Dagger - implementation libs.google.dagger + api libs.google.dagger ksp libs.google.dagger.compiler compileOnly libs.glassfish.javax.annotation // Coroutines implementation libs.kotlinx.coroutines.core - implementation libs.kotlinx.coroutines.android + runtimeOnly libs.kotlinx.coroutines.android // Unit tests testImplementation libs.junit - testImplementation libs.kotlin.test.junit + testRuntimeOnly libs.kotlin.test.junit testImplementation libs.kotlinx.coroutines.test - testImplementation libs.androidx.test.main.core + testRuntimeOnly libs.androidx.test.main.core testImplementation libs.robolectric testImplementation libs.mockito.kotlin testImplementation libs.assertj.core - testImplementation libs.androidx.arch.core.testing } tasks.withType(KotlinCompile).configureEach { diff --git a/libs/login/build.gradle b/libs/login/build.gradle index fecb584116db..c77bbe08d1f4 100644 --- a/libs/login/build.gradle +++ b/libs/login/build.gradle @@ -35,30 +35,28 @@ android { } dependencies { - implementation libs.wordpress.utils + api libs.wordpress.utils implementation libs.gravatar - implementation libs.androidx.appcompat + api libs.androidx.appcompat implementation libs.androidx.constraintlayout.main implementation libs.google.material - implementation libs.androidx.core.ktx - api libs.google.play.services.auth - implementation project(":libs:fluxc") + api project(":libs:fluxc") implementation libs.bumptech.glide.main ksp libs.bumptech.glide.ksp implementation libs.androidx.credentials.main - implementation libs.androidx.credentials.play.service.auth + runtimeOnly libs.androidx.credentials.play.service.auth // Dagger - implementation libs.google.dagger + api libs.google.dagger ksp libs.google.dagger.compiler - implementation libs.google.dagger.android.support + api libs.google.dagger.android.support ksp libs.google.dagger.android.processor testImplementation libs.junit From a12cfb35dbde8d367e8c26bbf7b75325233c9037 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 Oct 2025 09:43:31 +0200 Subject: [PATCH 2/8] Updated release notes --- RELEASE-NOTES.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index a6aa9040323d..75d06dc62171 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -3,7 +3,8 @@ *** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too. 23.5 ----- - +- [Internal][Wear] Remove unused dependencies and optimize dependency scopes [https://github.com/woocommerce/woocommerce-android/pull/14710] +- [Internal] Remove unused dependencies and optimize dependency scopes [https://github.com/woocommerce/woocommerce-android/pull/14710] 23.4 ----- From fab939398c846597235f5f53ca10f8bb1ab55b0d Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 Oct 2025 10:00:47 +0200 Subject: [PATCH 3/8] Add missing test dependencies to cardreader module --- libs/cardreader/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/cardreader/build.gradle b/libs/cardreader/build.gradle index fbc61d0f8398..f491cc951f80 100644 --- a/libs/cardreader/build.gradle +++ b/libs/cardreader/build.gradle @@ -35,8 +35,9 @@ dependencies { implementation(libs.kotlinx.coroutines.core) runtimeOnly(libs.kotlinx.coroutines.android) + testImplementation(libs.junit) testImplementation(libs.mockito.kotlin) - testRuntimeOnly(libs.kotlin.test.junit) + testImplementation(libs.kotlin.test.junit) testImplementation(libs.assertj.core) testImplementation(libs.kotlinx.coroutines.test) } From f614533c48ce7713fb3d5a800944f4cb16d41168 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 7 Oct 2025 15:34:05 +0200 Subject: [PATCH 4/8] Add androidx.paging.runtime as a test dependency in build.gradle --- libs/fluxc-tests/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/fluxc-tests/build.gradle b/libs/fluxc-tests/build.gradle index 8a4027fe8ced..9242c03b8948 100644 --- a/libs/fluxc-tests/build.gradle +++ b/libs/fluxc-tests/build.gradle @@ -48,4 +48,5 @@ dependencies { testImplementation libs.mockito.kotlin testImplementation libs.assertj.core testImplementation libs.androidx.arch.core.testing + testImplementation libs.androidx.paging.runtime } From a76a0db1b223c70c66cb2922837b0bda5fb170e7 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 8 Oct 2025 10:00:34 +0200 Subject: [PATCH 5/8] Add back androidx.work.runtime.ktx dependency for Wear app --- WooCommerce-Wear/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/WooCommerce-Wear/build.gradle b/WooCommerce-Wear/build.gradle index 901d087be738..c068bfd69b76 100644 --- a/WooCommerce-Wear/build.gradle +++ b/WooCommerce-Wear/build.gradle @@ -157,6 +157,7 @@ dependencies { implementation(libs.androidx.compose.ui.text.google.fonts) // Android Support + implementation(libs.androidx.work.runtime.ktx) implementation(libs.androidx.lifecycle.viewmodel.savedstate) implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.navigation.compose) From 2b65d3eb9f53714274293a94fd49a50ed185e428 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 8 Oct 2025 10:22:10 +0200 Subject: [PATCH 6/8] Restore kotlin.test.junit as testImplementation for tests --- libs/fluxc-plugin/build.gradle | 2 +- libs/fluxc/build.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/fluxc-plugin/build.gradle b/libs/fluxc-plugin/build.gradle index 46351832243f..76d76472b769 100644 --- a/libs/fluxc-plugin/build.gradle +++ b/libs/fluxc-plugin/build.gradle @@ -96,7 +96,7 @@ dependencies { testImplementation libs.assertj.core testImplementation libs.mockito.kotlin testImplementation libs.kotlinx.coroutines.test - testRuntimeOnly libs.kotlin.test.junit + testImplementation libs.kotlin.test.junit androidTestImplementation libs.androidx.room.testing androidTestRuntimeOnly libs.androidx.test.main.runner diff --git a/libs/fluxc/build.gradle b/libs/fluxc/build.gradle index 1cbff4075d43..ea7593498ef7 100644 --- a/libs/fluxc/build.gradle +++ b/libs/fluxc/build.gradle @@ -106,9 +106,9 @@ dependencies { // Unit tests testImplementation libs.junit - testRuntimeOnly libs.kotlin.test.junit + testImplementation libs.kotlin.test.junit testImplementation libs.kotlinx.coroutines.test - testRuntimeOnly libs.androidx.test.main.core + testImplementation libs.androidx.test.main.core testImplementation libs.robolectric testImplementation libs.mockito.kotlin testImplementation libs.assertj.core From e4adc12d21d7f2a7c5d717977e264b710e6c8375 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 8 Oct 2025 15:31:16 +0200 Subject: [PATCH 7/8] Add apache.http.client.android as a test dependency in build.gradle --- WooCommerce/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WooCommerce/build.gradle b/WooCommerce/build.gradle index 4d341670529b..cae09a092500 100644 --- a/WooCommerce/build.gradle +++ b/WooCommerce/build.gradle @@ -343,11 +343,11 @@ dependencies { // Dependencies for screenshots androidTestImplementation(libs.fastlane.screengrab) androidTestImplementation(libs.wiremock.get().module.toString()) { - exclude group: 'org.apache.httpcomponents', module: 'httpclient' exclude group: 'org.apache.commons', module: 'commons-lang3' exclude group: 'asm', module: 'asm' exclude group: 'org.json', module: 'json' } + androidTestImplementation(libs.apache.http.client.android) constraints { androidTestImplementation(libs.wiremock) { because("newer versions of WireMock use Java APIs not available on Android") From dea9586fffab4f7384f12b22da161896679bced3 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 9 Oct 2025 15:33:27 +0200 Subject: [PATCH 8/8] Remove unused httpclient dependency from androidTestImplementation --- WooCommerce/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/WooCommerce/build.gradle b/WooCommerce/build.gradle index cae09a092500..2284aa8ab2ad 100644 --- a/WooCommerce/build.gradle +++ b/WooCommerce/build.gradle @@ -343,6 +343,7 @@ dependencies { // Dependencies for screenshots androidTestImplementation(libs.fastlane.screengrab) androidTestImplementation(libs.wiremock.get().module.toString()) { + exclude group: 'org.apache.httpcomponents', module: 'httpclient' exclude group: 'org.apache.commons', module: 'commons-lang3' exclude group: 'asm', module: 'asm' exclude group: 'org.json', module: 'json'