Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .vscode/settings.recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// formatOnType and formatOnPaste is a very bad idea for slow formatters
// (such as an external Google Java Format invocation exec), so just on Save:
"editor.formatOnSave": true,
// Format the changed region, not the whole file, as CONTRIBUTING.md asks.
"editor.formatOnSaveMode": "modifications",
"editor.formatOnType": false,
"editor.formatOnPaste": false,

Expand All @@ -21,9 +23,8 @@
"source.addMissingImports": "never"
}
},
// Keep this version in sync with the same version in pom.xml
// NB: Changes to this are only taken into account on start-up, so need to restart.
"java.format.settings.google.version": "1.27.0",
"java.format.settings.google.version": "2.0.0",
// TODO https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/3050
"java.compile.nullAnalysis.mode": "automatic",
"java.completion.importOrder": ["#", "", "javax", "java"], //# is static
Expand Down
15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ information on using pull requests.
### Format

Code must be formatted according to the
[Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
[Google Java Style Guide](https://google.github.io/styleguide/javaguide.html),
using [`google-java-format`](https://github.com/google/google-java-format).
Format only the lines you change, with an IDE integration or with
[`google-java-format-diff.py`](https://github.com/google/google-java-format/blob/master/scripts/google-java-format-diff.py):

The Maven build will automagically run
[`google-java-format`](https://github.com/google/google-java-format) when you
locally build this project.
```shell
git diff -U0 $(git merge-base origin/main HEAD) | google-java-format-diff.py -p1 -i
```

Pull requests will fail to build if you forget to commit reformatted code, and
cannot be merged until you fix this.
Stage new files with `git add` first. In a fork, use the remote that points at
`google/adk-java` instead of `origin`.

### Single Commit

Expand Down
7 changes: 4 additions & 3 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ The project is built using Maven. Use the `./mvnw` wrapper script for all comman
./mvnw test
```

* **Format code**:
* **Format changed lines**:

```shell
./mvnw fmt:format
git diff -U0 $(git merge-base origin/main HEAD) | google-java-format-diff.py -p1 -i
```

* **Skip tests during build**:
Expand Down Expand Up @@ -91,7 +91,8 @@ Once started, the dev UI is available at `http://localhost:8000` (or the specifi

## Development Conventions

* **Coding Style**: The project follows the Google Java Style Guide. The `fmt-maven-plugin` is used to format the code automatically.
* **Coding Style**: The project follows the Google Java Style Guide. Format
changed lines with `google-java-format`.
* **Import Style**: Always use import statements instead of fully qualified class names in code. Prefer `import com.google.adk.agents.InvocationContext;` over using `com.google.adk.agents.InvocationContext` directly in the code.
* **Testing**: The project uses JUnit 5 for testing. Tests are located in the `src/test/java` directory of each module.
* **Contributing**: Contributions are welcome. Please see the `CONTRIBUTING.md` file for more information.
19 changes: 0 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,25 +450,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.27</version>
<dependencies>
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>1.27.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down
Loading