Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI][ANDR] Add Gradle plugin to check against non-permitted licenses #5

Merged
merged 7 commits into from
Aug 26, 2024

Conversation

murki
Copy link
Contributor

@murki murki commented Aug 24, 2024

Using https://github.com/jk1/Gradle-License-Report to guard using non-allowed licenses. Applies common configuration to modules ':capture', ':capture-apollo3', ':capture-timber', ':common', ':replay'

Usage:
(needs to be in cd platform/jvm)

  • ./gradlew checkLicense (checks all modules against allowed-licenses.json)

  • ./gradlew capture:generateLicenseReport (generates reports in loop-sdk/platform/jvm/{$projectDir}/build/reports/dependency-license/)

To get the full dependency tree for a module you can run:
./gradlew capture:dependencies --configuration releaseRuntimeClasspath

allowedLicensesFile = project.rootProject.file("allowed-licenses.json")
renderers = arrayOf(JsonReportRenderer())
filters = arrayOf(SpdxLicenseBundleNormalizer())
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ here we centralize the plugin logic using gradle's precompiled convention plugins https://docs.gradle.org/current/userguide/custom_plugins.html

implementation(libs.androidx.core)
implementation(libs.androidx.startup.runtime)
implementation(libs.jsr305)
implementation(libs.gson)
implementation("androidx.tracing:tracing-ktx:1.2.0")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated clean-up

"moduleName": "capture-sdk:replay"
}
]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this is the list of allowed licenses

@@ -96,6 +96,9 @@ jobs:
- name: Gradle capture-timber unit tests
working-directory: ./platform/jvm
run: ./gradlew capture-timber:testReleaseUnitTest --info
- name: Check Licenses for all Modules
working-directory: ./platform/jvm
run: ./gradlew checkLicense --info
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ run the check in CI

Copy link
Contributor

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM modulo CI issues.

@murki murki changed the title [CI][ANDR] Use Gradle plugin to guard against non-permitted licenses [CI][ANDR] Add Gradle plugin to guard against non-permitted licenses Aug 26, 2024
@murki murki changed the title [CI][ANDR] Add Gradle plugin to guard against non-permitted licenses [CI][ANDR] Add Gradle plugin to check against non-permitted licenses Aug 26, 2024
@murki murki enabled auto-merge (squash) August 26, 2024 19:55
@murki murki disabled auto-merge August 26, 2024 20:22
@murki murki merged commit d77bd02 into main Aug 26, 2024
15 checks passed
@murki murki deleted the murki/add-gradle-license-report branch August 26, 2024 20:40
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants