Skip to content

Commit 131ff2f

Browse files
authored
Merge pull request #14939 from woocommerce/remove-unused-dependencies-from-woocommerce
Ignore false positives in the unused dependencies report
2 parents 6886036 + 9a3ce41 commit 131ff2f

File tree

6 files changed

+61
-2
lines changed

6 files changed

+61
-2
lines changed

WooCommerce-Wear/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,16 @@ static def loadPropertiesFromFile(inputFile) {
219219
}
220220
return properties
221221
}
222+
223+
dependencyAnalysis {
224+
issues {
225+
onUnusedDependencies {
226+
// This dependency is actually needed otherwise the app will crash with a runtime exception.
227+
exclude(libs.androidx.hilt.navigation.compose.get().module.toString())
228+
// This dependency is actually needed otherwise the app will crash with a runtime exception.
229+
exclude(libs.androidx.preference.ktx.get().module.toString())
230+
// This dependency is actually needed otherwise the app will crash with a runtime exception.
231+
exclude(libs.androidx.work.runtime.ktx.get().module.toString())
232+
}
233+
}
234+
}

WooCommerce/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,4 +514,19 @@ def isLeakCanaryEnabled() {
514514
return developerProperties.get("enable_leak_canary") ?: true
515515
}
516516

517+
dependencyAnalysis {
518+
issues {
519+
onUnusedDependencies {
520+
// This dependency is actually needed otherwise UI tests will crash with a runtime exception.
521+
exclude(libs.apache.http.client.android.get().module.toString())
522+
// This dependency is actually needed otherwise it will cause the app to fail to build.
523+
exclude(libs.androidx.hilt.navigation.compose.get().module.toString())
524+
// This dependency is actually needed otherwise it will cause the app to fail to build.
525+
exclude(libs.androidx.work.runtime.ktx.get().module.toString())
526+
// This dependency is actually needed otherwise it will cause the app to fail to build.
527+
exclude(libs.google.protobuf.kotlinlite.get().module.toString())
528+
}
529+
}
530+
}
531+
517532
apply from: '../config/gradle/build_optimization.gradle'

libs/apifaker/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,14 @@ dependencies {
5656
testImplementation(libs.mockito.kotlin)
5757
testImplementation(libs.kotlinx.coroutines.test)
5858
}
59+
60+
dependencyAnalysis {
61+
issues {
62+
onUnusedDependencies {
63+
// This dependency is actually needed otherwise the app will crash with a runtime exception.
64+
exclude(libs.androidx.compose.material.icons.extended.get().module.toString())
65+
// This dependency is actually needed otherwise the app will crash with a runtime exception.
66+
exclude(libs.androidx.hilt.navigation.compose.get().module.toString())
67+
}
68+
}
69+
}

libs/fluxc-plugin/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,12 @@ dependencies {
103103
androidTestImplementation libs.androidx.test.ext.junit
104104
androidTestImplementation libs.assertj.core
105105
}
106+
107+
dependencyAnalysis {
108+
issues {
109+
onUnusedDependencies {
110+
// This dependency is actually needed otherwise it will cause the app to fail to build.
111+
exclude(libs.androidx.core.ktx.get().module.toString())
112+
}
113+
}
114+
}

libs/fluxc-tests/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,12 @@ dependencies {
5050
testImplementation libs.androidx.arch.core.testing
5151
testImplementation libs.androidx.paging.runtime
5252
}
53+
54+
dependencyAnalysis {
55+
issues {
56+
onUnusedDependencies {
57+
// This dependency is actually needed; otherwise, tests fail.
58+
exclude(libs.androidx.paging.runtime.get().module.toString())
59+
}
60+
}
61+
}

libs/fluxc/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ tasks.withType(KotlinCompile).configureEach {
123123
dependencyAnalysis {
124124
issues {
125125
onUnusedDependencies {
126-
// This dependency is actually needed otherwise the app will crash with a runtime exception.
126+
// This dependency is actually needed; otherwise, the app will crash with a runtime exception.
127127
exclude(libs.eventbus.android.get().module.toString())
128-
// This dependency is actually needed otherwise UI tests will crash with a runtime exception.
128+
// This dependency is actually needed; otherwise, UI tests will crash with a runtime exception.
129129
exclude(libs.apache.http.client.android.get().module.toString())
130+
// This dependency is actually needed; otherwise, NoClassDefFoundError will be thrown during card reader connection flow.
131+
exclude(libs.squareup.okhttp3.tls.get().module.toString())
130132
}
131133
}
132134
}

0 commit comments

Comments
 (0)