Skip to content

feat(oss-licenses): implement dynamic embedded license detection#414

Merged
timothyfroehlich merged 4 commits intomainfrom
plugin-granular-support
Apr 24, 2026
Merged

feat(oss-licenses): implement dynamic embedded license detection#414
timothyfroehlich merged 4 commits intomainfrom
plugin-granular-support

Conversation

@timothyfroehlich
Copy link
Copy Markdown
Member

@timothyfroehlich timothyfroehlich commented Apr 23, 2026

Summary

This PR refactors the oss-licenses-plugin to dynamically detect and extract embedded licenses from all AAR and JAR artifacts, removing the hardcoded reliance on specific Google Play Services or Firebase maven groups.

Key changes

  • Dynamic Detection: Replaced the hardcoded isGoogleServices and isGranularVersion checks with a universal "bundled license" check. The task now attempts to unzip every resolved artifact to look for third_party_licenses.json and third_party_licenses.txt.
  • Side-car Support: Implemented a generic suffix check (*-license) to skip POM license extraction for side-car artifacts while still extracting their embedded data, preventing redundant attribution entries.
  • Robust Extraction: Updated addEmbeddedLicenses to use try-with-resources for ZipFile handling and added error catching for malformed or non-ZIP artifacts to ensure build stability.
  • Code Cleanup: Removed obsolete constants (GOOGLE_PLAY_SERVICES_GROUP, FIREBASE_GROUP, etc.) and internal methods related to legacy group-based branching.

Test plan

  • Added action_nonGmsGranularLibrary_extractsTransitiveLicenses unit test for non-GMS granular licenses.
  • Added action_licenseSidecarArtifact_skipsPomButExtractsEmbedded unit test for the -license side-car path.
  • Verified full unit test suite (21/21 passed).
  • Verified full integration test matrix (30/30 passed) across AGP 7.4 through 9.0-alpha.

@timothyfroehlich timothyfroehlich requested a review from xyarco April 23, 2026 20:44
@timothyfroehlich timothyfroehlich merged commit f499938 into main Apr 24, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants