Skip to content
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 #151

Merged
merged 7 commits into from
Aug 14, 2024

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Aug 13, 2024

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

  1. Tooling:
    • Run the ./gradlew buildHealth task and verify that there is no unused related advise remaining within both reports, JSON and txt included:
      • build-health-report.json -> Search for unusedCount
      • build-health-report.txt -> Search for unused
    • Check the manually triggered scheduled build and verify that everything works as expected with this newer version of the Dependency Analysis Gradle plugin (1.33.0).
  2. Testing:
    • Quickly smoke test, either the JP/WPAndroid and/or WCAndroid, with this version of Utils, or via composite builds, and see if it works as expected.

Release Notes: https://github.com/autonomousapps/
dependency-analysis-gradle-plugin/blob/main/CHANGELOG.md#version-1330
This 'androidTest' related dependency got added to this project via this
(6c80419) commit, but it is unclear
why at this point.

------------------------------------------------------------------------

This removal was suggested by the dependency analysis report, see below:

Advice for :WordPressUtils
Unused dependencies which should be removed:
  androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  ...
This 'androidTest' related dependency got added to this project via this
(6c80419) commit, but it is unclear
why at this point.

------------------------------------------------------------------------

This removal was suggested by the dependency analysis report, see below:

Advice for :WordPressUtils
Unused dependencies which should be removed:
  androidTestImplementation 'androidx.test:rules:1.4.0'
  ...
Removing the 'androidx.core.ktx' dependency wasn't enough by itself as
the dependency graph got updated with dependencies pointing to other
versions. Adding the transient 'androidx.core:core' dependency was
actually necessary in order to keep the dependency graph unaffected.

------------------------------------------------------------------------

This replacement was suggested by the dependency analysis report,
see below:

Advice for :WordPressUtils
Unused dependencies which should be removed:
  implementation 'androidx.core:core-ktx:1.5.0'
  ...

These transitive dependencies should be declared directly:
  ...
  api 'androidx.core:core:1.5.0'
  ...
This unused dependency got added to this project via this
(c6d4f4a7e8946175678dd5cf0a5d0660d42007c) commit, which added the
'WPImageGetter' utility to the project. However, later on, this
(d85b6db) other commit, removed this
'WPImageGetter' utility to the project, but the accompanying dependency
wasn't removed as well.

------------------------------------------------------------------------

This removal was suggested by the dependency analysis report, see below:

Advice for :WordPressUtils
Unused dependencies which should be removed:
  implementation 'com.android.volley:volley:1.2.0'
  ...
There is no point to hold a reference to 'volley' anyway in the project
and this way to make the implementation to seem to be binding to a
specific networking framework, which it isn't.
Removing the 'eventbus' dependency wasn't enough by itself as the build
was then failing. Adding the transient 'eventbus-java' dependency was
actually required in order to make the build successful again.

------------------------------------------------------------------------

This replacement was suggested by the dependency analysis report,
see below:

Unused dependencies which should be removed:
  implementation 'org.greenrobot:eventbus:3.3.1'

These transitive dependencies should be declared directly:
  ...
  implementation 'org.greenrobot:eventbus-java:3.3.1'
  ...
@ParaskP7 ParaskP7 marked this pull request as ready for review August 13, 2024 10:51
@ParaskP7 ParaskP7 requested a review from wzieba August 13, 2024 10:51
@ParaskP7 ParaskP7 merged commit 09ebdc1 into trunk Aug 14, 2024
9 checks passed
@ParaskP7 ParaskP7 deleted the build/remove-unused-dependencies branch August 14, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants