Migrate from Google OSS Licenses plugin to cashapp/licensee#2076
Migrate from Google OSS Licenses plugin to cashapp/licensee#2076suman9259 wants to merge 2 commits intoandroid:mainfrom
Conversation
Google's OSS Licenses plugin flags its task as notCompatibleWithConfigurationCache(), which causes the entire configuration cache to be discarded on each build that triggers it. The plugin also does not support edge-to-edge and uses old AppCompat UI. This replaces the plugin with cashapp/licensee, which: - Is configuration-cache compatible - Has no runtime dependency (build-time only Gradle plugin) - Enables a Compose-based licenses screen with Material 3 support - Adds license validation via an allow-list Changes: - Replace oss-licenses-plugin with cashapp/licensee in Gradle config - Remove play-services-oss-licenses runtime dependency - Remove OssLicensesMenuActivity/OssLicensesActivity declarations - Add licensee configuration with allowed SPDX licenses - Add Gradle task to copy licensee artifacts.json to app assets - Create Compose LicensesScreen to display license data - Update SettingsDialog to navigate to new LicensesScreen Fixes android#1022 Test: ./gradlew installDemoDebug, manual verification of licenses screen
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @suman9259, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the application's open-source license management by migrating from Google's OSS Licenses plugin to cashapp/licensee. This change resolves critical build performance issues related to the configuration cache and modernizes the license display experience by introducing a new Compose-based screen with Material 3 styling. The migration also streamlines dependencies and integrates license validation directly into the build process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully migrates the project from Google's OSS Licenses plugin to cashapp/licensee, addressing several performance and UI compatibility issues. The changes include updating Gradle configurations, removing old dependencies, and introducing a new Compose-based licenses screen. The implementation of the new LicensesScreen and its integration into the SettingsDialog are well-handled. There are a few minor improvements that could be made regarding accessibility and performance in the new LicensesScreen and a small idiomatic improvement in the Gradle task.
| inputFile.get().asFile.copyTo( | ||
| File(outputDirectory.get().asFile, "licenses.json"), | ||
| overwrite = true, | ||
| ) |
There was a problem hiding this comment.
The copyTo function on File is a standard Java I/O operation. For better integration with Gradle's DirectoryProperty and RegularFileProperty, it's often more idiomatic to use the copy method provided by ProjectLayout or FileSystemOperations if available, or at least outputDirectory.get().file("licenses.json") to create the destination file within the DirectoryProperty context. While the current approach works, using Gradle's built-in APIs can sometimes offer better build cacheability or dependency tracking.
inputFile.get().asFile.copyTo(
outputDirectory.get().file("licenses.json").asFile,
overwrite = true,
)| IconButton(onClick = onBackClick) { | ||
| Icon( | ||
| imageVector = NiaIcons.ArrowBack, | ||
| contentDescription = null, |
There was a problem hiding this comment.
For an interactive icon like a back button, providing a meaningful contentDescription is crucial for accessibility. Setting it to null means screen readers won't announce its purpose, making it difficult for visually impaired users to navigate.
| contentDescription = null, | |
| contentDescription = stringResource(R.string.feature_settings_impl_back_button_content_description), |
| modifier: Modifier = Modifier, | ||
| ) { | ||
| val context = LocalContext.current | ||
| val artifacts = remember { parseLicensesJson(context) } |
There was a problem hiding this comment.
The parseLicensesJson function is called directly within the remember block of the LicensesScreen composable. While remember caches the result, the initial parsing of a potentially large JSON file can be a heavy operation that might block the UI thread during the first composition. Consider moving this parsing logic to a ViewModel and exposing the artifacts as a StateFlow or LiveData to handle loading states and perform the operation off the main thread, improving UI responsiveness.
Google's OSS Licenses plugin flags its task as
notCompatibleWithConfigurationCache(), which causes the entire configuration cache to be discarded on each build that triggers it. The plugin also does not support edge-to-edge and uses old AppCompat UI.
This replaces the plugin with cashapp/licensee, which:
Changes:
Fixes #1022
Test: ./gradlew installDemoDebug, manual verification of licenses screen
DO NOT CREATE A PULL REQUEST WITHOUT READING THESE INSTRUCTIONS
Instructions
Thanks for submitting a pull request. To accept your pull request we need you do a few things:
If this is your first pull request
Ensure tests pass and code is formatted correctly
DemoDebugvariant by running./gradlew testDemoDebug./gradlew spotlessApplyAdd a description
We need to know what you've done and why you've done it. Include a summary of what your pull request contains, and why you have made these changes. Include links to any relevant issues which it fixes.
Here's an example.
NOW DELETE THIS LINE AND EVERYTHING ABOVE IT
What I have done and why
<add your PR description here>