[DRAFT] Add Metalava API signature generation and compatibility tracking#1616
Draft
rahul-lohra wants to merge 2 commits intodevelopfrom
Draft
[DRAFT] Add Metalava API signature generation and compatibility tracking#1616rahul-lohra wants to merge 2 commits intodevelopfrom
rahul-lohra wants to merge 2 commits intodevelopfrom
Conversation
- Add metalava-gradle plugin (v0.5.0) for API surface tracking - Create convention plugin (io.getstream.video.android.metalava) in build-logic to encapsulate all metalava setup into a single plugin ID per module - Apply to stream-video-android-core and stream-video-android-ui-core modules - Hook metalavaGenerateSignatureRelease into apiDump task automatically - Add metalava.enabled gradle property to toggle on/off - Add CI workflow (api-compatibility-check.yml) that blocks PRs with breaking API changes unless approved-api-change label is added - Fix git hook copy in root build.gradle.kts to handle worktree environments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
PR checklist ❌The following issues were detected:
What we check
|
Contributor
|
Note to self: We should look for a way to add binary compatibility check in conventions. |
Contributor
SDK Size Comparison 📏
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



STILL IN DRAFT, CI PPL IS NOT TESTED
Goal
Add automated public API surface tracking using Metalava to detect breaking API changes before they reach
develop. This gives us a Java/Android-aware API signature file (api/current.txt) per module — complementing the existing binary-compatibility-validator.apifiles.Implementation
Convention Plugin (
io.getstream.video.android.metalava)All metalava setup is encapsulated in a reusable convention plugin inside
build-logic/. This keeps module build files minimal and makes it easy to share across repos.Files added:
build-logic/convention/src/main/kotlin/MetalavaConventionPlugin.kt— Plugin entry pointbuild-logic/convention/src/main/kotlin/io/getstream/video/MetalavaSetup.kt— Shared configuration logicWhat the convention plugin does automatically:
me.tylerbwong.gradle.metalavaplugin (v0.5.0)api/current.txtReferencesHidden,HiddenTypeParameter,UnavailableSymbol,IoError)metalavaGenerateSignatureReleaseintoapiDumpso both files are generated togethermetalava.enabledGradle property for toggling on/offCI Workflow (
.github/workflows/api-compatibility-check.yml)Runs on PRs to
develop/main:api/current.txtapproved-api-changelabel is addedHow to Integrate Into a Module
Simple module (no customization needed) — 1 line:
plugins { id("io.getstream.video.android.library") id("io.getstream.video.android.metalava") // ← add this } Module with hidden annotations (e.g., internal APIs): plugins { id("io.getstream.video.android.library") id("io.getstream.video.android.metalava") } metalava { hiddenAnnotations.set( setOf("com.example.internal.InternalApi"), ) }Available Gradle Tasks
Examples:
How to Disable Metalava
When disabled, apiDump still generates .api files as before — only metalava tasks are skipped.
Modules Enabled
[x] stream-video-android-core
[x] stream-video-android-ui-core
🎨 UI Changes
None
Testing
Todo [WIP]
Run ./gradlew apiDump and verify both api/current.txt and .api files are generated
Run ./gradlew metalavaCheckCompatibilityRelease and verify it passes with no changes
Make a breaking API change (e.g., remove a public method), run metalavaCheckCompatibilityRelease, and verify it fails
Run ./gradlew apiDump -Pmetalava.enabled=false and verify metalava tasks are skipped
Verify CI workflow runs on PR and blocks merge on breaking changes
Verify adding approved-api-change label allows the PR to pass