Issue #2. Handle CNAME responses
[captive-validator.git] / build.xml
index 6e20357..9a3ca9e 100644 (file)
--- a/build.xml
+++ b/build.xml
 <?xml version="1.0"?>
 
-<project default="compile" basedir=".">
+<project default="jar" basedir=".">
 
-  <!-- defaults -->
-  <property name="build.deprecation" value="off" />
-  <property name="build.debug" value="off" />
-
-  <!-- import local build options -->
   <property file="build.properties" />
-
-  <!-- import current version string -->
   <property file="VERSION" />
 
-  <!-- the base location to put build targets -->
+  <property name="distname" value="dnssecvaltool-${version}" />
+
   <property name="build.dir" value="build" />
-  <!-- where to put compiled class files -->
   <property name="build.dest" value="${build.dir}/classes" />
-  <!-- where to put generated jar files -->
   <property name="build.lib.dest" value="${build.dir}/lib" />
-  <!-- where to put generated javadocs -->
-  <property name="javadoc.dest" value="${build.dir}/doc" />
-  <!-- where to find the java source -->
   <property name="build.src" value="src" />
 
-  <!-- where to find external jar files -->
-  <property name="lib.dir" value="lib" />
-
-  <!-- where the unit tests reside -->
-  <property name="test.dir" value="test" />
-  <property name="test.reports" value="${test.dir}/reports" />
-
-  <!-- PREPARE targets -->
+  <property name="build.test.src" value="tests" />
+  <property name="build.test.dest" value="${build.dir}/tests/classes" />
 
-  <target name="prepare-env">
-    <!-- see if the 'test' directory exists -->
-    <available file="${test.dir}" type="dir" property="test.present" />
+  <property name="packages" value="com.verisignlabs.dnssec.*" />
+  <property name="doc.dir" value="docs" />
+  <property name="javadoc.dest" value="${doc.dir}/javadoc" />
 
-    <!-- set the standard classpath -->
-    <path id="project.classpath">
-      <pathelement location="${build.dest}" />
-      <fileset dir="${lib.dir}" includes="*.jar,*.zip" />
-    </path>
-    <property name="project.classpath" refid="project.classpath" />
-
-  </target>
+  <property name="lib.dir" value="lib" />
 
-  <target name="prepare-src" depends="prepare-env">
+  <!-- set the standard classpath -->
+  <path id="project.classpath">
+    <pathelement location="${build.dest}" />
+    <fileset dir="${lib.dir}" includes="*.jar,*.zip" />
+  </path>
+  <property name="project.classpath" refid="project.classpath" />
+
+  <!-- set the classpath for the unit tests -->
+  <path id="test.classpath">
+    <pathelement location="${build.dest}" />
+    <fileset dir="${lib.dir}" includes="*.jar,*.zip" />
+    <path location="${build.test.dest}" />
+    <path location="${build.dest}" />
+    <path location="${build.test.src}/junit-3.8.1.jar" />
+  </path>
+
+  <target name="prepare-src">
     <mkdir dir="${build.dest}" />
     <mkdir dir="${build.lib.dest}" />
   </target>
 
-  <target name="prepare-test" depends="prepare-src" if="test.present">
-    <mkdir dir="${test.dir}/${build.dest}" />
-    <mkdir dir="${test.reports}" />
-
-    <path id="test.classpath">
-      <pathelement location="${test.dir}/${build.dest}" />
-      <pathelement path="${project.classpath}" />
-      <fileset dir="${test.dir}/${lib.dir}" includes="*jar,*.zip" />
-    </path>
-    <property name="test.classpath" refid="test.classpath" />
-  </target>
-
-  <!-- BUILD targets -->
-
-  <target name="dnsjava">
-
-    <javac srcdir="dnsjava"
-           destdir="${build.dest}"
-           deprecation="${build.deprecation}"
-           debug="${build.debug}"
-           target="1.4"
-           source="1.4"
-           includes="org/xbill/DNS/" />
-    <jar destfile="${build.lib.dest}/dnsjava-unbound.jar"
-         basedir="${build.dest}"
-         includes="org/xbill/DNS/" />
-
+  <target name="prepare-test">
+    <mkdir dir="${build.test.dest}" />
   </target>
 
-  <target name="unbound-proto" depends="prepare-src, dnsjava" >
+  <target name="compile" depends="prepare-src" >
     <javac srcdir="${build.src}"
            destdir="${build.dest}"
-           deprecation="${build.deprecation}"
-           debug="${build.debug}"
-           target="1.4"
-           source="1.4"
            classpathref="project.classpath"
-           includes="se/rfc/unbound/" />
-  </target>
-  
-  <target name="unbound-proto-jar" depends="unbound-proto">
-    <jar jarfile="${build.lib.dest}/unbound-prototype.jar"
-         basedir="${build.dest}"
-         includes="se/rfc/unbound/" />
-         
+           deprecation="true"
+           includeantruntime="false"
+           includes="com/verisign/" />
   </target>
 
+  <target name="jar" depends="usage,compile">
 
-  <!-- DOC targets -->
-
-  <target name="javadoc-unbound-proto" depends="prepare-src">
-    <mkdir dir="${javadoc.dest}" />
-    <javadoc packagenames="se.rfc.unbound.*"
-             sourcepath="${build.src}"
-             overview=""
-             classpath="${project.classpath}"
-             destdir="${javadoc.dest}"
-             verbose="false"
-             version="true"
-             author="true"
-             use="true"
-             windowtitle="Unbound Prototype API Documentation">
-    </javadoc>
-  </target>
-
-  <!-- TEST targets -->
-  <target name="build-tests" depends="prepare-test, unbound-proto"
-          if="test.present">
-    <javac srcdir="${test.dir}/${build.src}"
-           destdir="${test.dir}/${build.dest}"
-           deprecation="${build.deprecation}"
-           debug="${build.debug}"
-           target="1.4"
-           source="1.4"
-           classpathref="test.classpath"
-           includes="se/rfc/unbound/" />
-  </target>
-
-  <target name="run-tests" depends="build-tests" if="test.present">
-    <junit printsummary="yes"
-           fork="yes"
-           dir="${test.dir}"
-           timeout="12000">
-      
-      <classpath>
-        <pathelement path="${test.classpath}" />
-      </classpath>
-      
-      <formatter type="plain" />
-
-      <batchtest todir="${test.reports}">
-        <fileset dir="${test.dir}/${build.dest}">
-          <include name="se/rfc/unbound/**/*Test.class" />
-        </fileset>
-      </batchtest>
-    </junit>
-
-  </target>
-
-  <!-- DIST targets -->
-
-  <property name="unbound-proto-distname" 
-            value="unbound-prototype-${version}" />
-
-  <target name="unbound-proto-dist"
-          depends="compile">
-
-    <tar tarfile="${unbound-proto-distname}.tar.gz"
-         compression="gzip">
-      <tarfileset mode="755"
-                  dir="."
-                  prefix="${unbound-proto-distname}">
-        <include name="bin/*.sh" />
-        <exclude name="bin/_*.sh" />
-      </tarfileset>
-
-      <tarfileset dir="."
-                  prefix="${unbound-proto-distname}">
-        <include name="lib/*.jar" />
-        <include name="etc/*.properties" />
-        <include name="etc/named.ca" />
-        <include name="etc/trust_anchors" />
-        <include name="etc/*_trust_anchors" />
-        <include name="VERSION" />
-        <include name="README" />
-        <include name="licenses/**" />
-        <exclude name="bin/**" />
-      </tarfileset>
+    <jar destfile="${build.lib.dest}/dnssecvaltool.jar">
+      <zipfileset dir="${build.dest}" includes="**/*.class" />
 
