|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Guidance for coding agents working in `scip-java`, a Java and Kotlin indexer that |
| 4 | +produces [SCIP](https://github.com/scip-code/scip) index files. |
| 5 | + |
| 6 | +## Setup |
| 7 | + |
| 8 | +The recommended environment is provided via [Nix](https://nixos.org/download) and |
| 9 | +the repo's `flake.nix`, which pins `gradle`, `maven`, `bazelisk`, `nodejs`, |
| 10 | +`yarn`, `google-java-format`, `ktfmt`, and friends to the versions used in CI: |
| 11 | + |
| 12 | +```sh |
| 13 | +nix develop # default shell (JDK 11) |
| 14 | +nix develop .#jdk17 # JDK 17 |
| 15 | +nix develop .#jdk21 # JDK 21 |
| 16 | +``` |
| 17 | + |
| 18 | +Without Nix, you need at least `java`, `git`, `gradle`, and `mvn`. The build uses |
| 19 | +Gradle (`build.gradle.kts`, `settings.gradle.kts`); dependency and plugin |
| 20 | +versions live in `gradle/libs.versions.toml`. |
| 21 | + |
| 22 | +## Build, test, and lint |
| 23 | + |
| 24 | +Run from the repo root (commands match CI in `.github/workflows/nix.yaml`): |
| 25 | + |
| 26 | +```sh |
| 27 | +gradle test --no-daemon # run all Gradle tests |
| 28 | +gradle :scip-java:test --no-daemon # CLI build-tool integration tests |
| 29 | +gradle :scip-kotlinc:test --no-daemon # Kotlin compiler-plugin tests |
| 30 | +gradle :scip-snapshots:test --no-daemon # compare snapshot goldens |
| 31 | +gradle :scip-snapshots:saveSnapshots --no-daemon # regenerate snapshot goldens |
| 32 | +gradle :scip-java:installDist --no-daemon # build local dist under scip-java/build/install/ |
| 33 | +gradle :scip-java:run --args='--cwd DIRECTORY' # run scip-java against a build |
| 34 | + |
| 35 | +nix flake check -L # checks formatting (run from any shell) |
| 36 | +google-java-format --replace $(git ls-files '*.java') # format Java (from nix develop) |
| 37 | +ktfmt --kotlinlang-style $(git ls-files '*.kt') # format Kotlin (from nix develop) |
| 38 | +``` |
| 39 | + |
| 40 | +Formatting is enforced by `nix flake check`; run the formatters before |
| 41 | +finishing. There is also a Bazel build (`MODULE.bazel`, `bazelisk build //...`). |
| 42 | + |
| 43 | +## Conventions |
| 44 | + |
| 45 | +- Tests use JUnit 5 via Gradle's JUnit Platform. The snapshot suite is a JUnit |
| 46 | + `@TestFactory` that emits one dynamic test per generated document, comparing |
| 47 | + against committed goldens under `scip-snapshots/expected`. |
| 48 | +- Prefer running tests through Gradle rather than the IntelliJ UI. |
| 49 | + |
| 50 | +## Where the code lives |
| 51 | + |
| 52 | +- `scip-javac/src/main/java` — the Java compiler plugin that emits SCIP. |
| 53 | +- `scip-kotlinc` — the Kotlin compiler plugin. |
| 54 | +- `scip-java/src/main/kotlin` — the `scip-java` command-line interface. |
| 55 | +- `scip-java/src/test` — build-tool integration tests and fixtures (Kotlin). |
| 56 | +- `scip-shared`, `scip-aggregator`, `scip-maven-plugin`, `scip-gradle-plugin` — |
| 57 | + supporting modules (see `settings.gradle.kts` for the full layout). |
| 58 | +- `scip-snapshots` — slow snapshot tests indexing a corpus of published libraries. |
| 59 | +- `docs/`, `examples/` — documentation and example projects. |
| 60 | + |
| 61 | +See `CONTRIBUTING.md` for more detail. |
0 commit comments