Skip to content

Commit 258bce2

Browse files
authored
Add automated dependency license documentation (#7)
1 parent d79a263 commit 258bce2

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed

.github/workflows/_docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ jobs:
3939
- name: Build documentation
4040
run: ./gradlew dokkaGenerate --no-daemon
4141

42+
- name: Generate License Report
43+
run: ./gradlew generateLicenseReport --no-daemon
44+
45+
- name: Copy License Report to Docs
46+
run: |
47+
mkdir -p openmapview/build/dokka/html/licenses
48+
cp openmapview/build/reports/licenses/licenses.html openmapview/build/dokka/html/licenses/index.html
49+
4250
- name: Upload documentation artifact
4351
uses: actions/upload-artifact@v4
4452
with:

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ dependencies {
2020

2121
The library is available on [Maven Central](https://central.sonatype.com/artifact/de.afarber/openmapview). Alternative distribution via [JitPack](https://jitpack.io/#afarber/OpenMapView) is also supported.
2222

23+
## License Compliance
24+
25+
OpenMapView is licensed under the **MIT License** - use freely in commercial apps.
26+
27+
**Dependency Licenses:**
28+
- All runtime dependencies use Apache 2.0 or MIT licenses (business-friendly)
29+
- View complete [Dependency License Report](https://afarber.github.io/OpenMapView/licenses/)
30+
- No GPL or restrictive copyleft licenses
31+
32+
**Dependencies (5 total):**
33+
- androidx.core:core-ktx (Apache 2.0)
34+
- androidx.lifecycle:lifecycle-runtime-ktx (Apache 2.0)
35+
- androidx.compose.ui:ui-graphics (Apache 2.0)
36+
- io.ktor:ktor-client-android (Apache 2.0)
37+
- com.jakewharton:disklrucache (Apache 2.0)
38+
2339
## Features
2440

2541
- Drop-in compatible with Google `MapView` (non-deprecated methods only)

docs/CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,38 @@ Running `./gradlew spotlessApply` automatically adds this header to any files mi
5151

5252
The CI pipeline includes a copyright check that will fail if any `.kt` files are missing the required header.
5353

54+
### 3. Dependency Management
55+
56+
Before adding new dependencies to OpenMapView, verify the following:
57+
58+
1. **License Compatibility**: Only add dependencies with permissive licenses
59+
- Preferred: Apache 2.0, MIT, BSD
60+
- Prohibited: GPL, AGPL (would affect library users)
61+
- Consult before adding: LGPL, EPL, MPL
62+
63+
2. **Verify License**: Run the license report to check all dependencies
64+
```bash
65+
./gradlew generateLicenseReport
66+
```
67+
View the report at: `openmapview/build/reports/licenses/licenses.html`
68+
69+
3. **Minimal Footprint**: Keep dependencies minimal
70+
- OpenMapView currently has only 5 runtime dependencies
71+
- New dependencies must provide essential functionality
72+
- Avoid bloat - see [ARCHITECTURE.md](ARCHITECTURE.md) for philosophy
73+
74+
4. **Auto-Publishing**: License reports automatically publish to the documentation site
75+
- URL: https://afarber.github.io/OpenMapView/licenses/
76+
- Updated on every docs deployment
77+
- No manual maintenance needed
78+
79+
**Current Dependencies** (all Apache 2.0 or MIT):
80+
- androidx.core:core-ktx
81+
- androidx.lifecycle:lifecycle-runtime-ktx
82+
- androidx.compose.ui:ui-graphics
83+
- io.ktor:ktor-client-android
84+
- com.jakewharton:disklrucache
85+
5486
## Automated Git Hooks (Recommended)
5587

5688
Git hooks can automatically check formatting and copyright headers before commits, preventing CI failures.

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ kotlinx-coroutines = "1.10.2"
3535

3636
# Code Quality
3737
ktlint = "1.3.1"
38+
license-report = "2.9"
3839

3940
[libraries]
4041
# AndroidX Core
@@ -78,6 +79,7 @@ kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "ko
7879
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
7980
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
8081
nmcp = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }
82+
license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "license-report" }
8183

8284
[bundles]
8385
# Common dependencies for example apps

openmapview/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
alias(libs.plugins.kotlin.android)
44
alias(libs.plugins.spotless)
55
alias(libs.plugins.dokka)
6+
alias(libs.plugins.license.report)
67
id("maven-publish")
78
id("signing")
89
id("jacoco")
@@ -231,6 +232,21 @@ signing {
231232
sign(publishing.publications)
232233
}
233234

235+
licenseReport {
236+
// Include only runtime dependencies (exclude test deps)
237+
configurations = arrayOf("releaseRuntimeClasspath")
238+
239+
// Generate HTML report
240+
renderers =
241+
arrayOf(
242+
com.github.jk1.license.render
243+
.InventoryHtmlReportRenderer("licenses.html", "Dependency Licenses"),
244+
)
245+
246+
// Output directory
247+
outputDir = "${layout.buildDirectory.get()}/reports/licenses"
248+
}
249+
234250
dokka {
235251
moduleName.set("OpenMapView")
236252
moduleVersion.set(rootProject.ext["libVersion"] as String)

0 commit comments

Comments
 (0)