-      <tarfileset dir="${build.lib.dest}"
-                  prefix="${unbound-proto-distname}/lib">
-        <include name="*.jar" />
-      </tarfileset>
-    </tar>
-  </target>
-
-  <target name="unbound-proto-src-dist">
-
-    <tar tarfile="${unbound-proto-distname}-src.tar.gz"
-         compression="gzip">
-
-      <tarfileset mode="755"
-                  dir="."
-                  prefix="${unbound-proto-distname}">
-        <include name="bin/*.sh" />
-      </tarfileset>
-
-      <tarfileset dir="."
-                  prefix="${unbound-proto-distname}">
-        <include name="src/**/*.java" />
-        <include name="dnsjava/**" />
-        <include name="lib/*.jar" />
-        <include name="etc/*.properties" />
-        <include name="etc/named.ca" />
-        <include name="etc/trust_anchors" />
-        <include name="licenses/**" />
-        <include name="VERSION" />
-        <include name="README" />
-        <include name="build.xml" />
-        <exclude name="bin/**" />
-      </tarfileset>
-    </tar>
-
-  </target>
-
-  <target name="sign-dist" 
-          depends="unbound-proto-dist, unbound-proto-src-dist">
-    <exec executable="gpg">
-      <arg value="-a" />
-      <arg value="-s" />
-      <arg value="--detach-sig" />
-      <arg path="${unbound-proto-distname}.tar.gz" />
-    </exec>
-    <exec executable="gpg">
-      <arg value="-a" />
-      <arg value="-s" />
-      <arg value="--detach-sig" />
-      <arg path="${unbound-proto-distname}-src.tar.gz" />
-    </exec>
-    
-  </target>
-
-  <target name="flatten-jar-libs">
-
-    <mkdir dir="${build.dir}/jar" />
-
-    <unjar dest="${build.dir}/jar/">
-      <fileset dir="lib" includes="*.jar" />
-    </unjar>
-
-  </target>
-
-  <target name="unbound-resolver-jar" depends="compile, flatten-jar-libs">
-    
-    <!-- this attempts to make a single runnable jar file for the
-         validating iterative resolver version of this project -->
-    
-    <jar destfile="unbound-resolver.jar">
-      <fileset dir="${build.dest}"
-               includes="se/rfc/unbound/,org/xbill/DNS/" />
-      <fileset dir="${build.dir}/jar"
-               includes="**" />
+      <zipfileset src="${lib.dir}/dnsjava-2.1.9-vrsn-1.jar" />
+      <zipfileset src="${lib.dir}/log4j-1.2.15.jar" />
       <manifest>
-        <attribute name="Main-Class" value="se.rfc.unbound.server.Server" />
+        <attribute name="Main-Class"
+                   value="com.verisign.cl.DNSSECValTool" />
       </manifest>
     </jar>
-
   </target>
 
-  <target name="unbound-digtest-jar" depends="compile, flatten-jar-libs">
-
-    <jar destfile="unbound-digtest.jar">
-      <fileset dir="${build.dest}"
-               includes="se/rfc/unbound/,org/xbill/DNS/" />
-      <fileset dir="${build.dir}/jar"
-               includes="**" />
-      <manifest>
-        <attribute name="Main-Class" value="se.rfc.unbound.cl.DigTest" />
-      </manifest>
-    </jar>
-
+  <target name="javadoc" depends="usage">
+    <mkdir dir="${javadoc.dest}"/>
+    <javadoc packagenames="${packages}"
+             classpath="${project.classpath}"
+             sourcepath="${build.src}"
+             destdir="${javadoc.dest}"
+             verbose="true" author="true"
+             windowtitle="jdnssec-tools-${version}"
+             use="true">
+      <link href="http://java.sun.com/j2se/1.4.2/docs/api/" />
+      <link href="http://www.xbill.org/dnsjava/doc/" />
+    </javadoc>
   </target>
 
