Skip to content
88 changes: 88 additions & 0 deletions .cursor/rules/new_module.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
description: Module Addition Rules for sentry-java
alwaysApply: false
---
# Module Addition Rules for sentry-java

## Overview

This document outlines the complete process for adding a new module to the sentry-java repository. Follow these steps in order to ensure proper integration and release management.

## Step-by-Step Process

### 1. Create the Module Structure

1. Create the new module, conforming to the existing naming conventions and build scripts

2. Add the module to the include list in `settings.gradle.kts`

If adding a `sentry-samples` module, also add it to the `ignoredProjects` list in the root `build.gradle.kts`:

```kotlin
ignoredProjects.addAll(
listOf(
// ... existing projects ...
"sentry-samples-{module-name}"
)
)
```

3. If adding a JVM sample, add E2E (system) tests, following the structure we have in the existing JVM examples.
The test should then be added to `test/system-test-runner.py` and `.github/workflows/system-tests-backend.yml`.

### 2. Create Module Documentation

Create a `README.md` in the module directory with the following structure:

```markdown
# sentry-{module-name}

This module provides an integration for [Technology/Framework Name].

Please consult the documentation on how to install and use this integration in the Sentry Docs for [Android](https://docs.sentry.io/platforms/android/integrations/{module-name}/) or [Java](https://docs.sentry.io/platforms/java/tracing/instrumentation/{module-name}/).
```

The following tasks are required only when adding a module that isn't a sample.

### 3. Update Main README.md

Add the new module to the packages table in the main `README.md` with a placeholder link to the badge:

```markdown
| sentry-{module-name} | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-{module-name}/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-{module-name}) | |
```

Note that the badge will only work after the module is released to Maven Central.

### 4. Add Documentation to docs.sentry.io

Add the necessary documentation to [docs.sentry.io](https://docs.sentry.io):
- For Java modules: Add to Java platform docs, usually in integrations section
- For Android modules: Add to Android platform docs, usually in integrations section
- Include installation instructions, configuration options, and usage examples

### 5. Post release tasks

Remind the user to perform the following tasks after the module is merged and released:

1. Add the SDK to the Sentry release registry, following the instructions in the [sentry-release-registry README](https://github.com/getsentry/sentry-release-registry#adding-new-sdks)

2. Add the module to `.craft.yml` in the `sdks` section:
```yaml
sdks:
# ... existing modules ...
maven:io.sentry:sentry-{module-name}:
```

## Module Naming Conventions

- Use kebab-case for module names: `sentry-{module-name}`
- Follow existing patterns: `sentry-okhttp`, `sentry-apollo-4`, `sentry-spring-boot`
- For version-specific modules, include the version: `sentry-apollo-3`, `sentry-apollo-4`

## Important Notes

1. **API Files**: Do not modify `.api` files manually. Run `./gradlew apiDump` to regenerate them
2. **Backwards Compatibility**: Ensure new features are opt-in by default
3. **Testing**: Write comprehensive tests for all new functionality
4. **Documentation**: Always include proper documentation and examples
3 changes: 3 additions & 0 deletions .cursor/rules/overview_dev.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
- `OtelSpanFactory`, `SentrySpanExporter`
- Tracing, distributed tracing

- **`new_module`**: Use when adding a new integration or sample module

### Testing
- **`e2e_tests`**: Use when working with:
- System tests, sample applications
Expand All @@ -58,5 +60,6 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
- Scope/Hub/forking → `scopes`
- Duplicate/dedup → `deduplication`
- OpenTelemetry/tracing/spans → `opentelemetry`
- new module/integration/sample → `new_module`
- Cache/offline/network → `offline`
- System test/e2e/sample → `e2e_tests`
Loading