Ant script for Fluid components
The information on this page is out of date. Many new features are now available including the creation of custom builds.
This document offers information about the Ant script used to "build" and package the Fluid components.
Technology used:
- JSLint for Java - an Ant task for JSLint'ing files.
- YUI Compressor - for minifying Javascript files.
- Apache Ant
Overview: What the script can do
- Pre-process Javascript files for errors using JSLint.
- Concatenates and minifies Javascript files.
- Minifies CSS files.
- Produces a distribution package directory structure and a ZIP file.
How to use the script
ant buildall
- minifies all Javascript and CSS files.
- creates a minified and concatenated file of all Fluid specific Javascript called
Fluid-all.js
- creates a ZIP file of all of the above.
ant clean
- deletes the build and dist directories from the filesystem.
- Note: a "clean" is done during the buildall process as well.
ant validate
- Runs JSLint on the Javascript files residing in the
/Fluid-components/js/fluid/
directory. - Note: All other Javascript files outside of this directory are ignored.
How to change the release version
Edit the value for fluid_version in the build.properties
file.
<\!-\- the Fluid version number \--> fluid_version = 0.3
Fluid components dependency
With Javascript, the order in which they are included in a document matters because of dependency. For this reason the order in which Fluid files are concatenated matters as well.
To accomplish the correct order for concatenating Fluid files, there is a property in build.properties
that tells the ant script the sequence to process the files
<!-- Order of dependencies --> order_of_dependencies=Fluid.js,Reorderer.js,Portal.js,Lightbox.js
As dependencies are added to Fluid component source files, the order_of_dependencies
property should be updated.
How the script works
This is a more detailed description on how the Ant script works. It may be easier for you to look at the script first as it is well documented.
The build script creates two directories: /dist
, and /build
. /dist
is where the final output will be, which includes the minified, concatenated, and zipped files. /build
is a directory used by the script for manipulating files before it is output to the /dist
directory.
The concatenation process works by performing the Ant concatenation task in the order specified by the order_of_dependencies
variable in the build.properties
file. The source files are located in the src/webapp/fluid-components/js/fluid/
directory and concatenated together and that file output to:
build/fluid-components/js/fluid/Fluid-all.js
The script will also minify all relevant files (Javascript and CSS files, skipping over HTML and images) and put those into the appropriate subdirectories in build/fluid-components/js/
.
Before the distribution is created, all necessary files for the distribution package will be copied into the /build directory. The script will then generate 2 distribution packages:
dist/
- A directory structure containing the files required to use Fluid.dist/fluid-X.zip
- a compressed file of the above directory.
Building a WAR file
Currently the script does not build a .war file automatically. To build a .war file manually, execute
mvn clean install
inside the /build/war/
directory. This will create a .war file inside your local Maven2 repository.
Additional Information:
"Building Web Applications with Apache's Ant" by Julien Lecomte
"Adding JS/CSS compression and JS validation..." at henke.ws