Skip to content

Commit

Permalink
🔨 Build: verify on check that all dependencies have compatible licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
berlix committed Jul 2, 2024
1 parent a0c9cd1 commit e4160c6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- name: checkout
uses: actions/checkout@v2

- name: Lint and check
run: ./gradlew lintRelease check --stacktrace

- name: Run instrumented tests on Android 5
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
40 changes: 40 additions & 0 deletions lib/allowed-licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"allowedLicenses": [
{ "moduleLicense": "MIT" },
{ "moduleLicense": "MIT License" },
{ "moduleLicense": "The MIT License" },

{ "moduleLicense": "BSD-2-Clause" },
{ "moduleLicense": "BSD 2-Clause" },
{ "moduleLicense": "The BSD 2-Clause License" },

{ "moduleLicense": "BSD-3-Clause" },
{ "moduleLicense": "BSD 3-Clause" },
{ "moduleLicense": "The BSD 3-Clause License" },

{ "moduleLicense": "Apache-2.0" },
{ "moduleLicense": "Apache 2.0" },
{ "moduleLicense": "The Apache Software License, Version 2.0" },
{ "moduleLicense": "The Apache License, Version 2.0" },
{ "moduleLicense": "Apache License, Version 2.0" },

{ "moduleLicense": "GPL-2.0-or-later" },
{ "moduleLicense": "GPL-2.0+" },
{ "moduleLicense": "GNU General Public License v2.0 or later" },

{ "moduleLicense": "GPL-1.0-or-later" },
{ "moduleLicense": "GPL-1.0+" },
{ "moduleLicense": "GNU General Public License v1.0 or later" },

{ "moduleLicense": "LGPL-2.1-or-later" },
{ "moduleLicense": "LGPL-2.1+" },
{ "moduleLicense": "GNU Lesser General Public License v2.1 or later" },

{ "moduleLicense": "LGPL-2.0-or-later" },
{ "moduleLicense": "LGPL-2.0+" },
{ "moduleLicense": "GNU Library General Public License v2.0 or later" },

{ "moduleLicense": "Zlib" },
{ "moduleLicense": "zlib License" }
]
}
16 changes: 16 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id("maven-publish")
id("signing")
id("com.palantir.git-version") version "3.0.0"
id("com.github.jk1.dependency-license-report") version "2.8"
}

val localProperties = Properties().apply {
Expand Down Expand Up @@ -49,6 +50,21 @@ signing {
sign(publishing.publications)
}

licenseReport {
allowedLicensesFile = File("$projectDir/allowed-licenses.json")
}

tasks.named("checkLicense") {
// The checkLicense task does not declare this input itself, so we do it here. This ensures
// that a modification of the file causes the checkLicense task to be re-evaluated.
inputs.file("$projectDir/allowed-licenses.json")
}

tasks.named("check") {
dependsOn("checkLicense")
}


dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.2")

Expand Down

0 comments on commit e4160c6

Please sign in to comment.