-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore: Add a root AGENTS.md context file and consolidate shared info #12911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f5a4e74
chore: Add a root AGENTS.md context file and consolidate shared info
lqiu96 c6046d2
chore: Add missing AGENTS.md file for context
lqiu96 5a634d9
chore: fix skill relative paths and refine prerequisites in AGENTS.md
lqiu96 12cfa77
chore: Update sdk-platform-java/GEMINI.md
lqiu96 4086d26
Merge branch 'main' into add-root-context-file and resolve conflict i…
lqiu96 ff84d84
Slim down root AGENTS.md, delete java-development skill, and rename c…
lqiu96 2fecc7e
Address user comments on AGENTS.md: slim down Getting Started and rem…
lqiu96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,67 +1,30 @@ | ||
| --- | ||
| name: java-development | ||
| description: General guidance on Java development practices, building, testing, and style in the monorepo. Use this skill when working on Java code across the repository. | ||
| description: Workflow guidance for performing Java development tasks in this repository. | ||
| --- | ||
|
|
||
| # Java Development Guide | ||
| # Java Development Workflow | ||
|
|
||
| This skill provides general guidelines for Java development inside the monorepo. It covers building, formatting, testing, and style conventions to ensure consistency across modules. | ||
| Use this skill when tasked with modifying Java code, fixing bugs, or adding features. It guides you through the typical development lifecycle in this repo. | ||
|
|
||
| ## Workflow | ||
| ## Workflow Steps | ||
|
|
||
| ### 1. Building the Project | ||
| ### Step 1: Understand the Scope | ||
| - Determine if you are working on **Core Components** (`sdk-platform-java`) or a specific **Client Library** (`java-<service>`). | ||
| - Review the root [AGENTS.md](../../AGENTS.md) for the Style Guide and Dependency Management rules that apply repo-wide. | ||
|
|
||
| The repository uses Maven as its primary build system. | ||
| ### Step 2: Make Changes and Build | ||
| - Apply your code changes. | ||
| - To build efficiently, use the recommended flags or scoped builds detailed in [AGENTS.md](../../AGENTS.md#building-the-project). | ||
|
lqiu96 marked this conversation as resolved.
Outdated
|
||
|
|
||
| * **Build All Modules**: To build all modules from the root of the repository, run: | ||
| ```bash | ||
| mvn install -T 1C -P quick-build | ||
| ``` | ||
| > [!TIP] | ||
| > Use `-T 1C` to build modules in parallel (one thread per CPU core) and `-P quick-build` to skip unnecessary plugins for faster builds. | ||
| * **Build a Specific Module**: You can also run Maven commands within a specific module directory (e.g., `java-bigquery`) to build only that module. | ||
| ### Step 3: Determine and Run Tests | ||
| - If working on a **Client Library**, run its unit tests (`mvn test` in the module directory) and check its README for integration test procedures. | ||
| - If working on **Core Components** (`sdk-platform-java`), you **must** follow the testing heuristics in [sdk-platform-java/DEVELOPMENT.md](../../../sdk-platform-java/DEVELOPMENT.md#testing-guide) to know which tests are required. | ||
| - If golden files need updating, follow the specific procedures referenced in [AGENTS.md](../../AGENTS.md#specialized-development-guides). | ||
|
lqiu96 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### 2. Code Formatting | ||
| ### Step 4: Format Code | ||
| - You **must** ensure the code is formatted before completing a task. Use the formatting commands listed in [AGENTS.md](../../AGENTS.md#code-formatting). | ||
|
lqiu96 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Code formatting is enforced using the `fmt-maven-plugin`. | ||
|
|
||
| * **Check Formatting**: To check for formatting issues without modifying files, run: | ||
| ```bash | ||
| mvn fmt:check -T 1C | ||
| ``` | ||
| * **Apply Formatting**: To automatically format the code according to the project style, run: | ||
| ```bash | ||
| mvn fmt:format -T 1C | ||
| ``` | ||
| > [!TIP] | ||
| > To save time, run `mvn fmt:format` within the specific module directory you are working on, rather than at the root. | ||
| > [!NOTE] | ||
| > Always run `mvn fmt:format` before committing changes to avoid build failures due to formatting. | ||
|
|
||
| ### 3. Testing Strategy | ||
|
|
||
| * **Unit Tests**: Traditional unit tests should be added for individual classes and methods. Run them using: | ||
| ```bash | ||
| mvn test -T 1C | ||
| ``` | ||
| * **Integration Tests**: Many modules have integration tests that run against live services or emulators. These may require specific profiles or environment variables. Refer to the specific module's README for details. | ||
|
|
||
| ### 4. Style Guide | ||
|
|
||
| Follow these general rules to maintain code quality and consistency: | ||
|
|
||
| 1. **Minimize Visibility**: Default to the most restrictive access level possible. Avoid using `public` unless the class or method is intended to be part of the public API. | ||
| 2. Avoid Fully Qualified Names: Use imports to keep class names short and readable, rather than using fully qualified names in the code. | ||
| 3. **Avoid Obsolete APIs**: Do not call methods marked with `@ObsoleteApi` or `@Deprecated` unless there are no viable alternatives. | ||
| 4. **Clean Diffs**: Avoid unnecessary formatting changes or whitespace modifications to keep diffs clean and easy to review. | ||
|
|
||
| ### 5. Dependency Management | ||
|
|
||
| * **Version Bumps**: Try not to bump any external dependency versions unless there is a known security vulnerability (CVE) or a critical bug fix. | ||
| * **New Dependencies**: Avoid introducing new external dependencies. If a new dependency is required, provide a strong justification in the pull request. | ||
| * **Standard Library First**: Prefer to use features from the Java standard library, followed by existing dependencies in the project (preferably Google-managed dependencies). | ||
|
|
||
| ### 6. Contribution Guidelines | ||
|
|
||
| * **Commit Messages**: Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. Include the module as the scope (e.g., `feat(spanner): ...`, `fix(bigquery): ...`). | ||
| * **Pull Requests**: All code changes must be submitted via a pull request and require review. Ensure you pull the latest changes from `main` and resolve any conflicts before submitting. | ||
| ### Step 5: Verify and Document | ||
| - Verify that all tests pass and formatting is correct. | ||
| - Follow the Contribution Guidelines in [AGENTS.md](../../AGENTS.md#7-contribution-guidelines) for creating commits and PRs. | ||
|
lqiu96 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.