Tuesday, October 18, 2011

Build System

The build system is extremely important. It provides a standardized way for anyone to build the system. Users can build and test the system without an IDE. Developers can build and test the system using their IDE of choice. This automated build is helpful in preventing errors, testing, and deployment. Developing a robust build system can ease the process when maintaining a large and/or complex software system.

My build system will need to become a template. As a template, I can adapt it to any project I create. The build system will be modular and extensible to become as big or as small as needed. It will integrate any third party build tools. It will handle junit, checkstyle, and any other third party build tools that the build system requires. It will be able to download, install, and manage all third party libraries needed. It will support web application development.

Below is the beginnings of a build file. It contains two targets, clean and compile. It's very simple in what its doing. I am studying the Ant manual to learn how to integrate the third party build tools and libraries into the build system.

1:  <project default="default">
2: <description>
3: The build file.
4: $Id$
5: </description>
6:
7:
8: <property name="src.dir" location="${basedir}/src"/>
9: <property name="build.dir" location="${basedir}/build"/>
10:
11:
12: <target name="clean"
13: description="Delete build/ directory.">
14: <delete dir="${build.dir}"/>
15: </target>
16:
17: <target name="compile"
18: description="Compiles the code.">
19: <!-- Ensure that the build output dir exists. -->
20: <mkdir dir="${build.dir}/classes"/>
21: <!-- Now compile the system. -->
22: <javac srcdir="${src.dir}"
23: destdir="${build.dir}/classes">
24: </javac>
25: </target>
26: </project>

No comments: