-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dependency Analysis] Remove Unused Dependencies #1090
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Release Notes: https://github.com/autonomousapps/ dependency-analysis-gradle-plugin/blob/main/CHANGELOG.md#version-1330
These unused dependencies got added to this module via this (56a0534) commit, which amongst other changes, moved the media placeholders into it's own module. However, these dependencies never got to be used and as such can be safely removed. ------------------------------------------------------------------------ This removal was suggested by the dependency analysis report, see below: Advice for :app Unused dependencies which should be removed: implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' ... Dependencies which should be removed or changed to runtime-only: runtimeOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' (was implementation)
These 'unused' related advises for the 'app' module is actually correct, both 'media-placeholders' and ':picasso-loader', can be removed as dependencies since they are actually unused and not being utilized from within the app. However, I chose to keep them there and suppress the advise instead in order to preserve the app default configuration, its purpose being to test all those individual modules: - aztec - glide-loader - picasso-loader - wordpress-comments - wordpress-shortcodes - media-placeholders As such this advice is instead suppressed and the 'onUnusedDependencies' exclusion configuration were used to achieve that. ------------------------------------------------------------------------ Advice for :app Unused dependencies which should be removed: implementation project(':media-placeholders') implementation project(':picasso-loader')
It is unclear why any 'androidTest' related dependency got added to this module, as one can only navigate to this (ad68cc9) commit and see that this was done as part of the AndroidX migration, but, without any 'androidTest' source set folder included on this module, nor any accompanying UI tests added to it. ------------------------------------------------------------------------ This removal was suggested by the dependency analysis report, see below: Advice for :aztec Unused dependencies which should be removed: androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test:runner:1.2.0' ... Dependencies which should be removed or changed to runtime-only: androidTestRuntimeOnly 'androidx.test:core:1.4.0' (was androidTestImplementation) ...
Although removing the 'androidx.legacy.support.v4' is enough by itself and the build is (almost) not failing, it is better to also replace that with 'androidx.collection' due to this 'androidx.collection.ArrayMap' import on 'AztecQuoteSpan'. FYI: It got introduced as part of this (ad68cc9) commit, a part of the AndroidX migration. PS: To make sure that the build is not failing the only instance of 'androidx.legacy', the '<androidx.legacy.widget.Space/>' got replaced with '<Space/>' on the 'aztec_format_bar_advanced.xml' view. ------------------------------------------------------------------------ This replacement was suggested by the dependency analysis report, see below: Advice for :aztec Unused dependencies which should be removed: implementation 'androidx.legacy:legacy-support-v4:1.0.0' These transitive dependencies should be declared directly: ... implementation 'androidx.collection:collection:1.1.0' ... implementation 'androidx.legacy:legacy-support-core-ui:1.0.0' ...
This 'unused' related advise for the 'media-placeholders' module is actually incorrect as the build is failing when the 'appcompat' dependency is removed. This is happening due to the fact that 'aztec' has classes like 'AztecText', which is being used on this module, but the Dependency Analysis plugin cannot understand that although there are no 'appcompat' related imports, those are actually needed nevertheless. Another dependency configuration might be able to solve this, but this was considered as being outside the scope of this change. ------------------------------------------------------------------------ Advice for :media-placeholders Unused dependencies which should be removed: implementation 'androidx.appcompat:appcompat:1.1.0'
Although removing the 'androidx.legacy.support.v4' is enough by itself and the build is not failing, it is better to also replace that with 'androidx.collection' due to this 'androidx.collection.ArrayMap' import on 'PicassoImageLoader'. FYI: It got introduced as part of this (ad68cc9) commit, a part of the AndroidX migration. ------------------------------------------------------------------------ This replacement was suggested by the dependency analysis report, see below: Advice for :picasso-loader Unused dependencies which should be removed: implementation 'androidx.legacy:legacy-support-v4:1.0.0' ... These transitive dependencies should be declared directly: implementation 'androidx.collection:collection:1.1.0'
Removing the 'android.material' dependency wasn't enough by itself as the build was then failing. Adding the transient 'androidx.appcompat' dependency was actually required in order to make the build successful again. Then, and just like it was done on this (7db2a43) change, the seemingly unused 'androidx.appcompat' dependency advise got suppressed as well. ------------------------------------------------------------------------ This replacement was suggested by the dependency analysis report, see below: Advice for :picasso-loader Unused dependencies which should be removed: implementation 'com.google.android.material:material:1.2.1'
This dependency is completely unused. FYI: It got introduced as part of this (ad68cc9) commit, a part of the AndroidX migration. ------------------------------------------------------------------------ This removal was suggested by the dependency analysis report, see below: Advice for :wordpress-comments Unused dependencies which should be removed: implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Removing the 'android.material' dependency wasn't enough by itself as the build was then failing. Adding the transient 'androidx.appcompat' dependency was actually required in order to make the build successful again. Then, and just like it was done on this (7db2a43) change, the seemingly unused 'androidx.appcompat' dependency advise got suppressed as well. ------------------------------------------------------------------------ This replacement was suggested by the dependency analysis report, see below: Advice for :wordpress-comments Unused dependencies which should be removed: implementation 'com.google.android.material:material:1.2.1'
This 'unused' related advise for the 'wordpress-shortcodes' module is actually incorrect as the build is failing when the 'appcompat' dependency is removed. Just like it was done on this (7db2a43) change, the seemingly unused 'androidx.appcompat' dependency advise got suppressed as well. ------------------------------------------------------------------------ Advice for :wordpress-shortcodes Unused dependencies which should be removed: implementation 'androidx.appcompat:appcompat:1.1.0'
wzieba
approved these changes
Aug 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Project Thread: paaHJt-6YV-p2
Description
Based on the
unused
related advises generated by the Dependency Analysis Gradle plugin, this PR removes all unused dependencies from this project.FYI: As part of this change, the Dependency Analysis Gradle plugin got also updated to its latest 1.33.0 version.
Testing Steps
./gradlew buildHealth
task and verify that there is nounused
related advise remaining within both reports, JSON and txt included:build-health-report.json
-> Search forunusedCount
build-health-report.txt
-> Search forunused
Aztec
, or via composite builds, and see if it works as expected.