build: Extract shared Android lint config into a build-logic plugin#5767
Draft
runningcode wants to merge 1 commit into
Draft
build: Extract shared Android lint config into a build-logic plugin#5767runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
Replace the lint {} block copy-pasted across the Android modules with a
single io.sentry.android.lint convention plugin, applied to every Android
module except the sample. Adds ignoreTestSources (skips test-source
analysis, the dominant lint cost) and checkGeneratedSources to the shared
config, and centralizes the OldTargetApi suppression.
AGP is a compileOnly dependency of build-logic so each module supplies its
own AGP at runtime, keeping the AGP compatibility matrix unaffected. The
test/benchmark apps carry pre-existing lint issues, so they get lint
baselines rather than blocking the strict config.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 403.90 ms | 546.09 ms | 142.19 ms |
| e63ad34 | 310.20 ms | 366.84 ms | 56.63 ms |
| 5865051 | 319.74 ms | 365.60 ms | 45.86 ms |
| a1eadfa | 345.67 ms | 411.26 ms | 65.59 ms |
| b193867 | 319.59 ms | 403.09 ms | 83.50 ms |
| 0eaac1e | 316.82 ms | 357.34 ms | 40.52 ms |
| 22ff2c7 | 306.60 ms | 336.65 ms | 30.05 ms |
| d15471f | 286.65 ms | 314.68 ms | 28.03 ms |
| 05aa61d | 310.43 ms | 372.40 ms | 61.97 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 6b019b7 | 0 B | 0 B | 0 B |
| e63ad34 | 0 B | 0 B | 0 B |
| 5865051 | 0 B | 0 B | 0 B |
| a1eadfa | 0 B | 0 B | 0 B |
| b193867 | 1.58 MiB | 2.19 MiB | 620.00 KiB |
| 0eaac1e | 1.58 MiB | 2.19 MiB | 619.17 KiB |
| 22ff2c7 | 0 B | 0 B | 0 B |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 05aa61d | 0 B | 0 B | 0 B |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
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.
📜 Description
Extracts the Android lint configuration that was copy-pasted across the Android modules into a single
io.sentry.android.lintconvention plugin inbuild-logic, and applies it to every Android module except the sample.The shared config is:
lint { warningsAsErrors = true checkGeneratedSources = true // new checkDependencies = true ignoreTestSources = true // new disable += "OldTargetApi" // centralized from the uitest modules checkReleaseBuilds = false }Two settings are new relative to the previous per-module blocks:
ignoreTestSources = true— makes AGP skip creating the test-source lint analysis tasks (lintAnalyzeDebugUnitTest/lintAnalyzeDebugAndroidTest). This is the main speed-up: onsentry-android-core, warm lint dropped from ~4.8s to ~1.8s (~60% faster), since unit-test analysis was the dominant cost.checkGeneratedSources = true— avoids false "unused" reports for code used only by generated classes (e.g. ViewBinding), per Tor Norbye's rationale.Implementation notes:
compileOnlydependency ofbuild-logic, so each module supplies its own AGP at runtime. This keeps the AGP compatibility matrix (8.7–8.9) unaffected — no second AGP copy is bundled.OldTargetApisuppression that previously lived in the two uitest modules is now centralized in the plugin (it's a no-op for library modules, which don't settargetSdk).test-app-plain,test-app-sentry,sentry-uitest-android-critical) carry pre-existing lint issues, so they getlint-baseline.xmlfiles rather than blocking the new strict config.test-app-sizelints clean onceOldTargetApiis centralized, so it needs no baseline.sentry-samples-androidkeeps its own sample-specific lint config and is intentionally left out.💡 Motivation and Context
Speed up
./gradlew checklint runs and remove the duplicatedlint {}block that was maintained by hand in ~11 module build files.💚 How did you test it?
Ran
linton every changed module and confirmed all pass, including that the newly-enabledcheckGeneratedSourcessurfaces no new errors and that the baselines filter the pre-existing issues in the test apps. Verified thebuild-logicplugin configures AGP's lint DSL at runtime withcompileOnlyAGP and thatignoreTestSourcesremoves the test-analysis tasks across library, KMP (sentry-compose), and application module types.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.
#skip-changelog