reference-browser icon indicating copy to clipboard operation
reference-browser copied to clipboard

Add Dependency Analysis Gradle Plugin

Open rvandermeulen opened this issue 1 year ago • 0 comments

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 avatar May 02 '24 21:05 rvandermeulen