newton
Newton
 

Newton: Building from Source

This page describes how to build Newton from source code.

The latest source code can be checked out from the Newton source repository, or a source distribution can be obtained from the Downloads page.

Software required to build Newton

The software required to build Newton is summarized in the table below:

Software Where to obtain it
Apache Ant 1.6.5 or later http://ant.apache.org/bindownload.cgi
Java Development Kit (JDK) release 5 or 6 Any Java 5 or 6 JDK, Java's reference implementation is at http://java.sun.com/j2se/

Ant Configuration

The Newton build requires some external jars on Ant's library path.

These can be specified explicitly each time ant is invoked, using ant -lib, but it's generally more convenient to use the antrc file:

Unix

Set environment variable NEWTON_SRC_HOME to point to the top of the Newton source tree:

export NEWTON_SRC_HOME=$HOME/newton

Add the following to $HOME/.antrc:

ANT_ARGS="-lib $NEWTON_SRC_HOME/global-build/lib/ant-lib"

Windows

The setup is similar, but you need very specific use of double quotes if the NEWTON_SRC_HOME path contains spaces (e.g. C:\Documents and Settings\user).

Set HOME environment variable so ant.bat finds antrc_pre.bat:

set HOME=%HOMEDRIVE%%HOMEPATH%

Set environment variable NEWTON_SRC_HOME to point to the top of the Newton source tree:

set NEWTON_SRC_HOME="%HOME%\newton"

Add the following to %HOME%\antrc_pre.bat:

set ANT_ARGS=-lib %NEWTON_SRC_HOME%\global-build\lib\ant-lib
Note
If ant complains "Target 'and' does not exist in this project", then it is probably due to not using double quotes exactly as above - ant.bat is expanding %ANT_ARGS% and breaking on the 'and' in C:\Documents and Settings.

Ant targets

To build Newton, change directory to the top of the source tree, then run the following command:

ant -lib global-build/lib/ant-lib clean install

This creates a binary installation in the build/install directory.

Note
If you have configured Ant as described above, then the command is simply ant clean install.

The following Ant targets are most useful:

Target Description
install Installs a distribution in the install.dir and compiles and builds the demo source
dist Builds and copies all libraries and config files to the dist director
test Runs all unit and system tests
unit.test Runs all junit unit tests
system.test Launches an osgi container and tests various services inside a running container
doc Generates javadoc documentation
clean Clears up all files generated by the above targets

The following targets can be useful for developers working on Newton development:

Target Description
install.container Compiles, builds and copies newton bundles to the install.dir
install.components Compiles, builds and copies newton components to the install.dir
install.demo Compiles and builds demo bundles within the install.dir