Skip to content

build: Extract shared Android lint config into a build-logic plugin#5767

Draft
runningcode wants to merge 1 commit into
mainfrom
claude/lint-performance-settings-8f9799
Draft

build: Extract shared Android lint config into a build-logic plugin#5767
runningcode wants to merge 1 commit into
mainfrom
claude/lint-performance-settings-8f9799

Conversation

@runningcode

Copy link
Copy Markdown
Contributor

📜 Description

Extracts the Android lint configuration that was copy-pasted across the Android modules into a single io.sentry.android.lint convention plugin in build-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: on sentry-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:

  • AGP is a compileOnly dependency of build-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.
  • The OldTargetApi suppression 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 set targetSdk).
  • The test/benchmark apps (test-app-plain, test-app-sentry, sentry-uitest-android-critical) carry pre-existing lint issues, so they get lint-baseline.xml files rather than blocking the new strict config. test-app-size lints clean once OldTargetApi is centralized, so it needs no baseline.
  • sentry-samples-android keeps its own sample-specific lint config and is intentionally left out.

💡 Motivation and Context

Speed up ./gradlew check lint runs and remove the duplicated lint {} block that was maintained by hand in ~11 module build files.

💚 How did you test it?

Ran lint on every changed module and confirmed all pass, including that the newly-enabled checkGeneratedSources surfaces no new errors and that the baselines filter the pre-existing issues in the test apps. Verified the build-logic plugin configures AGP's lint DSL at runtime with compileOnly AGP and that ignoreTestSources removes the test-analysis tasks across library, KMP (sentry-compose), and application module types.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

None.

#skip-changelog

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>
@sentry

sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.48.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 338.22 ms 442.92 ms 104.70 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

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

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.

1 participant