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:
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:
The javadocs output
All the jar files needed to run the cajoler
The compiled classes and resources
Unit test status and logs
Unit test coverage reports
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.
18.116.80.34