[FR] Add support for Jetpack Keep

Open
#591 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
android, java
Domain
build-system

Research direction

Start by reading the linked Jetpack Keep documentation and locating how rules_android handles bytecode annotations and generates ProGuard/R8 rules. Determine how the listed annotations map to conditional keep rules, then verify that the generated rules retain reflection or JNI targets only when their callers are reachable.

Written by the indexing model from the issue text.

Description

Add support in rules_android for the new Jetpack Keep (androidx.annotation.keep) library of annotations (@UsesReflectionToConstruct, @UsesReflectionToAccessMethod, @UsesReflectionToAccessField, @UnconditionallyKeep, etc.).

Jetpack Keep allows developers to declare reflection and JNI contracts directly on the calling or target code rather than maintaining detached ProGuard/R8 configuration files. At build time, these bytecode annotations are read and translated into conditional keep rules (-if <caller> -keep <target>) so R8 (or other ProGuard-compatible shrinkers) only retains the reflection targets when the calling code is reachable.

Dominant language
Java
Stars
205
Forks
113
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/rules_android

All issues in bazelbuild/rules_android

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.