diff --git a/docs/source/docs/contributing/assets/vscode-gradle-args.png b/docs/source/docs/contributing/assets/vscode-gradle-args.png new file mode 100644 index 000000000..77377e607 Binary files /dev/null and b/docs/source/docs/contributing/assets/vscode-gradle-args.png differ diff --git a/docs/source/docs/contributing/assets/vscode-gradle-tests.png b/docs/source/docs/contributing/assets/vscode-gradle-tests.png new file mode 100644 index 000000000..98754c57f Binary files /dev/null and b/docs/source/docs/contributing/assets/vscode-gradle-tests.png differ diff --git a/docs/source/docs/contributing/assets/vscode-runner-tests.png b/docs/source/docs/contributing/assets/vscode-runner-tests.png new file mode 100644 index 000000000..ea2ebbe8c Binary files /dev/null and b/docs/source/docs/contributing/assets/vscode-runner-tests.png differ diff --git a/docs/source/docs/contributing/building-photon.md b/docs/source/docs/contributing/building-photon.md index 2ced21eb1..fe0224a85 100644 --- a/docs/source/docs/contributing/building-photon.md +++ b/docs/source/docs/contributing/building-photon.md @@ -167,30 +167,31 @@ repositories { } ``` +### VSCode Test Runner Extension + +With the VSCode [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack), you can get the Test Runner for Java and Gradle for Java extensions. This lets you easily run specific tests through the IDE: + +```{image} assets/vscode-runner-tests.png +:alt: An image showing how unit tests can be ran in VSCode through the Test Runner for Java extension. +``` + +To correctly run PhotonVision tests this way, you must [delegate the tests to Gradle](https://code.visualstudio.com/docs/java/java-build#_delegate-tests-to-gradle). Debugging tests like this will [**not** currently](https://github.com/microsoft/build-server-for-gradle/issues/119) collect outputs. + ### Debugging PhotonVision Running Locally -One way is by running the program using gradle with the {code}`--debug-jvm` flag. Run the program with {code}`./gradlew run --debug-jvm`, and attach to it with VSCode by adding the following to {code}`launch.json`. Note args can be passed with {code}`--args="foobar"`. +Unit tests can instead be debugged through the ``test`` Gradle task for a specific subproject in VSCode, found in the Gradle tab: -``` -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Attach to Remote Program", - "request": "attach", - "hostName": "localhost", - "port": "5005", - "projectName": "photon-core", - } - ] -} +```{image} assets/vscode-gradle-tests.png +:alt: An image showing how unit tests can be debugged in VSCode through the Gradle for Java extension. ``` -PhotonVision can also be run using the gradle tasks plugin with {code}`"args": "--debug-jvm"` added to launch.json. +However, this will run all tests in a subproject. + +Similarly, a local instance of PhotonVision can be debugged in the same way using the Gradle ``run`` task. In both cases, additional arguments can be specified: + +```{image} assets/vscode-gradle-args.png +:alt: An image showing how VSCode gradle tasks can specify additional arguments. +``` ### Debugging PhotonVision Running on a CoProcessor