Build Script

The build script are run before tests. To add or modify, click the Settings icon in the left sidebar and locate the Build Script section:

Build Script setting

The value in the build script and run command is they will be executed in various locations throughout the content, such as:

  • When the user presses the primary (default: Run Code) button or

    Ctrl / Cmd + Enter

  • When the user runs an executable snippet

  • When a test case is run

Your build script will be run with Bash and must complete in under 15 seconds. The build script supports templates.

Example

The build script will vary depending on the language. It is just used for compiled languages (not interpreted languages). Here is an example of a build script for C++:

rm -f a.out
g++ -Wall -std=c++0x {{filenames}}

This first line removes the previously generated executable (if there is one), then recompiles the files using the g++ compiler. If you wish to compile only specific files in the lab, you may replace {{filenames}} with a list of filenames separated by spaces.