Skip to content

Commit 962ec5e

Browse files
authored
Merge branch 'main' into release-please--branches--main
2 parents 99df6d6 + edeb4ad commit 962ec5e

4 files changed

Lines changed: 161 additions & 236 deletions

File tree

.agents/skills/java-development/SKILL.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

AGENTS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Agents Guide for google-cloud-java
2+
3+
## 1. Overview
4+
This repository, `google-cloud-java`, contains the Java client libraries for Google Cloud Platform services, as well as core components in `sdk-platform-java`.
5+
6+
## 2. Project Structure
7+
The repository is a monorepo containing both generated and handwritten libraries, as well as core platform components and parent POMs.
8+
9+
### Core Modules
10+
- **`sdk-platform-java/`**: Contains foundational components for building client libraries.
11+
- **Note**: This directory has its own `GEMINI.md` file with detailed instructions specific to core development (GAPIC generator, GAX).
12+
- Includes `gapic-generator-java` (the generator) and `gax-java` (Google API Extensions).
13+
- **`google-auth-library-java/`**: The Google Auth Library for Java. This is a **handwritten** library used for authentication and credential management across all Google Cloud clients. It is a critical dependency for all client libraries.
14+
15+
### Parent Modules and BOMs
16+
- **`google-cloud-pom-parent/`**: The top-level parent POM for all modules in the repository. It manages plugin versions and common configuration.
17+
- **`google-cloud-jar-parent/`**: The parent POM for all client library JAR modules in the repository. It inherits from `google-cloud-pom-parent` and manages shared dependencies.
18+
- **`gapic-libraries-bom/`**: The Bill of Materials (BOM) that manages versions of all client libraries to ensure compatibility when used together.
19+
- **`java-shared-dependencies/`** (inside `sdk-platform-java`): Manages shared Maven dependencies for all Google Cloud Java client libraries to ensure consistency and avoid conflicts.
20+
21+
### Client Libraries (`java-<service>/`)
22+
Directories starting with `java-` are client libraries for specific Google Cloud services.
23+
- **Generated Clients**: The majority of these are automatically generated from service definitions (protos) using the GAPIC generator in `sdk-platform-java`.
24+
- **Handwritten & Split Repositories**: Some major libraries are either entirely handwritten or are maintained as "split repos" (they have their own standalone repositories in the `googleapis` GitHub organization but are also managed here). When working on these, be aware that changes may need to be synchronized with their respective split repos. Key examples include:
25+
- **BigQuery**: [java-bigquery](java-bigquery)
26+
- **BigQuery Storage**: [java-bigquerystorage](java-bigquerystorage)
27+
- **Spanner**: [java-spanner](java-spanner)
28+
- **Spanner JDBC**: [java-spanner-jdbc](java-spanner-jdbc)
29+
- **Storage**: [java-storage](java-storage)
30+
- **Storage NIO**: [java-storage-nio](java-storage-nio)
31+
- **Datastore**: [java-datastore](java-datastore)
32+
- **Logging**: [java-logging](java-logging)
33+
- **Logging Logback**: [java-logging-logback](java-logging-logback)
34+
35+
## 3. Getting Started
36+
This is a standard Maven project.
37+
- **Build all**: `mvn install -T 1C -P quick-build` from root (recommended).
38+
- **Scoped build**: Run `mvn` commands within specific module directories.
39+
- **Prerequisites**: Java 11+, Maven 3.0+, Bazelisk (for core integration tests).
40+
41+
## 4. Style Guide
42+
1. Minimize visibility scopes. Default to most restrictive access level.
43+
2. Use short names over fully qualified names.
44+
3. Avoid calling `@ObsoleteApi` or `@Deprecated` methods and classes.
45+
4. Avoid unnecessary formatting changes to keep diffs clean.
46+
5. Use `mvn` for everything other than the `test/integration` folder.
47+
48+
## 5. Dependency Management
49+
- Do not bump external dependency versions unless for CVE or critical bug fix.
50+
- Avoid introducing new external dependencies if possible. Prefer Java standard library, then opt for existing dependencies.
51+
52+
## 6. Contribution Guidelines
53+
- **Commits**: Conventional Commits `<type>(<scope>): <description>`.
54+
- **Pull Requests**: Submitted via PR, require review. Pull latest from main and resolve conflicts.
55+
- **Testing**: All new logic should be accompanied by tests.
56+
57+
## 7. Specialized Development Guides
58+
For development on core components, refer to the following guides in `sdk-platform-java`:
59+
- **GAPIC Generator**: [sdk-platform-java/gapic-generator-java/DEVELOPMENT.md](sdk-platform-java/gapic-generator-java/DEVELOPMENT.md)
60+
- **GAX**: [sdk-platform-java/gax-java/DEVELOPMENT.md](sdk-platform-java/gax-java/DEVELOPMENT.md)
61+
- **Hermetic Build**: [sdk-platform-java/hermetic_build/DEVELOPMENT.md](sdk-platform-java/hermetic_build/DEVELOPMENT.md)

