agentleFS
SentryKnown publishergetsentry/sentry-android-gradle-plugin/AGENTS.md

sentry-android-gradle-plugin

AGENTS.md186 starsChanged 3 months agoMITView on GitHub

Guidance for AI agents and new contributors working in this repo. For human-facing setup and debugging instructions, see CONTRIBUTING.md. The Sentry Android Gradle Plugin (SAGP). It uploads ProGuard/R8 mappings, debug files, and source context, and performs bytecode instrumentation (e.g. Room, OkHttp, file I/O). This is a Gradle composite build, not a single project. The root settings.gradle.kts orchestrates the sample apps under examples/ and pulls in three separate builds via includeBuild: - plugin-build/ — the actual plugin source lives here, under…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run from the repo root (the root build delegates into the included builds):

    line 31
  2. Very specific:

    Run this before committing.

    line 34
  3. Very specific:

    Prefer Google Truth for assertions in new unit tests (import com.google.common.truth.Truth.assertThat).

    line 67
  4. Distinctive:

    Run a sample build with the debug agent attached, then connect a Remote JVM debug configuration from the IDE:

    line 90
  5. Very specific:

    If breakpoints in task actions don't hit, the tasks may be up-to-date or served from the build cache — ./gradlew clean and add …

    line 97
  6. Very specific:

    When rebasing, a release cut on main may have renamed the old "Unreleased" heading to a version number, leaving your entry under a released …

    line 107
  7. Very specific:

    Commit subjects use conventional-commit style with a scope, e.g.

    line 111

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Guidance for AI agents and new contributors working in this repo. For human-facing setup and debugging instructions, see CONTRIBUTING.md.

What this is

The Sentry Android Gradle Plugin (SAGP). It uploads ProGuard/R8 mappings, debug files, and source context, and performs bytecode instrumentation (e.g. Room, OkHttp, file I/O).

Repository layout

This is a Gradle composite build, not a single project. The root settings.gradle.kts orchestrates the sample apps under examples/ and pulls in three separate builds via includeBuild:

  • plugin-build/ — the actual plugin source lives here, under plugin-build/src. It has its own settings.gradle.kts and gradle.properties. Look here first for plugin code.
  • sentry-kotlin-compiler-plugin/ — Kotlin compiler plugin which performs Jetpack Compose instrumentation, substituted into samples without publishing.
  • sentry-snapshots-runtime/ — snapshots runtime, also substituted into samples.

buildSrc/ holds version and dependency definitions (Dependencies.kt, plugin versions).

Requirements

  • JDK 17 and the Android SDK.

Common commands

Run from the repo root (the root build delegates into the included builds):

  • make format → ./gradlew spotlessApply — apply formatting (ktfmt, Google style). Run this before committing; spotlessCheck runs in CI.
  • make preMerge → ./gradlew preMerge --continue — the full local verification that mirrors CI: check on the root, the compiler plugin, the snapshots runtime, and each sample app.
  • ./gradlew integrationTest — runs the plugin's integration tests (publishes the compiler plugin to a local test repo first).
  • Plugin unit tests live in plugin-build: ./gradlew :plugin-build:test (or via the plugin-build included build).
  • Both published builds verify their dependencies with PGP signatures, with checksums only as the fallback for unsigned artifacts. Trust lives in each build's gradle/verification-metadata.xml plus an armored verification-keyring.keys. Verification runs with key servers off, so a new signed dependency needs its key added to the keyring by hand: regeneration records the trusted-key entry but not the key, and the build fails until someone adds it. Each file's header comment lists trust scopes deliberately narrower than the ones Gradle's bootstrap infers — regeneration preserves them, don't widen them back. Regenerate with:
    • plugin-build: scripts/relock-plugin-build.sh. It also pins resolved versions in plugin-build/gradle.lockfile with STRICT-mode locking, so adding, removing, or bumping a dependency fails the build until both files are regenerated.
    • sentry-kotlin-compiler-plugin: ./gradlew -p sentry-kotlin-compiler-plugin resolveAll spotlessCheck --write-verification-metadata pgp,sha256 --export-keys Verification only applies when a build runs standalone (-p <build>), not via the root composite, which is why CI has dedicated verify-plugin-build-dependencies and verify-compiler-plugin-dependencies jobs. See CONTRIBUTING.md.

Some tests upload mappings/source context and fail without an auth token:

export SENTRY_AUTH_TOKEN=<your_token>

Testing conventions

  • Prefer Google Truth for assertions in new unit tests (import com.google.common.truth.Truth.assertThat). Much of the existing suite still uses kotlin.test/JUnit assertions; don't rewrite those wholesale, but reach for Truth when adding new tests or touching assertions in a test you're already editing.
import com.google.common.truth.Truth.assertThat

assertThat(actual).isEqualTo(expected)
assertThat(list).containsExactly("a", "b").inOrder()

Local sentry-cli

To test against a local sentry-cli, set cli.executable in the target project's sentry.properties:

cli.executable=/path/to/your/local/sentry-cli

Debugging the plugin

Run a sample build with the debug agent attached, then connect a Remote JVM debug configuration from the IDE:

./gradlew :examples:android-instrumentation-sample:assembleDebug -Dorg.gradle.debug=true --no-daemon

If breakpoints in task actions don't hit, the tasks may be up-to-date or served from the build cache — ./gradlew clean and add --no-build-cache.

Pull request conventions

  • Changelog is enforced by dangerfile.js: every PR must add an entry to the "Unreleased" section of CHANGELOG.md that references the PR number (e.g. - Fix X ([#1234](...))). To opt out, add #skip-changelog to the PR description. The entry needs the PR number, which you can get with gh pr view --json number -q '.number' (or gh pr view <branch> ...).
    • When rebasing, a release cut on main may have renamed the old "Unreleased" heading to a version number, leaving your entry under a released section. Move it back into an ## Unreleased section at the top of the file (add the heading if it's missing).
  • feat: PRs get a reminder to update sentry-docs.
  • Commit subjects use conventional-commit style with a scope, e.g. fix(snapshots): ..., build(deps): ....

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.