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.62k stars 419 forks source link

Root level application of plugin doesnt find libraries in other modules #914

Closed Wavesonics closed 1 year ago

Wavesonics commented 1 year ago

About this issue

I have a project with multiple modules:

Base 
|
Common
|
ComposeUi
|                    |
Android        Desktop

And applying the plugin in my root gradle, and then running the export, only founds a couple libraries. Mostly Kotlin SDK stuff. Is there something am missing that would give me a conflated json file with all libraries for all platforms?

Details

Checklist

mikepenz commented 1 year ago

Good day.

Thank you for the ticket.

The proposed way at this time is to apply it to the Android and Desktop modules in your scenario: https://github.com/mikepenz/AboutLibraries/blob/develop/app/build.gradle#L5 And for the Desktop respectively: https://github.com/mikepenz/AboutLibraries/blob/develop/app-desktop/build.gradle.kts#L6

The plugin will transitively collect the dependencies in that case.

Wavesonics commented 1 year ago

Huh, so changing to just applying the plugin to those terminal modules, it doesn't seem to run the task automatically when I build those targets though.

I can run the exportLibraryDefinitions task manually and it produces the json file, but if I just run assemble or run, it doesn't produce the json, and trying to view the libraries in the app crashes (desktop).

mikepenz commented 1 year ago

@Wavesonics depends on the configuration. The default configuration would hook up the build as part of the Android builds. However that can be disabled via: https://github.com/mikepenz/AboutLibraries/blob/develop/app/build.gradle#L89

For desktop, it wouldn't be automatically linked, that's correct. You can see the README for the sample highlighting that you'd execute the task: https://github.com/mikepenz/AboutLibraries/blob/develop/app-desktop/README.md And how to use it: https://github.com/mikepenz/AboutLibraries/blob/develop/app-desktop/src/main/kotlin/main.kt#L17C1-L17C1

That being said, in general I'd advice to update and check-in the outputs manually for Android too - as it gives more control and change swill show up in the commit history: https://github.com/mikepenz/AboutLibraries/blob/develop/README.md#enterprise

Wavesonics commented 1 year ago

Okay, ya that works. It would be nice to have an overload for the composable function that just accelts a Libs object, and doesn't worry about constructing it.

That way we could have a single multi-platform composable.

Anyway, thanks for your help!

mikepenz commented 1 year ago

@Wavesonics there is the API to pass in just the Libs: https://github.com/mikepenz/AboutLibraries/blob/develop/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt#L33-L49 (transformed to StableLibs for performance improvement)

However at the moment this wouldn't include the platform specific dialog handling.