Skip to content

Commit 41d8be5

Browse files
authored
Merge pull request #1152 from mikepenz/other/improve_readme
Improve README
2 parents a41a9de + 9e968ee commit 41d8be5

File tree

1 file changed

+110
-79
lines changed

1 file changed

+110
-79
lines changed

README.md

+110-79
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# AboutLibraries
22

3-
.. collects all dependency details including licenses at compile time, and offers simple APIs to visualize these in the app.
4-
*No runtime overhead.* Strong caching. Any gradle dependency is supported.
3+
<!-- Badges -->
4+
[![Maven Central](https://img.shields.io/maven-central/v/com.mikepenz/aboutlibraries-core?style=for-the-badge)](https://search.maven.org/artifact/com.mikepenz/aboutlibraries-core)
5+
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.mikepenz.aboutlibraries.plugin?label=Gradle%20Plugin&style=for-the-badge)](https://plugins.gradle.org/plugin/com.mikepenz.aboutlibraries.plugin)
6+
[![Apache 2.0 License](https://img.shields.io/github/license/mikepenz/AboutLibraries?style=for-the-badge)](https://github.com/mikepenz/AboutLibraries/blob/develop/LICENSE)
7+
8+
This library collects dependency details, including licenses at compile time, and offers simple APIs to visualize these in the app.
9+
*No runtime overhead.* Strong caching. Supports any Gradle dependency.
510

611
-------
712

813
<p align="center">
9-
<a href="#whats-included-">What's included 🚀</a> &bull;
10-
<a href="#setup">Setup 🛠️</a> &bull;
11-
<a href="#gradle-api">Gradle API️</a> &bull;
14+
<a href="#whats-included-">What's Included 🚀</a> &bull;
15+
<a href="#setup">Setup Guide 🛠️</a> &bull;
16+
<a href="#gradle-api">Gradle Tasks ⚙️</a> &bull;
1217
<a href="MIGRATION.md">Migration Guide 🧬</a> &bull;
13-
<a href="https://play.google.com/store/apps/details?id=com.mikepenz.aboutlibraries.sample">Sample App</a>
1418
</p>
1519

1620
-------
@@ -31,7 +35,7 @@
3135

3236
# Screenshots
3337

34-
![Screenshots](https://raw.githubusercontent.com/mikepenz/AboutLibraries/develop/DEV/screenshots/Screenshots.png)
38+
![AboutLibraries Screenshots](https://raw.githubusercontent.com/mikepenz/AboutLibraries/develop/DEV/screenshots/Screenshots.png)
3539

3640
# Setup
3741

@@ -42,10 +46,10 @@
4246

4347
## Gradle Plugin
4448

45-
> The gradle plugin is hosted
46-
> via [Gradle Plugins](https://plugins.gradle.org/plugin/com.mikepenz.aboutlibraries.plugin).
49+
> The Gradle plugin is hosted via the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.mikepenz.aboutlibraries.plugin).
50+
> Using the `plugins` DSL is the recommended approach.
4751
48-
<details open><summary><b>Using the plugins DSL (for single modules)</b></summary>
52+
<details open><summary><b>Using the plugins DSL (Recommended)</b></summary>
4953
<p>
5054

5155
```gradle
@@ -59,7 +63,7 @@ id("com.mikepenz.aboutlibraries.plugin")
5963
</p>
6064
</details>
6165

62-
<details><summary><b>Using the plugins DSL (for whole project)</b></summary>
66+
<details><summary><b>Using the plugins DSL (Apply to all subprojects)</b></summary>
6367
<p>
6468

6569
```gradle
@@ -84,12 +88,12 @@ apply plugin: 'com.mikepenz.aboutlibraries.plugin'
8488
</p>
8589
</details>
8690

87-
<details><summary><b>Gradle Plugin Configuration</b></summary>
91+
<details><summary><b>Gradle Plugin Configuration Options</b></summary>
8892
<p>
8993

9094
## Gradle Plugin Configuration
9195

92-
It is possible to provide custom configurations / adjustments to the automatic detection. This can be done via the gradle plugin.
96+
The plugin allows customization via the `aboutLibraries` extension in your build script.
9397

9498
```kts
9599
aboutLibraries {
@@ -142,6 +146,16 @@ aboutLibraries {
142146
// Enable pretty printing for the generated JSON file
143147
prettyPrint = true
144148
}
149+
150+
exports {
151+
// Define export configuration per variant.
152+
create("jvm") {
153+
outputFile = file("files/jvm/aboutlibraries.json")
154+
}
155+
create("wasmJs") {
156+
outputFile = file("files/wasmJs/aboutlibraries.json")
157+
}
158+
}
145159

146160
license {
147161
// Define the strict mode, will fail if the project uses licenses not allowed
@@ -172,13 +186,19 @@ aboutLibraries {
172186
```
173187

174188
Full documentation of all available gradle plugin
175-
configurations: https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt
189+
configurations can be found in the [AboutLibrariesExtension.kt](https://github.com/mikepenz/AboutLibraries/blob/develop/plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt) source file.
190+
191+
</p>
192+
</details>
193+
194+
<details><summary><b>Modify Libraries / Licenses</b></summary>
195+
<p>
176196

177197
## Modify libraries / licenses
178198

179-
The plugin offers the ability to add additional libraries or licenses by specifying these under the
180-
`libraries` and respectively `licenses` directory, within the defined `configPath`.
181-
This can be seen here: https://github.com/mikepenz/AboutLibraries/blob/develop/config/
199+
The plugin offers the ability to add or override library and license details by placing JSON files
200+
in the `libraries` and `licenses` directories within the configured `configPath`.
201+
See the [config directory](https://github.com/mikepenz/AboutLibraries/blob/develop/config/) for examples.
182202

183203
### Libraries
184204

@@ -218,33 +238,40 @@ Provide additional or modify existing licenses via a `.json` file per license.
218238

219239
## Dependencies
220240

221-
> The AboutLibraries Library is pushed
222-
> to [Maven Central](https://search.maven.org/artifact/com.mikepenz/aboutlibraries-core).
241+
> The AboutLibraries libraries are published to [Maven Central](https://search.maven.org/artifact/com.mikepenz/aboutlibraries-core).
242+
> Using a version catalog (`libs.versions.toml`) is the recommended way to manage dependencies.
223243
224-
### `libs.versions.toml`
244+
### `libs.versions.toml` (Recommended)
225245

226246
```toml
227247
[versions]
228248
aboutLibraries = "{latest-version}"
229249

230250
[libraries]
251+
# Core module (required for accessing library data)
231252
aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "aboutLibraries" }
232-
aboutlibraries-compose-core = { module = "com.mikepenz:aboutlibraries-compose-core", version.ref = "aboutLibraries" }
233-
aboutlibraries-compose-m2 = { module = "com.mikepenz:aboutlibraries-compose", version.ref = "aboutLibraries" }
234-
aboutlibraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" }
235-
# Deprecated module
236-
aboutlibraries-compose-view = { module = "com.mikepenz:aboutlibraries", version.ref = "aboutLibraries" }
253+
# Compose UI modules (choose one or both)
254+
aboutlibraries-compose-core = { module = "com.mikepenz:aboutlibraries-compose-core", version.ref = "aboutLibraries" } # Common compose core
255+
aboutlibraries-compose-m2 = { module = "com.mikepenz:aboutlibraries-compose", version.ref = "aboutLibraries" } # Material 2 UI
256+
aboutlibraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" } # Material 3 UI
257+
# Deprecated View-based UI module
258+
aboutlibraries-view = { module = "com.mikepenz:aboutlibraries", version.ref = "aboutLibraries" }
237259

238260
[plugins]
239261
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" }
240262
```
241263

242264
## Core-module
243265

266+
Include the core module to access the generated library information programmatically.
267+
244268
```gradle
245-
implementation("com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}")
246-
// or
269+
// build.gradle.kts
270+
// Recommended: Using version catalog
247271
implementation(libs.aboutlibraries.core)
272+
273+
// Alternative: Direct dependency declaration
274+
// implementation("com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}")
248275
```
249276

250277
<details><summary><b>(Advanced) Usage</b></summary>
@@ -269,34 +296,41 @@ for (lib in libraries) {
269296
</p>
270297
</details>
271298

272-
## UI-module
299+
## UI-module (Compose)
300+
301+
Include the Compose UI module(s) for easy integration into Jetpack Compose applications.
273302

274303
```gradle
275-
implementation("com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}") // material 2
276-
implementation("com.mikepenz:aboutlibraries-compose-m3:${latestAboutLibsRelease}") // material 3
277-
// or
278-
implementation(libs.aboutlibraries.compose.m2) // material 2
279-
implementation(libs.aboutlibraries.compose.m3) // material 3
304+
// build.gradle.kts
305+
// Recommended: Using version catalog (choose M2 or M3, or both)
306+
implementation(libs.aboutlibraries.compose.m2) // Material 2
307+
implementation(libs.aboutlibraries.compose.m3) // Material 3
308+
309+
// Alternative: Direct dependency declaration
310+
// implementation("com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}") // Material 2
311+
// implementation("com.mikepenz:aboutlibraries-compose-m3:${latestAboutLibsRelease}") // Material 3
280312
```
281313

282314
### Usage
283315

284316
```kotlin
285-
// android (when using the default resource location
317+
// Android: Auto-discovery using default resource location (src/main/res/raw/aboutlibraries.json)
286318
LibrariesContainer(
287319
Modifier.fillMaxSize()
288320
)
289321

290-
// compose resource API
322+
// Multiplatform: Using compose-resources API (e.g., src/commonMain/composeResources/files/aboutlibraries.json)
291323
val libraries by rememberLibraries {
292324
Res.readBytes("files/aboutlibraries.json").decodeToString()
293325
}
326+
LibrariesContainer(libraries, Modifier.fillMaxSize())
294327

295-
// compose manually
328+
329+
// Multiplatform: Manually loading JSON
296330
val libraries by rememberLibraries {
331+
// Replace with your specific resource loading logic
297332
useResource("aboutlibraries.json") { res -> res.bufferedReader().readText() }
298333
}
299-
300334
LibrariesContainer(libraries, Modifier.fillMaxSize())
301335
```
302336

@@ -305,7 +339,7 @@ LibrariesContainer(libraries, Modifier.fillMaxSize())
305339

306340
### Advanced Usage
307341

308-
Provide custom header, divider, and footer for the libraries container.
342+
Provide custom header, divider, and footer items for the `LibrariesContainer`.
309343

310344
```kotlin
311345
// custom header, divider, footer
@@ -334,21 +368,22 @@ LibrariesContainer(
334368
</details>
335369

336370

337-
<details><summary><b>Compose-jb</b></summary>
371+
<details><summary><b>Compose Multiplatform (Desktop, Wasm, etc.)</b></summary>
338372
<p>
339373

340-
The core module and the compose module are Kotlin-Multiplatform projects.
341-
Find a sample application as the `app-desktop` module. It showcases the usage to manually generate
342-
the dependency meta information and include as part of the SCM.
374+
The core and compose modules are Kotlin Multiplatform compatible.
375+
The `app-desktop` and `app-wasm` modules demonstrate usage outside of Android, including manual generation and inclusion of the dependency metadata.
343376

344377
### Generate Dependency Information
345378

379+
Manually export the definitions using the Gradle task. This is typically needed for non-Android platforms or when `registerAndroidTasks` is disabled.
380+
346381
```bash
382+
# Export definitions to the specified file (e.g., for desktop)
347383
./gradlew :app-desktop:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/resources/libraries.json
348384

349-
# Filter exported definition by variant by passing `-PaboutLibraries.exportVariant==<VARIANT>`
350-
./gradlew :app-wasm:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/resources/libraries.json -PaboutLibraries.exportVariant=wasmJs
351-
./gradlew :app-wasm:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/resources/libraries.json -PaboutLibraries.exportVariant=jvm
385+
# Filter exported definition by variant (e.g., for wasmJs target)
386+
./gradlew :app-wasm:exportLibraryDefinitions -PaboutLibraries.outputFile=src/jsMain/resources/aboutlibraries.json -PaboutLibraries.exportVariant=wasmJs
352387
```
353388

354389
### Run Demo app(s)
@@ -363,24 +398,29 @@ the dependency meta information and include as part of the SCM.
363398

364399
### Screenshot
365400

366-
![Compose-jb Screenshot](https://raw.githubusercontent.com/mikepenz/AboutLibraries/develop/DEV/screenshots/compose-jb.png)
401+
![Compose Multiplatform Screenshot](https://raw.githubusercontent.com/mikepenz/AboutLibraries/develop/DEV/screenshots/compose-jb.png)
367402

368403
</p>
369404
</details>
370405

371-
## (Legacy) UI-module
406+
## (Legacy) UI-module (View-based)
372407

373-
> [!NOTE]
374-
> The legacy view based UI will be deprecated in the future. Please consider moving to the compose based UI.
375-
> For view based use cases please check out the [ComposeView](https://developer.android.com/develop/ui/compose/migrate/interoperability-apis/compose-in-views) provided by Compose.
376-
> Alternatively, the legacy module will be supported as long as the `core` data format isn't changed. Generally newer versions of the gradle plugin are compatible with older
377-
> versions of the ui modules.
408+
> [!WARNING]
409+
> **Deprecated:** The legacy View-based UI module (`com.mikepenz:aboutlibraries`) is deprecated and will receive limited support.
410+
> Please migrate to the [Compose UI module](#ui-module-compose).
411+
> For embedding Compose in Views, consider using [ComposeView](https://developer.android.com/develop/ui/compose/migrate/interoperability-apis/compose-in-views).
412+
> While newer Gradle plugin versions *might* be compatible with older UI modules regarding the data format, migration is strongly recommended.
378413
379414
```gradle
380-
implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}")
415+
// build.gradle.kts
416+
// Recommended: Using version catalog
417+
implementation(libs.aboutlibraries.view)
418+
419+
// Alternative: Direct dependency declaration
420+
// implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}")
381421
```
382422

383-
<details><summary><b>Usage</b></summary>
423+
<details><summary><b>Legacy Usage</b></summary>
384424
<p>
385425

386426
### Usage
@@ -460,49 +500,40 @@ Create a custom style for the AboutLibraries UI.
460500
</p>
461501
</details>
462502

463-
## Enterprise
503+
## Enterprise / Manual JSON Handling
464504

465-
Since v10 of the AboutLibraries plugin it is possible to disable the automatic registration of the plugin task as part of the build system.
505+
For environments requiring full control over the included `aboutlibraries.json` (e.g., manual verification, CI generation), you can disable automatic task registration and handle generation manually.
466506

467507
```kts
508+
// build.gradle.kts
468509
aboutLibraries {
469510
android {
470-
// Disable the automatic task
511+
// Disable automatic task registration for Android builds
471512
registerAndroidTasks = false
472513
}
473514
export {
474-
// Define the output path (including fileName)
515+
// Define the output path for manual generation
516+
// Adjust the path based on your project structure (e.g., composeResources, Android res/raw)
475517
outputFile = file("src/commonMain/composeResources/files/aboutlibraries.json")
476-
variant = "release" // Optional, if not set the default variant will be used
518+
// Optionally specify the variant for export
519+
// variant = "release"
477520
}
478521
}
479522
```
480523

481-
This is especially beneficial for enterprise environments where it is required to be in full control of the included `aboutlibraries.json`.
482-
After disabling the integration it is possible to manually update the definitions, or do it on your CI environment.
524+
Generate the file manually using the Gradle task:
483525

484526
```bash
485-
# Generate using the configured location
486-
./gradlew app:exportLibraryDefinitions
487-
# Generate providing a custom path and variant
488-
./gradlew app:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/res/raw/libraries.json -PaboutLibraries.exportVariant=release
489-
```
490-
491-
This generated file can be either included in your SCM, and every build will use this exact verified and approved state.
492-
Additionally, this helps to ensure no issues occur during the apps delivery phase, as the respective file is already generated and included.
527+
# Generate using the configured location and variant
528+
./gradlew :app:exportLibraryDefinitions
493529

494-
The library offers complete customisation for this behavior and location or name for the generated files can be adjusted as needed.
495-
A full compose code example providing the `Libs` manually:
496-
497-
```kotlin
498-
LibrariesContainer(
499-
librariesBlock = { ctx ->
500-
Libs.Builder().withJson(ctx, R.raw.aboutlibraries).build()
501-
}
502-
)
530+
# Generate providing a custom path and variant override
531+
./gradlew :app:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/res/raw/libraries.json -PaboutLibraries.exportVariant=release
503532
```
504533

505-
## Gradle API
534+
Commit the generated `aboutlibraries.json` to your SCM. The library will then need to load this file manually. See details in [Usage](#usage).
535+
536+
## Gradle API / Tasks
506537

507538
By default, the gradle plugin is automatically executed for Android projects, generating the library
508539
metadata where it's automatically discovered by the `ui` modules.

0 commit comments

Comments
 (0)