docs/license-sources.md
author Da Risk <da_risk@geekorum.com>
Tue, 06 May 2025 13:07:44 -0400
changeset 91 b3b57696b660
parent 90 260a6b232f4d
child 97 20ba708adda9
permissions -rw-r--r--
docs: separate docs/index and README

License sources
===============

The library can work with license information files generated by:

- [OSS Licenses Gradle Plugin](https://github.com/google/play-services-plugins/tree/main/oss-licenses-plugin)
- [licensee](https://github.com/cashapp/licensee)
- [LicensePlist](https://github.com/mono0926/LicensePlist)

Setup
=====

Add the dependency to your project

```kotlin title="build.gradle.kts"
dependencies {
    implementation("com.geekorum.aboutoss:core:<latest-version>")
}
```

OSS Licenses Gradle Plugin
--------------------------

The [OSS Licenses Gradle Plugin](https://github.com/google/play-services-plugins/tree/main/oss-licenses-plugin) stores license information in Android resources.

Create a [GmsLicenseInfoRepository](api/core/com.geekorum.aboutoss.core.gms/-gms-license-info-repository/index.html) to retrieves it.

The `GmsLicenseInfoRepository` is only available on Android platform.

```kotlin
 val licenseInfoRepository = GmsLicenseInfoRepository(
        appContext = application
    )
```


Licensee
--------

[licensee](https://github.com/cashapp/licensee) report file can be used as a source of license information.

Create a [LicenseeLicenseInfoRepository](api/core/com.geekorum.aboutoss.core.licensee/-licensee-license-info-repository/index.html) to read the report file.


```kotlin title="on iOS and Desktop"
val licenseInfoRepository = LicenseeLicenseInfoRepository()
```

```kotlin title="on Android"
val licenseInfoRepository = LicenseeLicenseInfoRepository(
    assetManager = application.assets
)
```

LicensePlist
------------

On iOS, [LicensePlist](https://github.com/mono0926/LicensePlist) can be use to automatically generates a Plist of all your dependencies.

Use [LicensePlistLicenseInfoRepository](api/core/com.geekorum.aboutoss.core.licenseplist/-license-plist-license-info-repository/index.html)
to parse license information stored in your resources bundle.

The `LicensePlistLicenseInfoRepository` is only available on iOS platform.

```kotlin
val licenseInfoRepository = LicensePlistLicenseInfoRepository()
```