Automation with open standards
In the past, my development tool-chain relied heavily on an IDE and build tools to provide automation services, Eclipes/Java/Ant, C#/Visual Studio/nAnt, and ActionScript /Eclipse/FDT/Ant.
Moving to open standard development projects, the road to automation was not so clear. But with research and perseverance I have been able to find a solution. While it presently contains the bare necessities (documentation, validation, unit testing, and repetitive tasks like minifiying, concatenation, etc), I am sharing it with all of you on Github (see below for links) with the hope that it will benefit others. I looked into ways of using Ant (a common build tool used in java) and to my surprise there were already some “Ant tasks” that allow a simple integration. Also I created a few tasks to help me with common and not so common tasks. Nowadays I am using Ant builds to do various things.
Css/JS Minification – To do minification I am using the YUICompressor. There is an open source project called js-build-tools that has a collection of ant tasks. So on all I need to do is include the task definitions (that will point to the jars) and then call the task:
<yuicompress infile=”somefile.js” outfile=”somefile.min.js” />
You can also create a target that calls the jar directly:
<apply executable=”java” parallel=”false”>
<fileset dir=”../js” includes=”*.js” excludes=”**/*.min.js,**/*.preprocessed.js” />
<mapper type=”glob” from=”*.js” to=”../js/*.min.js”/>
What’s next– Is that all? Not really, my plan is to continue adding new tasks to the projects so I can automatically run unit tests, code coverage, css/html validation, build css sprites and more! When working on a big project, and for continuous integration, you can combine this with other tools like Maven and Hudson. Hudson can pull the data from your repository and quickly run the builds and keep it in a common place for the rest of the team.
Ant build file: