| <?xml version="1.0"?> |
| <!-- |
| ~ Licensed to the Apache Software Foundation (ASF) under one |
| ~ or more contributor license agreements. See the NOTICE file |
| ~ distributed with this work for additional information |
| ~ regarding copyright ownership. The ASF licenses this file |
| ~ to you under the Apache License, Version 2.0 (the |
| ~ "License"); you may not use this file except in compliance |
| ~ with the License. You may obtain a copy of the License at |
| ~ |
| ~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~ |
| ~ Unless required by applicable law or agreed to in writing, |
| ~ software distributed under the License is distributed on an |
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~ KIND, either express or implied. See the License for the |
| ~ specific language governing permissions and limitations |
| ~ under the License. |
| --> |
| |
| <project name="XmlSchema" basedir="." default="jar"> |
| |
| <property name="src.dir" value="${basedir}/src/main/java"/> |
| <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}/src/test/java"/> |
| <property name="test_classes.dir" value="${build.dir}/test-classes"/> |
| <property name="test_reports.dir" value="${build.dir}/test-reports"/> |
| <property name="test_reports_w3c.dir" value="${build.dir}/test-reports-w3c"/> |
| |
| <target name="setproxy" if="http.proxyhost"> |
| <setproxy proxyhost="${http.proxyHost}" proxyport="${http.proxyPort}"/> |
| </target> |
| |
| <target name="prepare" depends="setproxy"> |
| <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}"/> |
| <mkdir dir="${test_reports_w3c.dir}"/> |
| |
| <antcall target="prepareNistTest"/> |
| </target> |
| |
| <target name="prepareNistTest" unless="maven.test.skip"> |
| <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"/> |
| <untar src="${build.dir}/xsts-2002-01-16.tar.gz" compression="gzip" 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="tests/*Test*.java"/> |
| <include name="tests/w3c/TestW3CSchemaTestSet.java"/> |
| </fileset> |
| </batchtest> |
| |
| <sysproperty key="nistTestLocation" |
| value="${build.dir}/xmlschema2002-01-16/nisttest/NISTTestsAll"/> |
| |
| </junit> |
| </target> |
| |
| <target name="testw3c" depends="compile-tests" description="Runs the full bucket of W3C unit tests"> |
| <junit printsummary="yes" haltonfailure="no"> |
| <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_w3c.dir}"> |
| <fileset dir="${test.dir}"> |
| <include name="tests/w3c/TestW3CSchemaBucket.java"/> |
| </fileset> |
| </batchtest> |
| </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" 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> |