-  <!-- CLEAN targets -->
-
-  <target name="clean-unbound-proto" depends="prepare-env">
-    <delete dir="${build.dest}" />
-    <delete dir="${build.dir}/jar" />
-    <delete file="${build.lib.dest}/*.jar" />
+  <target name="dist" depends="usage,jar">
+    <property name="dprefix" value="dnssecvaltool-${version}" />
+    <property name="tarfile" value="${dprefix}.tar.gz" />
+    <tar destfile="${tarfile}" compression="gzip">
+      <tarfileset dir="${build.lib.dest}" prefix="${dprefix}"
+                  includes="*.jar" />
+      <tarfileset dir="." prefix="${dprefix}" includes="README" />
+    </tar>
   </target>
 
-  <target name="clean-unbound-tests" depends="prepare-env"
-          if="test.present">
-    <delete dir="${test.dir}/${build.dest}" />
-    <delete dir="${test.reports}" />
+  <target name="compile_tests" depends="prepare-test,compile">
+    <javac destdir="${build.test.dest}" debug="true"
+           classpathref="test.classpath"
+           includeantruntime="false"
+           target="1.4"
+           source="1.4">
+      <src path="${build.test.src}"/>
+    </javac>
   </target>
 
-  <target name="clean-dist" depends="prepare-env">
-    <delete>
-      <fileset dir="." includes="*.tar.gz" />
-    </delete>
+  <target name="test" depends="compile_tests">
+    <antcall target="_run_tests">
+      <param name="classpathref" value="tests.classpath" />
+    </antcall>
   </target>
 
+  <target name="_run_tests">
+    <junit fork="yes" forkmode="perTest" dir="${basedir}"
+           haltonerror="on" haltonfailure="on"
+           includeantruntime="true">
+      <classpath>
+        <path location="${build.dest}" />
+        <fileset dir="${lib.dir}" includes="*.jar,*.zip" />
+        <path location="${build.test.dest}" />
+        <path location="${build.dest}" />
+        <path location="${build.test.src}/junit-3.8.1.jar" />
+      </classpath>
 
-  <!-- MASTER targets -->
-  <target name="compile"
-          depends="usage, unbound-proto-jar">
-  </target>
+      <formatter type="plain" usefile="no" />
 
-  <target name="docs"
-          depends="javadoc-unbound-proto">
-  </target>
+      <test name="${testcase}" if="testcase" />
 
-  <target name="test"
-          depends="run-tests"
-          if="test.present">
+      <batchtest unless="testcase">
+        <fileset dir="${build.test.dest}">
+          <include name="**/*Test.class" />
+        </fileset>
+      </batchtest>
+    </junit>
   </target>
 
-  <target name="dist"
-          depends="usage, unbound-proto-dist, unbound-proto-src-dist">
+  <target name="clean" depends="usage">
+    <delete dir="${build.dest}" />
+    <delete dir="${build.lib.dest}" />
   </target>
 
-  <target name="clean" 
-          depends="usage, clean-unbound-proto, clean-unbound-tests, clean-dist">
-  </target>
 
-  <!-- USAGE target -->
-  <target name="usage" depends="prepare-env">
+  <target name="usage">
     <echo message=" " />
-    <echo message="Unbound Prototype v. ${version} Build System" />
-    <echo message="--------------------------------------" />
+    <echo message="DNSSECValTool v. ${version} Build System" />
+    <echo message="--------------------------------" />
     <echo message="Available Targets:" />
-    <echo message="  compile (default) - compiles the source code" />
-    <echo message="  test              - run the unit tests" />
-    <echo message="  dist              - create the distribution files" />
+    <echo message="  compile           - compiles the source code" />
+    <echo message="  jar (default)     - compiles the source code, creates jar" />
+    <echo message="  javadoc           - create javadoc from source" />
     <echo message="  clean             - delete class files" />
+    <echo message="  dist              - package it up" />
     <echo message="  usage             - this help message" />
     <echo message=" " />
   </target>
 
 </project>
-