Skip to content

Commit d60fd81

Browse files
committed
- improve the README
1 parent a41a9de commit d60fd81

File tree

1 file changed

+110
-72
lines changed

1 file changed

+110
-72
lines changed

README.md

Lines changed: 110 additions & 72 deletions
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+
.. 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 {
@@ -172,13 +176,19 @@ aboutLibraries {
172176
```
173177

174178
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
179+
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.
180+
181+
</p>
182+
</details>
183+
184+
<details><summary><b>Modify Libraries / Licenses</b></summary>
185+
<p>
176186

177187
## Modify libraries / licenses
178188

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/
189+
The plugin offers the ability to add or override library and license details by placing JSON files
190+
in the `libraries` and `licenses` directories within the configured `configPath`.
191+
See the [config directory](https://github.com/mikepenz/AboutLibraries/blob/develop/config/) for examples.
182192

183193
### Libraries
184194

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

219229
## Dependencies
220230

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

226236
```toml
227237
[versions]
228238
aboutLibraries = "{latest-version}"
229239

230240
[libraries]
241+
# Core module (required for accessing library data)
231242
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" }
243+
# Compose UI modules (choose one or both)
244+
aboutlibraries-compose-core = { module = "com.mikepenz:aboutlibraries-compose-core", version.ref = "aboutLibraries" } # Common compose core
245+
aboutlibraries-compose-m2 = { module = "com.mikepenz:aboutlibraries-compose", version.ref = "aboutLibraries" } # Material 2 UI
246+
aboutlibraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" } # Material 3 UI
247+
# Deprecated View-based UI module
248+
aboutlibraries-view = { module = "com.mikepenz:aboutlibraries", version.ref = "aboutLibraries" }
237249

238250
[plugins]
239251
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" }
240252
```
241253

242254
## Core-module
243255

256+
Include the core module to access the generated library information programmatically.
257+
244258
```gradle
245-
implementation("com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}")
246-
// or
259+
// build.gradle.kts
260+
// Recommended: Using version catalog
247261
implementation(libs.aboutlibraries.core)
262+
263+
// Alternative: Direct dependency declaration
264+
// implementation("com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}")
248265
```
249266

250267
<details><summary><b>(Advanced) Usage</b></summary>
@@ -269,34 +286,41 @@ for (lib in libraries) {
269286
</p>
270287
</details>
271288

272-
## UI-module
289+
## UI-module (Compose)
290+
291+
Include the Compose UI module(s) for easy integration into Jetpack Compose applications.
273292

274293
```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
294+
// build.gradle.kts
295+
// Recommended: Using version catalog (choose M2 or M3, or both)
296+
implementation(libs.aboutlibraries.compose.m2) // Material 2
297+
implementation(libs.aboutlibraries.compose.m3) // Material 3
298+
299+
// Alternative: Direct dependency declaration
300+
// implementation("com.mikepenz:aboutlibraries-compose:${latestAboutLibsRelease}") // Material 2
301+
// implementation("com.mikepenz:aboutlibraries-compose-m3:${latestAboutLibsRelease}") // Material 3
280302
```
281303

282304
### Usage
283305

284306
```kotlin
285-
// android (when using the default resource location
307+
// Android: Auto-discovery using default resource location (src/main/res/raw/aboutlibraries.json)
286308
LibrariesContainer(
287309
Modifier.fillMaxSize()
288310
)
289311

290-
// compose resource API
312+
// Multiplatform: Using compose-resources API (e.g., src/commonMain/composeResources/files/aboutlibraries.json)
291313
val libraries by rememberLibraries {
292314
Res.readBytes("files/aboutlibraries.json").decodeToString()
293315
}
316+
LibrariesContainer(libraries, Modifier.fillMaxSize())
294317

295-
// compose manually
318+
319+
// Multiplatform: Manually loading JSON
296320
val libraries by rememberLibraries {
321+
// Replace with your specific resource loading logic
297322
useResource("aboutlibraries.json") { res -> res.bufferedReader().readText() }
298323
}
299-
300324
LibrariesContainer(libraries, Modifier.fillMaxSize())
301325
```
302326

@@ -305,7 +329,7 @@ LibrariesContainer(libraries, Modifier.fillMaxSize())
305329

306330
### Advanced Usage
307331

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

310334
```kotlin
311335
// custom header, divider, footer
@@ -334,21 +358,22 @@ LibrariesContainer(
334358
</details>
335359

336360

337-
<details><summary><b>Compose-jb</b></summary>
361+
<details><summary><b>Compose Multiplatform (Desktop, Wasm, etc.)</b></summary>
338362
<p>
339363

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.
364+
The core and compose modules are Kotlin Multiplatform compatible.
365+
The `app-desktop` and `app-wasm` modules demonstrate usage outside of Android, including manual generation and inclusion of the dependency metadata.
343366

344367
### Generate Dependency Information
345368

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

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
375+
# Filter exported definition by variant (e.g., for wasmJs target)
376+
./gradlew :app-wasm:exportLibraryDefinitions -PaboutLibraries.outputFile=src/jsMain/resources/aboutlibraries.json -PaboutLibraries.exportVariant=wasmJs
352377
```
353378

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

364389
### Screenshot
365390

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

368393
</p>
369394
</details>
370395

371-
## (Legacy) UI-module
396+
## (Legacy) UI-module (View-based)
372397

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.
398+
> [!WARNING]
399+
> **Deprecated:** The legacy View-based UI module (`com.mikepenz:aboutlibraries`) is deprecated and will receive limited support.
400+
> Please migrate to the [Compose UI module](#ui-module-compose).
401+
> For embedding Compose in Views, consider using [ComposeView](https://developer.android.com/develop/ui/compose/migrate/interoperability-apis/compose-in-views).
402+
> While newer Gradle plugin versions *might* be compatible with older UI modules regarding the data format, migration is strongly recommended.
378403
379404
```gradle
380-
implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}")
405+
// build.gradle.kts
406+
// Recommended: Using version catalog
407+
implementation(libs.aboutlibraries.view)
408+
409+
// Alternative: Direct dependency declaration
410+
// implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}")
381411
```
382412

383-
<details><summary><b>Usage</b></summary>
413+
<details><summary><b>Legacy Usage</b></summary>
384414
<p>
385415

386416
### Usage
@@ -460,49 +490,57 @@ Create a custom style for the AboutLibraries UI.
460490
</p>
461491
</details>
462492

463-
## Enterprise
493+
## Enterprise / Manual JSON Handling
464494

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.
495+
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.
466496

467497
```kts
498+
// build.gradle.kts
468499
aboutLibraries {
469500
android {
470-
// Disable the automatic task
501+
// Disable automatic task registration for Android builds
471502
registerAndroidTasks = false
472503
}
473504
export {
474-
// Define the output path (including fileName)
505+
// Define the output path for manual generation
506+
// Adjust the path based on your project structure (e.g., composeResources, Android res/raw)
475507
outputFile = file("src/commonMain/composeResources/files/aboutlibraries.json")
476-
variant = "release" // Optional, if not set the default variant will be used
508+
// Optionally specify the variant for export
509+
// variant = "release"
477510
}
478511
}
479512
```
480513

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.
514+
Generate the file manually using the Gradle task:
483515

484516
```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
517+
# Generate using the configured location and variant
518+
./gradlew :app:exportLibraryDefinitions
519+
520+
# Generate providing a custom path and variant override
521+
./gradlew :app:exportLibraryDefinitions -PaboutLibraries.outputFile=src/main/res/raw/libraries.json -PaboutLibraries.exportVariant=release
489522
```
490523

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.
524+
Commit the generated `aboutlibraries.json` to your SCM. The library will then need to load this file manually.
493525

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:
526+
Example for Compose UI:
496527

497528
```kotlin
529+
// Load the JSON from Android resources
498530
LibrariesContainer(
499-
librariesBlock = { ctx ->
500-
Libs.Builder().withJson(ctx, R.raw.aboutlibraries).build()
531+
librariesBlock = { ctx ->
532+
Libs.Builder().withContext(ctx).build()
501533
}
502534
)
535+
536+
// Load the JSON using compose-resources
537+
val libraries by rememberLibraries {
538+
Res.readBytes("files/aboutlibraries.json").decodeToString()
539+
}
540+
LibrariesContainer(libraries)
503541
```
504542

505-
## Gradle API
543+
## Gradle API / Tasks
506544

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

0 commit comments

Comments
 (0)