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 #153

Merged
merged 8 commits into from
Aug 14, 2024

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Aug 12, 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 Login, or via composite builds, and see if it works as expected.

Release Notes: https://github.com/JetBrains/kotlin/releases/tag/v1.9.25

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

This update isn't that necessary, but should be considered anyway as it
will do the following:
- Align this library, to that Kotlin version, which is already used by
most of this library's clients and libraries.
- Unblock the usage of the dependency analysis Gradle plugin for this
project on newer versions (1.33.0).
- Prepares this project for the Kotlin 2+ major update.

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

FYI: Without updating Kotlin to '1.9.25', when updating Dependency
Analysis to '1.33.0', and then running './gradlew assembleDebug', it
produces the below build failure:

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.jetbrains.kotlin.gradle.report.
 ConfigureReporingKt
> Exception java.lang.IncompatibleClassChangeError: Method
 'org.jetbrains.kotlin.build.report.metrics.BuildTime[]
  org.jetbrains.kotlin.build.report.metrics.BuildTime.values()' must be
  InterfaceMethodref constant [in thread "Daemon worker Thread 2"]
Release Notes: https://github.com/autonomousapps/
dependency-analysis-gradle-plugin/blob/main/CHANGELOG.md#version-1330
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 :WordPressLoginFlow
Unused dependencies which should be removed:
  implementation 'androidx.core:core-ktx:1.12.0'
  ...

These transitive dependencies should be declared directly:
  api 'androidx.core:core:1.12.0'
  ...
This dependency is completely unused.

FYI: It got introduced as part of this
(f50df67) commit, which updated the
support libs to a newer version (not sure why).

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

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

Advice for :WordPressLoginFlow
Unused dependencies which should be removed:
  implementation 'androidx.gridlayout:gridlayout:1.0.0'
  ...
This dependency is completely unused.

FYI: It got introduced as part of this
(d3dc350) commit, a part of the
AndroidX migration (not sure why).

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

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

Advice for :WordPressLoginFlow
Unused dependencies which should be removed:
  implementation 'androidx.legacy:legacy-support-v13:1.0.0'
  ...
This dependency is completely unused.

FYI: It got introduced as part of this
(f50df67 and then
d3dc350 and) commits, first an update
to the support libs to a newer version and then as part of the AndroidX
migration (not sure why).

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

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

Advice for :WordPressLoginFlow
Unused dependencies which should be removed:
  implementation 'androidx.media:media:1.2.1'
  ...
Since the 'minSdkVersion' of this project is currently on '24' this
vector drawables backward compatibility solution is no longer required.
As such, this config is unnecessary and can be now safely removed.

For more info see:
- Vector drawables backward compatibility solution (Doc):
https://developer.android.com/develop/ui/views/graphics/
vector-drawable-resources#vector-drawables-backward-solution
- androidx.vectordrawable.graphics.drawable.VectorDrawableCompat (Doc):
https://developer.android.com/reference/androidx/vectordrawable/
graphics/drawable/VectorDrawableCompat
This dependency is completely unused.

FYI: It got introduced as part of this
(f50df67) commit, which updated the
support libs to a newer version (not sure why).

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

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

Advice for :WordPressLoginFlow
Unused dependencies which should be removed:
  implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
@ParaskP7 ParaskP7 marked this pull request as ready for review August 12, 2024 15:15
@ParaskP7 ParaskP7 requested a review from wzieba August 12, 2024 15:15
@ParaskP7 ParaskP7 merged commit ac20e86 into trunk Aug 14, 2024
9 checks passed
@ParaskP7 ParaskP7 deleted the build/remove-unused-dependencies branch August 14, 2024 08:27
wzieba pushed a commit that referenced this pull request Oct 15, 2024
…endencies

[Dependency Analysis] Remove Unused Dependencies
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