Packaging Resources
Mozile packages are made by copying the main Mozile directory, removing unnecessary files, and zipping the directory into an archive labelled mozile-X.Y.Z.zip, where X.Y.Z is the current version number.
Packages are uploaded to the CVS repository in the downloads directory. They are mirrored on the Mozdev download mirrors, but it can take several hours for all of the mirrors to update.
To make a Mozile package, or to compile a series of Mozile modules into a single mozile.js file, you can use our Apache Ant build script. You'll need Ant version 1.6.x installed. The tools/build.xml file contains the logic, and tools/build.properties contains user-modifiable settings. You just cd to the tools directory, then call ant. Here are some examples:
Example 3.7. Using Ant
Just run ant and a help message will be displayed. It lists the most important Ant build "targets" for Mozile: compile, doc, build, package, etc.
$cd /mozile/tools$antBuildfile: build.xml help: [echo] Mozile build tools. Targets: [echo] help Display this help message. [echo] compile Concatenate and compress source files into 'mozile.js'. [echo] doc Generate all documentation files. [echo] docbook Generate DocBook files. [echo] jsdoc Generate JSDoc files. [echo] build Assemble all of the files to be distributed. [echo] package Package everything into a zip archive. [echo] release Build everything and package Mozile for release. [echo] clean Clean up. BUILD SUCCESSFUL Total time: 1 second
Example 3.8. Compiling Mozile
The ant compile command will "compile" a version of mozile.js based on the modules property in the build.properties file. It concatenates those files together in sequence, then uses tools/jsmin.jar to strip all the comments and unnecessary white space. If the mozile.js file is newer than all the files in the src directory then Ant won't bother compiling it again.
$ant compileBuildfile: build.xml init: compile.check: compile: [delete] Deleting directory /mozile/www/0.8/build/compile [mkdir] Created dir: /mozile/www/0.8/build/compile [copy] Copying 15 files to /mozile/www/0.8/build/compile BUILD SUCCESSFUL Total time: 10 seconds$ant build
Example 3.9. Building Mozile
The ant clean build command will first clean up any new directories Ant might have created. Then it will assemble all of the Mozile files into build, ignoring unwanted files like CVS directories. The files copied are controlled by settings in the build.properties file.
$ant clean buildBuildfile: build.xml clean: [delete] Deleting directory /mozile/www/0.8/build [delete] Deleting directory /mozile/www/0.8/release init: build: [mkdir] Created dir: /mozile/www/0.8/build [copy] Copying 5 files to /mozile/www/0.8/build [mkdir] Created dir: /mozile/www/0.8/build/demos [copy] Copying 11 files to /mozile/www/0.8/build/demos [mkdir] Created dir: /mozile/www/0.8/build/doc [copy] Copying 122 files to /mozile/www/0.8/build/doc [mkdir] Created dir: /mozile/www/0.8/build/images [copy] Copying 45 files to /mozile/www/0.8/build/images [mkdir] Created dir: /mozile/www/0.8/build/jsunit [copy] Copying 44 files to /mozile/www/0.8/build/jsunit [mkdir] Created dir: /mozile/www/0.8/build/lib [copy] Copying 41 files to /mozile/www/0.8/build/lib [mkdir] Created dir: /mozile/www/0.8/build/src [copy] Copying 17 files to /mozile/www/0.8/build/src [mkdir] Created dir: /mozile/www/0.8/build/tests [copy] Copying 87 files to /mozile/www/0.8/build/tests [mkdir] Created dir: /mozile/www/0.8/build/tools [copy] Copying 7 files to /mozile/www/0.8/build/tools BUILD SUCCESSFUL Total time: 12 seconds
In order to use all of the targets in the build.xml script you'll need to have some other tools installed. For example, you need JSDoc installed to generate the JSDoc files, and you need the DocBook XSL files and Saxon installed in order to generate the DocBook documentation. Take a look at the comments in the build.properties file for the details.