|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Modules |
| 4 | + |
| 5 | +- Multi-module Maven repo (root `pom.xml`) with three modules: |
| 6 | + - `sdk/`: the OpenTDF Java SDK (`sdk/src/main/java`, `sdk/src/main/kotlin`, tests in `sdk/src/test/java`) |
| 7 | + - `cmdline/`: shaded CLI jar (`cmdline/src/main/java`, resources in `cmdline/src/main/resources`) |
| 8 | + - `examples/`: runnable examples (`examples/src/main/java`) |
| 9 | +- Protobuf/gRPC sources are generated during the build into `sdk/target/generated-sources` (do not hand-edit generated code). |
| 10 | + |
| 11 | +## Build, Test, and Dev Commands |
| 12 | + |
| 13 | +- Build everything (runs codegen): `mvn clean install` |
| 14 | +- Fast local build (skip tests): `mvn clean install -DskipTests` |
| 15 | +- SDK unit tests: `mvn -pl sdk test` |
| 16 | +- Verify like CI (coverage profile): `mvn clean verify -P coverage` |
| 17 | +- Build CLI jar: `mvn -pl cmdline -am package` (output: `cmdline/target/cmdline.jar`) |
| 18 | +- Run an example via exec plugin: `mvn -pl examples exec:java@EncryptExample` |
| 19 | + |
| 20 | +## Coding Style & Naming |
| 21 | + |
| 22 | +- Target runtime: Java 11 (`maven.compiler.release=11`). CI runs on newer JDKs but compiles to 11 bytecode. |
| 23 | +- No repo-wide formatter is enforced; match surrounding style (4-space indent, no tabs, consistent import grouping). |
| 24 | +- Packages use `io.opentdf.platform...`; keep public SDK APIs stable and additive where possible. |
| 25 | + |
| 26 | +## Testing Guidelines |
| 27 | + |
| 28 | +- Tests use JUnit (Jupiter) plus Mockito/AssertJ; place new tests under `sdk/src/test/java` and name `*Test`. |
| 29 | +- Prefer focused unit tests over integration tests; keep network calls mocked (e.g., `MockWebServer`). |
| 30 | + |
| 31 | +## Commit & Pull Request Guidelines |
| 32 | + |
| 33 | +- Use Conventional Commits (enforced on PR titles): `feat(sdk): ...`, `fix(cmdline): ...`, `chore(docs): ...` (use `!` for breaking changes). |
| 34 | +- DCO sign-off is required: `git commit -s`. |
| 35 | +- PRs should include: summary, rationale, test plan/commands run, and any public API notes. |
| 36 | +- Build/dependency files (e.g., `pom.xml`, `sdk/pom.xml`) are code-owned and may require security/architecture review. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | + |
| 40 | +- Builds require the `buf` CLI (see `sdk/buf.yaml` / `sdk/buf.gen.yaml`). Authenticate to avoid rate limits; CI uses `BUF_INPUT_HTTPS_USERNAME`/`BUF_INPUT_HTTPS_PASSWORD`. Never commit tokens. |
0 commit comments