Manually Editing the VSCode build.gradle file for VMX-pi

NOTE: Using the VMX-PI WPI Extension is the recommended method for modifying the VSCode build.gradle project file to for VMX-pi. However if manual editing is desired, the following directions below demonstrate how to modify build.gradle for VMX-pi.

After first creating your VSCode project (e.g., using the official “Creating a Robot Program” documentation), several VMX-pi specific configuration changes are required to each VSCode project’s build.gradle file:

  • The VMX-specific GradleRIO plugin which acquires, builds and deploys software for your VMX-pi.
  • The VMX-pi deployment target specifier.
  • The target raspbian platform used by Raspberry Pi.

NOTE: WPI Lib 2020 uses a different build.gradle format than the older 2019 version; 2019 build.gradle files cannot be used with WPI Lib 2020. Therefore, if using a 2019 build.gradle file you must first import that project as a 2020 project before making the modifications described below.

Current GradleRIO Plugin Version

Whenever new releases of VMX-pi WPI Library Software occur, the Kauai Labs FIRST GradleRIO plugin version will be updated. The latest version is always indicated on the Kauai Labs FIRST GradleRIO plugin page.

NOTE: Whenever updating the GradleRIO Plugin Version, be sure to rebuild your project; without rebuilding, your project may still be referencing an older version of the GradleRIO Plugin.

Updating the build.gradle project file

The specific build.gradle configurations are slightly different for Java and C++, as shown below.

Java

Configuring the VMX-specific GradleRIO Plugin and Version (NOTE: be sure to use the latest version)
Configuring the “vmxpi” deployment target
Configuring the WPI and 3rd-party vendor platform as “raspbian”

C++

Configuring the VMX-specific GradleRIO Plugin and Version (NOTE: be sure to use the latest version)

NOTE: For C++, the toolschainsPlugin must also be configured to indicate “withRaspbian()” – to ensure the linux C++ compiler for Raspberry Pi is used.
Configuring the “vmxpi” deployment target

Configuring the native target platform as “raspbian”