Skip to content

Wire lint detectors into core AAR via lintPublish#181

Open
kirich1409 wants to merge 1 commit intomainfrom
fix/lint-publish-in-aar
Open

Wire lint detectors into core AAR via lintPublish#181
kirich1409 wants to merge 1 commit intomainfrom
fix/lint-publish-in-aar

Conversation

@kirich1409
Copy link
Copy Markdown
Contributor

Without lintPublish, the four lint detectors (#157, #158, #159 + existing HardcodedFlagValue) were published as a separate artifact but never activated automatically in Android Studio — users would have to add featured-lint-rules manually.

Changes

core/build.gradle.kts

  • Adds lintPublish(project(":featured-lint-rules")) so the lint JAR is embedded in featured-core.aar
  • Sets isTransitive = false on the lintPublish configuration — kotlin-stdlib is provided by the lint host at runtime; without this AGP fails with "Found more than one jar in lintPublish"

sample/android-app/build.gradle.kts

  • Adds compileOptions { sourceCompatibility/targetCompatibility = VERSION_21 } to match upstream modules (core, platform, etc. all compile to JVM 21); without this, Kotlin inline functions from JVM-21-compiled deps cause a compile error

Verification

lint.jar embedded in AAR:
  core/build/outputs/aar/core.aar → contains lint.jar ✅

Detector fires on consumer code:
  :sample:android-app:lintRelease →
  Warning: Accessing defaultValue directly on a ConfigParam ... [HardcodedFlagValue] ✅

Closes #— (no issue, discovered during v1.0.0 pre-release verification)

Without this, lint detectors (UncheckedFlagAccess, ExpiredFeatureFlag,
InvalidFlagReference, HardcodedFlagValue) were published as a separate
artifact but never activated automatically in consumer projects.

- core/build.gradle.kts: add lintPublish(project(":featured-lint-rules"))
  with isTransitive=false so AGP sees exactly one JAR (kotlin-stdlib is
  provided by the lint host at runtime)
- sample/android-app/build.gradle.kts: add compileOptions JVM 21 to
  match upstream modules and avoid inline-bytecode mismatch errors

Verified: lint.jar embedded in core.aar; HardcodedFlagValue detector
fires on consumer code via :sample:android-app:lintRelease.
@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

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