| <?xml version="1.0"?> |
| <project name="XmlSchema" basedir="." default="jar"> |
| |
| <property name="src.dir" value="${basedir}/src"/> |
| <property name="project.name" value="XmlSchema"/> |
| <property name="output.jar" value="${project.name}.jar"/> |
| <property name="build.dir" value="${basedir}/build"/> |
| <property name="build_classes.dir" value="${build.dir}/classes"/> |
| <property name="build_lib.dir" value="${build.dir}/lib"/> |
| <property name="build_doc.dir" value="${build.dir}/apidoc"/> |
| <property name="dist.dir" value="${build.dir}/dist"/> |
| <property name="dist.zip" value="${project.name}.zip"/> |
| <property name="srcdist.zip" value="${project.name}-src.zip"/> |
| <property name="test.dir" value="${basedir}/test"/> |
| <property name="test_classes.dir" value="${build.dir}/test-classes"/> |
| <property name="test_reports.dir" value="${build.dir}/test-reports"/> |
| |
| <target name="prepare"> |
| <mkdir dir="${build_classes.dir}"/> |
| <mkdir dir="${build_lib.dir}"/> |
| |
| <condition property="downloadLibs"> |
| <not> |
| <available file="${build_lib.dir}/xmlunit-1.0.jar"/> |
| </not> |
| </condition> |
| |
| <antcall target="get-deps"/> |
| </target> |
| |
| <target name="get-deps" if="downloadLibs"> |
| <get src="http://www.ibiblio.org/maven2/xmlunit/xmlunit/1.0/xmlunit-1.0.jar" |
| dest="${build_lib.dir}/xmlunit-1.0.jar"/> |
| </target> |
| |
| <target name="prepare-tests"> |
| <mkdir dir="${test_classes.dir}"/> |
| <mkdir dir="${test_reports.dir}"/> |
| |
| <antcall target="prepareNistTest"/> |
| </target> |
| |
| <target name="prepareNistTest"> |
| <condition property="needsTestsDownload"> |
| <not> |
| <available file="${build.dir}/xmlschema2002-01-16"/> |
| </not> |
| </condition> |
| <antcall target="get-xml-schema-tests"/> |
| </target> |
| |
| <target name="get-xml-schema-tests" if="needsTestsDownload"> |
| <echo>Downloading 6MB XML Schema test suite. This make take a few minutes...</echo> |
| <get dest="${build.dir}/xsts-2002-01-16.tar.gz" |
| src="http://www.w3.org/XML/2004/xml-schema-test-suite/xmlschema2002-01-16/xsts-2002-01-16.tar.gz"/> |
| <gunzip src="${build.dir}/xsts-2002-01-16.tar.gz"/> |
| <untar src="${build.dir}/xsts-2002-01-16.tar" dest="${build.dir}"/> |
| </target> |
| |
| <target name="compile" depends="prepare" description="compiles the src and puts it in build/classes"> |
| <javac srcdir="${src.dir}" destdir="${build_classes.dir}" debug="true" |
| source="1.2" target="1.2" |
| deprecation="true"> |
| <include name="**/*.java" /> |
| </javac> |
| </target> |
| |
| <target name="compile-tests" depends="prepare-tests, compile" description="compiles the tests and puts them in build/test-classes"> |
| <javac srcdir="${test.dir}" destdir="${test_classes.dir}" debug="true" |
| deprecation="true"> |
| <classpath> |
| <pathelement location="${build_classes.dir}"/> |
| <fileset dir="${build_lib.dir}"> |
| <include name="*.jar" /> |
| </fileset> |
| </classpath> |
| <include name="**/*.java" /> |
| </javac> |
| </target> |
| |
| <target name="test" depends="compile-tests" description="Runs the unit tests"> |
| <junit printsummary="yes" haltonfailure="yes"> |
| <classpath> |
| <pathelement location="${build_classes.dir}"/> |
| <pathelement location="${test_classes.dir}"/> |
| <fileset dir="${build_lib.dir}"> |
| <include name="*.jar" /> |
| </fileset> |
| </classpath> |
| <formatter type="plain"/> |
| <batchtest todir="${test_reports.dir}"> |
| <fileset dir="${test.dir}"> |
| <include name="**/*Test*.java"/> |
| </fileset> |
| </batchtest> |
| |
| <sysproperty key="nistTestLocation" |
| value="${build.dir}/xmlschema2002-01-16/nisttest/NISTTestsAll"/> |
| |
| </junit> |
| </target> |
| |
| <target name="jar" depends="compile, test" description="compiles the src and creates XmlSchema.jar in build/lib"> |
| <jar jarfile="${build_lib.dir}/${output.jar}" compress="true" basedir="${build_classes.dir}"/> |
| </target> |
| |
| <target name="javadoc" depends="compile" description="Javadoc for Xml Schema API."> |
| <mkdir dir="${build_doc.dir}"/> |
| <javadoc packagenames="org.apache.axis.xsd.*" |
| destdir="${build.dir}/apidoc" |
| windowtitle="${project.name} API" |
| doctitle="${project.name}" |
| bottom="Copyright © Apache XML Schema Project. All Rights Reserved."> |
| <classpath> |
| <pathelement location="${build_classes.dir}"/> |
| </classpath> |
| <sourcepath> |
| <pathelement location="${src.dir}"/> |
| </sourcepath> |
| </javadoc> |
| </target> |
| |
| <target name="clean" depends="prepare" description="Clean all build products."> |
| <delete dir="${build.dir}"/> |
| </target> |
| |
| <target name="dist" depends="jar,javadoc" description="Creates a binary distribution(XmlSchema.zip) in build/dist"> |
| <mkdir dir="${dist.dir}"/> |
| <zip zipfile="${dist.dir}/${dist.zip}"> |
| <zipfileset dir="${build_lib.dir}" prefix="${project.name}/lib"/> |
| <zipfileset dir="${build_doc.dir}" prefix="${project.name}/doc"/> |
| </zip> |
| </target> |
| |
| <target name="srcdist" depends="compile" description="Creates a source distribution(XmlSchema-src.zip) in build/dist"> |
| <mkdir dir="${dist.dir}"/> |
| <zip zipfile="${dist.dir}/${srcdist.zip}"> |
| <zipfileset dir="${basedir}" includes="build.xml" prefix="${project.name}"/> |
| <zipfileset dir="${src.dir}" prefix="${project.name}/src"/> |
| </zip> |
| </target> |
| |
| </project> |