-
Notifications
You must be signed in to change notification settings - Fork 2
Building Rapidwright Applications with VS Code
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.
- Clone rapidwright to your machine:
mkdir ~/rapidwright
git clone https://github.com/Xilinx/RapidWright ~/rapidwright
- Update to the version you want to use:
cd ~/rapidwright
git checkout v2018.3.2-beta
-
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 linesrcDirs = ['com']
tosrcDirs = ['src']
-
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/*
- Build Rapidwright:
gradle build
- RapidWright will be compiled into
build/libs/rapidwright.jar
- 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
-
Navigate to the example project in this repo (https://github.com/byu-cpe/BYU-Computing-Tutorials/tree/master/rapidwright_example)
-
You can then build the project using
gradle build
and run the class usinggradle run
.
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
- This extension requires the use of a gradle wrapper. Create a gradle wrapper by running
- With VSCode correctly parsing your Gradle build, you will also be able to run and debug your code directly from VSCode: