Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
android gradle-plugin groovy java jvm kotlin scala
Last synced: 28 days ago
JSON representation
Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
- Host: GitHub
- URL: https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
- Owner: autonomousapps
- License: apache-2.0
- Created: 2019-10-23T19:12:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T12:00:07.000Z (5 months ago)
- Last Synced: 2024-04-20T16:41:08.292Z (5 months ago)
- Topics: android, gradle-plugin, groovy, java, jvm, kotlin, scala
- Language: Kotlin
- Homepage:
- Size: 46.5 MB
- Stars: 1,604
- Watchers: 16
- Forks: 111
- Open Issues: 109
-
Metadata Files:
- Readme: README.asciidoc
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.asciidoc
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-android - **Dependency Analysis Gradle Plugin** - Gradle plugin for Java, Kotlin, and Android projects. Provides advice for managing dependencies and other applied plugins (Navigation / Tools)
README
image::https://img.shields.io/maven-metadata/v.svg?label=release&metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Fcom%2Fautonomousapps%2Fdependency-analysis%2Fcom.autonomousapps.dependency-analysis.gradle.plugin%2Fmaven-metadata.xml[Latest version,link="https://mvnrepository.com/artifact/com.autonomousapps.dependency-analysis/com.autonomousapps.dependency-analysis.gradle.plugin"]
image::https://img.shields.io/nexus/s/com.autonomousapps/dependency-analysis-gradle-plugin?label=snapshot&server=https%3A%2F%2Foss.sonatype.org[Latest snapshot,link="https://oss.sonatype.org/#nexus-search;gav~com.autonomousapps.dependency-analysis~com.autonomousapps.dependency-analysis.gradle.plugin~~~~kw,versionexpand"]
image::https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/workflows/Main/badge.svg[Build status,link="https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/actions/workflows/push.yml?query=branch%3Amain"]== Detect unused and misused dependencies
The Dependency Analysis Gradle Plugin (DAGP, née Dependency Analysis Android Gradle Plugin) detects the following:1. Unused dependencies.
2. Used transitive dependencies (which you may want to declare directly).
3. Dependencies declared on the wrong configuration (`api` vs `implementation` vs `compileOnly`, etc.).As a side effect, the plugin can also tell you your project's ABI, and produces graphviz files representing various
views of your dependency graph, among other things. These side effects are currently mostly undocumented internal
behaviors, but they may be interesting for some advanced users.== Build health
In addition to the dependency-related advice (see above), DAGP provides other advice to help maintain your "build health." This includes the detection of:
1. Unnecessary plugins (currently only `kapt`).
2. Subprojects ("modules") that unnecessarily use the Android plugin, and could instead by "normal" JVM libraries.== Compatibilities
Please see the https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Compatibilities-&-Limitations[wiki] for information on the versions of Gradle, the Android Gradle Plugin, etc., that this plugin is compatible with.
== Add to your project and use
For detailed instructions, see
https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Adding-to-your-project[the wiki].The simplest approach is to add the following:
.root build.gradle
[source,groovy]
----
plugins {
id("com.autonomousapps.dependency-analysis") version "<>"
}
----For a quick start, just run the following:
----
./gradlew buildHealth
----You will probably see output like the following:
----
> Task :buildHealth FAILEDFAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildHealth'.
> There were dependency violations. See report at file:///path/to/project/build/reports/dependency-analysis/build-health-report.txt
----If you wish to have this (potentially very long) report printed to console, add this to your `gradle.properties` file:
.gradle.properties
[source]
----
dependency.analysis.print.build.health=true
----== More advanced usage
=== Project Health
You can also run the analysis against individual modules with the `projectHealth` task. For example:
----
./gradlew app:projectHealth
----=== Reason
You may be curious why the plugin is emitting (or not emitting) advice regarding some dependency. You can ask it why:
----
./gradlew lib:reason --id com.squareup.okio:okio:2.2.2 <1>
> Task :lib:reason----------------------------------------
You asked about the dependency 'com.squareup.okio:okio:2.2.2'.
There is no advice regarding this dependency.
----------------------------------------Shortest path from :lib to com.squareup.okio:okio:2.2.2:
:lib
\--- com.squareup.okio:okio:2.2.2Source: main
------------
* Exposes class okio.BufferedSource (implies api).
----
<1> The version string is optional.=== Basic configuration
For detailed information on how to configure the plugin, see https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Customizing-plugin-behavior[the wiki].
To configure the plugin, use the https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/blob/main/src/main/kotlin/com/autonomousapps/DependencyAnalysisExtension.kt[`dependencyAnalysis`] extension.
.build.gradle
[source,groovy]
----
dependencyAnalysis {
// configuration goes here
}
----== Publications
The following is a list of articles / blog posts that have been published discussing this plugin:1. https://dev.to/autonomousapps/the-proper-care-and-feeding-of-your-gradle-build-d8g[The proper care and feeding of your Gradle build]
2. https://dev.to/autonomousapps/dependency-analysis-gradle-plugin-using-bytecode-analysis-to-find-unused-dependencies-509n[Dependency Analysis Gradle Plugin: Using bytecode analysis to find unused dependencies]
3. https://dev.to/autonomousapps/dependency-analysis-gradle-plugin-what-s-an-abi-3l2h[Dependency Analysis Gradle Plugin: What's an ABI?]
4. https://dev.to/autonomousapps/reducing-my-gradle-plugin-s-impact-on-configuration-time-a-journey-32h2[Reducing my Gradle plugin's impact on configuration time: A journey]...with more to come :)
This plugin has also been featured in these newsletters:
1. https://newsletter.gradle.com/2022/05[Gradle, May 2022]
2. https://newsletter.gradle.com/2020/09[Gradle, September 2020]
3. https://newsletter.gradle.com/2020/08[Gradle, August 2020]
4. https://androidweekly.net/issues/issue-423[Android Weekly, Issue #423]
5. https://newsletter.gradle.com/2020/07[Gradle, July 2020]
6. https://newsletter.gradle.com/2020/06[Gradle, June 2020]Podcast episodes about this plugin could be found here:
1. https://thebakery.dev/31/[The Developers' Bakery, Episode #31]
Youtube videos about this plugin:
1. https://youtu.be/Lipf5piizZc[Understanding Gradle #28 – Clean Compile Classpaths with the Dependency Analysis Plugin]