mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.7k stars 427 forks source link

Discrepancies between list of dependencies found by AboutLibrary and the dependencies task #1039

Closed redwarp closed 10 hours ago

redwarp commented 1 week ago

About this issue

Briefly describe the issue

I've noticed that some libraries, that are reported by gradle when running ./gradlew app:dependencies --configuration debugRuntimeClasspath are missing from the report

How can the issue be reproduced / sample code

I'm joining a minimal sample project to reproduce: MissingLib.zip It's an app that does nothing but display the list of dependencies using AboutLibraries.

  1. Within the sample project, run ./gradlew app:dependencies --configuration debugRuntimeClasspath
  2. Notice that there are 3 androidx.annotation:annotation libraries:
    • androidx.annotation:annotation
    • androidx.annotation:annotation-jvm
    • androidx.annotation:annotation-experimental
  3. Run ./gradlew app:findLibraries
  4. Notice that there are only 2 of the androidx.annotation:annotation libraries:
    • androidx.annotation:annotation-jvm
    • androidx.annotation:annotation-experimental

Potential fix

I experimented with the plugin, and what should fix it is to modify this line: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt#L129

From:

  else -> {
    if (LOGGER.isDebugEnabled) LOGGER.debug("retrieve allModuleArtifacts from artifact")
    resolvedDependency.allModuleArtifacts
}

to

  else -> {
    if (LOGGER.isDebugEnabled) LOGGER.debug("retrieve allModuleArtifacts from artifact")
    resolvedDependency.allModuleArtifacts + resolvedDependency.toResolvedBomArtifact()
}

It doesn't seem to have any negative side effect to do so, but maybe I'm missing something?

Let me know if I can/should open a merge request.

Details

Checklist

mikepenz commented 6 days ago

Thank you very much for the report.

Please open a PR for this adjustment