I think I want to store RoadRunner as source in my project repository. By adding a build file to the RoadRunner source code, I have created a generic build process. Does this count as modifying the project? The build file could be used by other projects to compile RoadRunner, but I don't know yet what those might be.
I think I want to store Apache Ant as binary outside my project repository. I don't think I'm going to modify Ant, I don't think I'm going to need more than one version, and I will probably use it to drive build processes in other projects.
The compile script below refers to the ant tool using the relative path apache-ant-1.8.4\bin\ant
. I could install it in Program Files and add its bin
directory to the path and just refer to ant
instead.
I see Ant as an external dependency in the same way as I see Java. I've never had a compelling reason to store the exact Java distribution in my project repository.
In the interests of keeping all my dependencies in one place, I could keep a copy of the Apache Ant binaries in the repository. This is how the RoadRunner tool distributes its dependencies on NekoHTML, Xerces, and its own RoadRunner library. Taken to the extreme, I might include Java, Windows, and all my device drivers. Where is the appropriate dividing line?
Apache Ant
To compile the RoadRunner source, I chose Apache Ant as an automated build tool. It's easier than using command-line tricks to do recursive compilation with javac, and will provide more flexibility when I need it.
I don't want to modify Ant or examine its implementation, but I need it to execute a build script. In this case, the binary distribution is more convenient than the source distribution. I downloaded the version 1.8.4 binary archive into my own project's working directory, and unzipped the archive into a subdirectory called apache-ant-1.8.4.
RoadRunner
RoadRunner is an experimental open-source tool written in Java for generating data-extraction wrappers for HTML. I want to use it in my own business intelligence project.
I want to study RoadRunner's implementation and might modify it to fit my needs. In this case, the source distibution is convenient. In any case, there is no binary distribution. I downloaded the version 0.02.11 source archive my own project's working directory, and unzipped the archive into a subdirectory called RoadRunner.
I adapted the Apache Ant example buildfile and added it to the RoadRunner directory. It looks like this:
<project name="RoadRunner" default="build" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src/roadrunner"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<path id="lib">
<!-- https://stackoverflow.com/questions/722774/getting-ant-javac-to-recognise-a-classpath -->
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by build -->
<mkdir dir="${build}"/>
</target>
<target name="build" depends="init"
description="build the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" classpathref="lib"/>
</target>
<target name="dist" depends="build"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Compiling RoadRunner
Now I can compile RoadRunner from the root of my project directory using a command like this:
apache-ant-1.8.4\bin\ant -buildfile RoadRunner\build.xml
The output is a set of class files in the new RoadRunner\build
directory.
I've saved this command into a batch script called Compile RoadRunner.bat
.
I think I should commit at least the Ant project and the batch script into my project, but I'm unsure about the rest.