Setting Up Caja

Before we can test the Caja system against some actual files and gadgets, we need to obtain the Caja source from the project trunk and then build it.

First, we need to ensure that we have all of the prerequisites in place to download, build, and test the installation. Caja has the following minimum requirements:

  • Subversion (SVN) to download the source files from the trunk and to keep the downloaded project files up to date.

  • Java Development Kit (JDK) 6.

  • Apache Ant 1.7 for the build system.

  • JUnit for the testing framework. Once you’ve obtained it, simply place the junit.jar file in the $ANT_HOME/lib directory you set up for Ant.

Once we’ve met the prerequisites, we can start the process by obtaining the source code for the Caja project from the SVN trunk. Simply navigate to the folder location where you would like to load Caja and then run the following command:

svn checkout http://google-caja.googlecode.com/svn/trunk/ caja

This code issues an SVN checkout command against the Caja trunk and specifies our output directory to be the caja folder.

Next, we need to build the project using Ant. Simply navigate into the caja directory and run the ant command. This will initiate the Ant build process for the project:

cd caja
ant

After the build.xml script is loaded and the build process begins, you should be presented with the following output if the process is proceeding correctly:

Buildfile: build.xml

dirs:
.
.
.
BUILD SUCCESSFUL
Total time: 35 seconds

This series of build messages states what part of the build script is currently being processed, and gives you a BUILD SUCCESSFUL message to confirm that the process completed successfully.

Once the build has completed, you should see a series of new ant-* directories in the root of the Caja project directory:

ant-docs

The javadocs output

ant-jars

All the jar files needed to run the cajoler

ant-lib

The compiled classes and resources

ant-reports/tests/index.html

Unit test status and logs

ant-reports/coverage/index.html

Unit test coverage reports

ant-www

Output of demos

You should be aware of a number of important directories within the Caja project. The folder structure that you will be integrating with is:

caja
|
+--bin : executable files for compiling from the command line
|
+--docs : documentation files.
|
+--src : source code (java and javascript)
|  |
|  +--com
|     |
|     +--google
|        |
|        +--caja
|           |
|           +--lexer : Tokenization and escaping
|           |
|           +--parser : Parsers and tree implementations
|           |  |
|           |  +--ParseTreeNode.java : Main parse tree interface
|           |  |
|           |  +--quasiliteral : Syntactic sugar for parse tree xforms
|           |
|           +--opensocial : Dealing with Gadget specs
|           |
|           +--plugin : Transformations
|           |  |
|           |  +--PluginCompilerMain.java : main class
|           |  |
|           |  +--stages : Parse tree transforms
|           |
|           +--reporting : Error and warning messaging.
|
+--tests : test files and resources

We will be working primarily with the contents of the bin directory at the root of the project. This is where we will compile mixed HTML/JavaScript files and OpenSocial gadgets from the command line—a topic we will explore next.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.80.34