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 82a6307 commit 5dfd8ff
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- name: checkout
uses: actions/checkout@v2

- name: Run unit tests
run: ./gradlew testReleaseUnitTest
- name: Check
run: ./gradlew check

- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
with:
java-version: '21'

- name: Run unit tests
run: ./gradlew testReleaseUnitTest
- name: Check
run: ./gradlew check

- name: Publish test reports
uses: actions/upload-artifact@v1
Expand Down
24 changes: 24 additions & 0 deletions integration-library/allowed-licenses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"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": "Zlib" },
{ "moduleLicense": "zlib License" }
]
}
16 changes: 16 additions & 0 deletions integration-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("de.mannodermaus.android-junit5")
id("signing")
id("com.palantir.git-version") version "3.0.0"
id("com.github.jk1.dependency-license-report") version "2.8"
}

val gitVersion: groovy.lang.Closure<String> by extra
Expand Down Expand Up @@ -47,6 +48,21 @@ android {
useLibrary("android.test.mock")
}

licenseReport {
configurations = arrayOf("releaseRuntimeClasspath")
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 {
implementation("androidx.annotation:annotation:1.8.0")

Expand Down

0 comments on commit 5dfd8ff

Please sign in to comment.