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
- Distinctive: line 31
Run from the repo root (the root build delegates into the included builds):
- Very specific: line 34
Run this before committing.
- Very specific: line 67
Prefer Google Truth for assertions in new unit tests (import com.google.common.truth.Truth.assertThat).
- Distinctive: line 90
Run a sample build with the debug agent attached, then connect a Remote JVM debug configuration from the IDE:
- Very specific: line 97
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 …
- Very specific: line 107
When rebasing, a release cut on main may have renamed the old "Unreleased" heading to a version number, leaving your entry under a released …
- Very specific: line 111
Commit subjects use conventional-commit style with a scope, e.g.
≈ “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.
Files
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, underplugin-build/src. It has its ownsettings.gradle.ktsandgradle.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;spotlessCheckruns in CI.make preMerge→./gradlew preMerge --continue— the full local verification that mirrors CI:checkon 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 theplugin-buildincluded 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.xmlplus an armoredverification-keyring.keys. Verification runs with key servers off, so a new signed dependency needs its key added to the keyring by hand: regeneration records thetrusted-keyentry 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 inplugin-build/gradle.lockfilewith 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-keysVerification only applies when a build runs standalone (-p <build>), not via the root composite, which is why CI has dedicatedverify-plugin-build-dependenciesandverify-compiler-plugin-dependenciesjobs. 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 useskotlin.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-cliDebugging 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-daemonIf 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-changelogto the PR description. The entry needs the PR number, which you can get withgh pr view --json number -q '.number'(orgh pr view <branch> ...).- When rebasing, a release cut on
mainmay have renamed the old "Unreleased" heading to a version number, leaving your entry under a released section. Move it back into an## Unreleasedsection at the top of the file (add the heading if it's missing).
- When rebasing, a release cut on
feat:PRs get a reminder to update sentry-docs.- Commit subjects use conventional-commit style with a scope, e.g.
fix(snapshots): ...,build(deps): ....
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
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.