sdk-platform-java/AGENTS.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Gemini CLI Context for sdk-platform-java
2+
3+
## 1. Overview
4+
5+
This directory, `sdk-platform-java`, contains the foundational components for building Java client libraries for Google Cloud Platform services. It includes the GAPIC (Generated API Client) generator for Java, the GAX (Google API Extensions) runtime library, and other shared modules.
6+
7+
For general project rules, style guides, dependency management, and contribution guidelines, please refer to the root [AGENTS.md](../AGENTS.md).
8+
9+
## 2. Project Structure
10+
11+
The repository is structured into several key modules:
12+
13+
* **`gapic-generator-java`**: The core component for creating new client libraries. It is a Protobuf compiler plugin that generates Java client libraries from API definition files. The `DEVELOPMENT.md` file in this module provides detailed information on how to work with the generator.
14+
15+
* **`gax-java`**: The Google API Extensions for Java (GAX) library. It provides runtime support for the generated client libraries, including features like pagination, request batching, and polling of long-running operations. It has the following submodules:
16+
* `gax`: Transport-independent part of GAX for Java.
17+
* `gax-grpc`: gRPC-specific logic for GAX.
18+
* `gax-httpjson`: REST-specific logic for GAX.
19+
20+
* **`api-common-java`**: Contains foundational types and utilities related to Google APIs. It includes the following packages:
21+
* `core`: Core library containing API stability annotations and wrappers around Guava types.
22+
* `pathtemplate`: Path Template library for manipulating strings that are formatted as Google API resource names.
23+
* `resourcenames`: Resource Name library used by generated resource name types.
24+
25+
* **`java-common-protos`**: Provides Protobuf-generated classes for common Google services that are used across multiple APIs. The code is in this module is auto-generated and should not be modified.
26+
27+
* **`java-iam`**: Contains Protobuf-generated classes for Google's Identity and Access Management (IAM) service, used for managing policies. The code is in this module is auto-generated and should not be modified.
28+
29+
* **`java-showcase`**: A demonstration client library for the "Showcase" API, which is a fake API used for integration testing of the GAPIC generator and GAX library.
30+
31+
* **`java-shared-dependencies`**: Manages shared Maven dependencies for all Google Cloud Java client libraries. This ensures consistency and helps avoid dependency conflicts.
32+
33+
## 3. Testing
34+
35+
For detailed testing strategy and heuristics on which tests to run based on code changes, please refer to [DEVELOPMENT.md](DEVELOPMENT.md).
36+
37+
### 3.1. Running Unit Tests
38+
39+
Unit tests can be tested via this command:
40+
41+
```sh
42+
mvn test
43+
```
44+
45+
### 3.2. Running Golden Integration Tests
46+
47+
Golden integration tests are run using Bazel. To run all golden integration tests, use the following command from the root of the repository:
48+
49+
```sh
50+
bazelisk test //...
51+
```
52+
53+
### 3.3. Running Showcase Integration Tests
54+
55+
```sh
56+
bazelisk test //test/integration:redis
57+
```
58+
59+
### 3.4. Updating Golden Files
60+
61+
If you make changes that affect the generated code, you will need to update the golden files. This can be done using the following command:
62+
63+
```sh
64+
bazelisk run //test/integration:update_asset && bazelisk run //test/integration:update_credentials && bazelisk run //test/integration:update_iam && bazelisk run //test/integration:update_kms && bazelisk run //test/integration:update_pubsub && bazelisk run //test/integration:update_logging && bazelisk run //test/integration:update_redis && bazelisk run //test/integration:update_storage && bazelisk run //test/integration:update_library && bazelisk run //test/integration:update_compute && bazelisk run //test/integration:update_bigtable && bazelisk run //test/integration:update_apigeeconnect
65+
```
66+
67+
### 3.5. Running Showcase Integration Tests
68+
69+
Showcase integration tests are run against a local server that implements the Showcase API. The `java-showcase/README.md` file provides detailed instructions on how to run these tests. The general steps are:
70+
71+
1. **Install the Showcase server:**
72+
73+
```sh
74+
go install github.com/googleapis/gapic-showcase/cmd/gapic-showcase@latest
75+
```
76+
77+
2. **Run the Showcase server:**
78+
79+
```sh
80+
gapic-showcase run
81+
```
82+
83+
3. **Run the integration tests:**
84+
85+
```sh
86+
cd java-showcase
87+
mvn verify -P enable-integration-tests
88+
```
89+
90+
## 4. File Exclusions & Loading Constraints
91+
92+
To maintain a highly focused context window and prevent memory overload:
93+
94+
* **Permanent Exclusions (Always Ignore):**
95+
* Do **NOT** load, read, or search through files under the directories `java-showcase-3.21.0/` and `java-showcase-3.25.8/`. Treat these folders as completely out of scope.
96+
* **Conditional Exclusions (Ignore by Default):**
97+
* By default, do **NOT** load, read, or search through files in the `test/` folder (which contains massive auto-generated integration golden files).
98+
* **Exceptions:** You are only authorized to load or modify files under `test/` when:
99+
1. The user explicitly asks you to *"update the golden files"* or *"inspect test files"*.
100+
2. You are actively executing the Golden Integration Update commands (e.g. `bazelisk run //test/integration:update_...`).

0 commit comments

Comments
 (0)