Building Terracotta
Currently, Terracotta uses a custom build system, called tcbuild, that utilizes JRuby, Ant, and LeafCutter to build the distribution. JRuby and LeafCutter are downloaded automatically so it is not necessary to have them installed in order to build. You will need to run tcbuild to download project dependencies before you'll be able to compile in Eclipse. Just run: $ ./tcbuild resolve_dependencies from the code/base subdirectory of your enlistment.
 |
We are in the process of migrating to Maven 2 as the build system for Terracotta. Information regarding the migration to Maven may be found at Maven Migration. |
Requirements
To build from source you must have the following installed:
 | Windows users building a source release version 2.2.1 or earlier must also have Cygwin installed and have the Cygwin bin directory in their PATH. This dependency on Cygwin has been removed in trunk. |
Once all of the required tools are installed, you must set the following environment variables:
| Environment Variable |
Value |
| ANT_HOME |
The root directory of the Ant installation on your system, e.g. C:\apache-ant-1.6.5 or /usr/local/ant |
| JAVA_HOME_14 |
The root directory of the Java 1.4 SDK on your system, e.g. C:\j2sdk1.4.2_13 or /usr/local/j2sdk1.4.2_13 |
| JAVA_HOME_15 |
The root directory of JDK 5 on your system, e.g. C:\jdk1.5.0_15 or /usr/local/jdk1.5.0_15 |
| JAVA_HOME_16 |
The root directory of JDK 6 on your system, e.g. C:\jdk1.6.0_05 or /usr/local/jdk1.6.0_05 |
For additional options for selecting the JDKs to use for building and testing, see Configuring JDK Versions.
Windows users should be sure to escape the space and backslash symbols when setting the above environment variables:
export JAVA_HOME_16=C:\\Program\ Files\\Java\\jdk1.6.0_05
export JAVA_HOME_15=C:\\Program\ Files\\Java\\jdk1.5.0_09
export JAVA_HOME_14=C:\\j2sdk1.4.2_13
Building From Source
To build the distribution from source, the tcbuild tool is used. tcbuild is located in the code/base directory, and should be executed from within that directory. To use tcbuild, change to the code/base directory:
The most commonly used targets are shown in the table below.
| Target |
Description |
| compile |
Compiles all source code for all modules. The compiled modules will be in the code/base/build directory, with one directory per module. |
| check |
Executes all tests for all modules. |
| create_package |
Assembles and packages a kit. The package will be placed in the code/base/build/dist directory. |
For a full list of build system targets see tcbuild Targets.
Examples
To compile all of the modules, make sure you are in the code/base directory, and then execute
To create a package file, execute
./tcbuild create_package DSO
Windows users should use tcbuild.bat instead of tcbuild.
Running Tests
The Terracotta source tree includes a comprehensive suite of automated unit and system tests. The tcbuild tool provides several targets for executing all or some of the tests included in the test suite.
| Target |
Description |
| check |
Runs all tests |
| check_one |
Runs a single named test where <test_name> is the class
name of the Java class containing the test to run. This
target will scan all modules to find the test.
Example: tcbuild check_one AssertTest |
| check_file |
Runs set of tests specified in a given file.
Each line of the file can be blank, a comment (starting with '#'),
or the fully qualified class name of the Java class containing a test.
Example: tcbuild check_file tests_to_run.txt |
| check_short |
Runs all tests in files called <modulename>/tests.unit.lists.short and <modulename>/tests.system.lists.short |
For a full list of build system targets see tcbuild Targets.
Some tests, such as those in the dso-container-tests module, require a web container such as Tomcat or WebLogic to run. To run these tests, you must have a suitable web container installed and tell tcbuild where to find it, which you do by setting the TC_CONTAINER_HOME environment variable. For example, if you wish to use Tomcat as the web container for the tests and Tomcat is installed at /opt/tomcat then you will need to set the TC_CONTAINER_HOME environment variable to /opt/tomcat.
Further Reading