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

Add Dependency Analysis Gradle Plugin #2811

Merged
merged 4 commits into from
May 14, 2024
Merged

Conversation

rvandermeulen
Copy link
Contributor

This patch:

  • Adds the Dependency Analysis Gradle Plugin to our Gradle setup
  • Creates a new linter job in Taskcluster that will fail on any new issues, ensuring we stay up to date down the road
  • Cleans up the existing issues found (initial report shown below).

Sample output:

Advice for :app
Unused dependencies which should be removed:
  androidTestImplementation libs.espresso.contrib
  androidTestImplementation libs.espresso.web
  androidTestImplementation libs.junit.ktx
  implementation libs.androidx.activity.compose
  implementation libs.mozilla.concept.tabstray
  implementation libs.mozilla.support.images
  implementation libs.mozilla.ui.autocomplete
  implementation libs.thirdparty.sentry

These transitive dependencies should be declared directly:
  androidTestImplementation 'androidx.test:monitor:1.6.1'
  androidTestImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
  androidTestImplementation 'com.squareup.okio:okio:3.4.0'
  androidTestImplementation 'junit:junit:4.13.2'
  androidTestImplementation 'org.hamcrest:hamcrest:2.2'
  implementation 'androidx.activity:activity:1.7.2'
  implementation 'androidx.annotation:annotation:1.7.1'
  implementation 'androidx.browser:browser:1.8.0'
  implementation 'androidx.cardview:cardview:1.0.0'
  implementation 'androidx.compose.runtime:runtime:1.6.6'
  implementation 'androidx.compose.ui:ui-graphics:1.6.6'
  implementation 'androidx.compose.ui:ui-text:1.6.6'
  implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
  implementation 'androidx.fragment:fragment:1.6.2'
  implementation 'androidx.lifecycle:lifecycle-common:2.7.0'
  implementation 'androidx.lifecycle:lifecycle-viewmodel:2.7.0'
  implementation 'androidx.recyclerview:recyclerview:1.3.2'
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0'
  implementation 'org.mozilla.appservices.nightly:fxaclient:127.20240427050414'
  implementation 'org.mozilla.components:browser-errorpages:127.0.20240427215438'
  implementation 'org.mozilla.components:concept-base:127.0.20240427215438'
  implementation 'org.mozilla.components:concept-fetch:127.0.20240427215438'
  implementation 'org.mozilla.components:lib-state:127.0.20240427215438'
  implementation 'org.mozilla.components:support-base:127.0.20240427215438'
  implementation 'org.mozilla.geckoview:geckoview-nightly-omni:127.0.20240427215438'

Existing dependencies which should be modified to be as indicated:
  implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.23' (was api)

Dependencies which should be removed or changed to runtime-only:
  runtimeOnly libs.kotlinx.coroutines.android (was implementation)

Obviously I would like to extend this to other projects eventually, probably A-S and Glean next since they should be pretty easy. For mozilla-central, it'll probably go hand in hand with an eventual migration to a version catalog as we might as well get all the churn out of the way in one shot.

To run it locally, you just need to use ./gradlew buildHealth.

@rvandermeulen rvandermeulen requested a review from a team as a code owner May 2, 2024 21:05
@rvandermeulen rvandermeulen requested review from ahal and removed request for a team May 2, 2024 21:05
Copy link
Contributor

@mcarare mcarare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job!

@rvandermeulen rvandermeulen force-pushed the rvm-dependency-analysis branch 3 times, most recently from cc3b6f8 to 021e86f Compare May 8, 2024 17:48
@rvandermeulen
Copy link
Contributor Author

I'm still trying to come up with a more elegant solution for ignoring the appservices & geckoview warnings. It's not super important for r-b since they're never going to change form from the two being explicitly listed right now, but it's going to be more annoying for central where the exact names will vary depending on channel/variant.

I've got an active thread going upstream about it now. Not necessarily a blocker to land this, but it would be nice to sort out.

@jonalmeida jonalmeida removed their request for review May 14, 2024 18:47
@jonalmeida
Copy link
Collaborator

I had shared my feedback directly with ryanvm which is already addressed.

Removing myself for now in case you want to request a re-review based on the comment above.

@rvandermeulen
Copy link
Contributor Author

I haven't heard more from upstream yet. I'm just going to roll with this for now. If I get a more elegant solution, I'll take care of it in a follow-up PR.

@rvandermeulen rvandermeulen added the needs landing Auto lands approved and green PRs. label May 14, 2024
@mergify mergify bot merged commit f089361 into master May 14, 2024
19 checks passed
@rvandermeulen rvandermeulen deleted the rvm-dependency-analysis branch May 14, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs landing Auto lands approved and green PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants