Skip to content

Building Rapidwright Applications with VS Code

Brent Nelson edited this page May 15, 2020 · 2 revisions

This page describes how to download and compile Rapidwright, and use it in your own applications. It explains how to use Gradle to build Rapidwright, and your own project, and how to edit, compile, and run your code using VSCode.

Download and Compile Rapidwright

  1. Clone rapidwright to your machine:
mkdir ~/rapidwright
git clone https://github.com/Xilinx/RapidWright ~/rapidwright
  1. Update to the version you want to use:
cd ~/rapidwright
git checkout v2018.3.2-beta
  1. If you are using a version of Rapidwright 2018 or earlier, you need to fix the code directory structure in order for it to compile with Gradle:

    • mkdir src
    • mv com src
    • Then edit the build.gradle file, and update the line srcDirs = ['com'] to srcDirs = ['src']
  2. Navigate to the appropriate release of RapidWright for the version you are using and download the ''rapidwright_data.zip'' and ''rapidwright_jars.zip'' file. Extract these files and place them such that you have this file structure:

  • ~/rapidwright/data/*
  • ~/rapidwright/jars/*
  1. Build Rapidwright: gradle build
  • RapidWright will be compiled into build/libs/rapidwright.jar

Creating your own RapidWright Application

  1. Set the environment variable RAPIDWRIGHT_PATH to be the installation path of RapidWright. You can do this by adding something like this to the end of your ~/.profile file. Make sure you re-launch your terminal after making this change.
export RAPIDWRIGHT_PATH=/mnt/c/Users/Jeff/rapidwright
  1. Navigate to the example project in this repo (https://github.com/byu-cpe/BYU-Computing-Tutorials/tree/master/rapidwright_example)

  2. You can then build the project using gradle build and run the class using gradle run.

Using VS Code

There are a few things to note if you are editing Gradle Java projects in VScode:

  • If you look at the gradle.build file, you will see the following. While this works on the command-line, VSCode has trouble figuring out where your files live when using the environment variable. Instead, use the commented out line and update the hard-coded path.
dependencies {
    compile files(System.env.RAPIDWRIGHT_PATH + '/build/libs/rapidwright.jar')
    // compile files('/mnt/c/Users/Jeff/rapidwright/build/libs/rapidwright.jar')
}
  • Install the Gradle Tasks extension.
    • This extension requires the use of a gradle wrapper. Create a gradle wrapper by running gradle wrapper in the example directory.
    • You should now see a sub-menu called GRADLE TASKS in the left-hand side of VSCode. This allows you to directly run the build and run commands from VSCode.
    • After you run the commands, they will be available through VSCode tasks: F1->Tasks: Run Task->gradle: run
  • With VSCode correctly parsing your Gradle build, you will also be able to run and debug your code directly from VSCode: