Skip to content

Commit

Permalink
Update compiler args doc for 2025 (#2867)
Browse files Browse the repository at this point in the history
* Update compiler args doc for 2025

* Update RLI
  • Loading branch information
sciencewhiz authored Dec 22, 2024
1 parent 77444b0 commit c09391e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions source/docs/software/advanced-gradlerio/compiler-args.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Using Compiler Arguments

Compiler arguments allow us to change the behavior of our compiler. This includes making warnings into errors, ignoring certain warnings and choosing optimization level. When compiling code a variety of flags are already included by default which can be found [here](https://github.com/wpilibsuite/native-utils/blob/v2024.7.2/src/main/java/edu/wpi/first/nativeutils/WPINativeUtilsExtension.java#L38). Normally it could be proposed that the solution is to pass them in as flags when compiling our code but this doesn't work in GradleRIO. Instead modify the build.gradle.
Compiler arguments allow us to change the behavior of our compiler. This includes making warnings into errors, ignoring certain warnings and choosing optimization level. When compiling code a variety of flags are already included by default which can be found [here](https://github.com/wpilibsuite/native-utils/blob/v2025.9.0/src/main/java/edu/wpi/first/nativeutils/WPINativeUtilsExtension.java#L38-L92). Normally it could be proposed that the solution is to pass them in as flags when compiling our code but this doesn't work in GradleRIO. Instead modify the build.gradle.

.. warning:: Modifying arguments is dangerous and can cause unexpected behavior.

## C++

### Platforms

Different compilers and different platforms use a variety of different flags. Therefore to avoid breaking different platforms with compiler flags configure all flags per platform. The platforms that are supported are listed [here](https://github.com/wpilibsuite/native-utils/blob/v2024.7.2/src/main/java/edu/wpi/first/nativeutils/WPINativeUtilsExtension.java#L96)
Different compilers and different platforms use a variety of different flags. Therefore to avoid breaking different platforms with compiler flags configure all flags per platform. The platforms that are supported are listed [here](https://github.com/wpilibsuite/native-utils/blob/v2025.9.0/src/main/java/edu/wpi/first/nativeutils/WPINativeUtilsExtension.java#L94-107)

### Configuring for a Platform

Expand Down Expand Up @@ -45,14 +45,10 @@ frcJava(getArtifactClass('FRCJavaArtifact')) {

By default the `src/main/deploy` directory in your project is transferred to the roboRIO when code is deployed. It is initiated by this section of the `build.gradle` file.

```groovy
frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
files = project.fileTree('src/main/deploy')
directory = '/home/lvuser/deploy'
deleteOldFiles = false // Change to true to delete files on roboRIO that no
// longer exist in deploy directory on roboRIO
}
```
.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/vscode-wpilib/refs/tags/v2025.1.1-beta-3/vscode-wpilib/resources/gradle/java/build.gradle
:language: groovy
:lines: 32-38
:lineno-match:

This will overwrite any duplicate files found in the `/home/lvuser/deploy` directory on the RIO and copy over any additional not present there. If `deleteOldFiles` is false it will not remove any files no longer present in the project deploy directory. Changing it to `true` helps prevent programs like :doc:`Choreo </docs/software/pathplanning/choreo/index>` and [PathPlanner](https://github.com/mjansen4857/pathplanner) from getting confused by files that were deleted locally but still exist on the roboRIO.

Expand Down

0 comments on commit c09391e

Please sign in to comment.