| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- | |
| Copyright (c) 2006, Intel Corporation | |
| All rights reserved. This program and the accompanying materials | |
| are licensed and made available under the terms and conditions of the BSD License | |
| which accompanies this distribution. The full text of the license may be found at | |
| http://opensource.org/licenses/bsd-license.php | |
| THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
| WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
| --> | |
| <project default="all" basedir="." name="SurfaceArea"> | |
| <taskdef resource="net/sf/antcontrib/antlib.xml"/> | |
| <property environment="env" /> | |
| <property name="WORKSPACE" value="${env.WORKSPACE}"/> | |
| <taskdef resource="net/sf/antcontrib/antlib.xml"/> | |
| <path id="classpath"> | |
| <fileset dir="${WORKSPACE}/Tools/Jars"> | |
| <include name="*.jar"/> | |
| </fileset> | |
| <fileset dir="${env.XMLBEANS_HOME}/lib"> | |
| <include name="*.jar"/> | |
| </fileset> | |
| <pathelement path = "${env.CLASSPATH}"/> | |
| </path> | |
| <target name="init"> | |
| <uptodate targetfile="${WORKSPACE}/Tools/Jars/SurfaceArea.jar" property="jar.newer"> | |
| <srcfiles dir="${WORKSPACE}/Tools/XMLSchema" includes="*.xsd"/> | |
| </uptodate> | |
| </target> | |
| <!-- | |
| Generate SurfaceArea.jar and source code | |
| --> | |
| <target name="SurfaceArea.jar" depends="init"> | |
| <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"> | |
| <classpath refid="classpath"/> | |
| <arg value="-javasource"/> | |
| <arg value="1.5"/> | |
| <arg value="-dl"/> | |
| <arg value="-out"/> | |
| <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/> | |
| </java> | |
| </target> | |
| <target name="SurfaceArea.java" depends="init"> | |
| <antcall target="SurfaceArea.java.clean"/> | |
| <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler"> | |
| <classpath refid="classpath"/> | |
| <arg value="-javasource"/> | |
| <arg value="1.5"/> | |
| <arg value="-dl"/> | |
| <arg value="-srconly"/> | |
| <arg value="-src"/> | |
| <arg value="${WORKSPACE}/Tools/Java/Source/SurfaceArea"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/> | |
| </java> | |
| </target> | |
| <target name="SurfaceArea" depends="init" unless="jar.newer"> | |
| <antcall target="SurfaceArea.java.clean"/> | |
| <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler" fork="true"> | |
| <classpath refid="classpath"/> | |
| <arg value="-javasource"/> | |
| <arg value="1.5"/> | |
| <arg value="-dl"/> | |
| <arg value="-src"/> | |
| <arg value="${WORKSPACE}/Tools/Java/Source/SurfaceArea"/> | |
| <arg value="-out"/> | |
| <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/> | |
| </java> | |
| </target> | |
| <target name="SurfaceArea.java.clean"> | |
| <delete includeemptydirs="true" failonerror="false"> | |
| <fileset dir="${WORKSPACE}/Tools/Java/Source/SurfaceArea" includes="org"/> | |
| </delete> | |
| </target> | |
| <target name="SurfaceArea.jar.clean"> | |
| </target> | |
| <!-- | |
| Surface Area Description file validation | |
| --> | |
| <target name="validate"> | |
| <echo message="Validating ... ${SURFACE_AREA_FILE}"/> | |
| <!-- | |
| java -classpath %cp% org.apache.xmlbeans.impl.tool.InstanceValidator %* | |
| --> | |
| <copy file="${SURFACE_AREA_FILE}" tofile="${SURFACE_AREA_FILE}.xml"/> | |
| <java classname="org.apache.xmlbeans.impl.tool.InstanceValidator" | |
| outputproperty="XMLBEANS_OUTPUT" | |
| errorproperty="XMLBEANS_ERROR"> | |
| <classpath refid="classpath"/> | |
| <arg value="-dl"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/> | |
| <arg value="${SURFACE_AREA_FILE}.xml"/> | |
| </java> | |
| <delete file="${SURFACE_AREA_FILE}.xml" quiet="true"/> | |
| <if> | |
| <or> | |
| <contains string="${XMLBEANS_OUTPUT}" substring="NOT valid"/> | |
| <contains string="${XMLBEANS_OUTPUT}" substring=": error:"/> | |
| <contains string="${XMLBEANS_ERROR}" substring="XmlException"/> | |
| <contains string="${XMLBEANS_ERROR}" substring=": error:"/> | |
| </or> | |
| <then> | |
| <echo message="Result ... ${XMLBEANS_OUTPUT}
${XMLBEANS_ERROR}"/> | |
| <fail message="${SURFACE_AREA_FILE} is invalid!"/> | |
| </then> | |
| <else> | |
| <echo message="Result ... ${SURFACE_AREA_FILE} is valid"/> | |
| </else> | |
| </if> | |
| </target> | |
| <!-- | |
| beautify xml file | |
| --> | |
| <target name="pretty"> | |
| <echo message="Beautify ... ${SURFACE_AREA_FILE}"/> | |
| <!-- | |
| java -classpath %cp% org.apache.xmlbeans.impl.tool.PrettyPrinter %* | |
| --> | |
| <java classname="org.apache.xmlbeans.impl.tool.PrettyPrinter" | |
| errorproperty="XMLBEANS_OUTPUT" | |
| output="${SURFACE_AREA_FILE}"> | |
| <classpath refid="classpath"/> | |
| <arg value="-indent"/> | |
| <arg value="2"/> | |
| <arg value="${SURFACE_AREA_FILE}"/> | |
| </java> | |
| <if> | |
| <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/> | |
| <then> | |
| <echo message="Result ... DONE"/> | |
| </then> | |
| <else> | |
| <echo message="Result ... ${XMLBEANS_OUTPUT}"/> | |
| </else> | |
| </if> | |
| </target> | |
| <!-- | |
| generate Surface Area template file from schema | |
| --> | |
| <target name="generate"> | |
| <echo message="Generating ... ${SURFACE_AREA_FILE}"/> | |
| <!-- | |
| java -classpath %cp% org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator %* | |
| --> | |
| <java classname="org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator" fork="true" | |
| errorproperty="XMLBEANS_OUTPUT" | |
| output="${SURFACE_AREA_FILE}.tmp"> | |
| <classpath refid="classpath"/> | |
| <arg value="-dl"/> | |
| <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/> | |
| <arg value="-name"/> | |
| <arg value="${SURFACE_AREA_ELEMENT}"/> | |
| </java> | |
| <concat destfile="${SURFACE_AREA_FILE}"> | |
| <header trimleading="yes" filtering="no"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]> | |
| </header> | |
| <fileset file="${SURFACE_AREA_FILE}.tmp"/> | |
| </concat> | |
| <delete file="${SURFACE_AREA_FILE}.tmp" deleteonexit="true" quiet="true"/> | |
| <if> | |
| <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/> | |
| <then> | |
| <echo message="Result ... DONE"/> | |
| </then> | |
| <else> | |
| <echo message="Result ... ${XMLBEANS_OUTPUT}"/> | |
| </else> | |
| </if> | |
| </target> | |
| <target name="clean" depends="SurfaceArea.java.clean"> | |
| </target> | |
| <target name="cleanall" depends="SurfaceArea.jar.clean"> | |
| <echo message="Removing Class Files and the Java Archive: SurfaceArea.jar"/> | |
| <delete file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/> | |
| <if> | |
| <available file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/> | |
| <then> | |
| <echo message="You must manually remove the file: ${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/> | |
| <echo message="Java has already loaded the file, and cannot remove it within ANT!"/> | |
| </then> | |
| </if> | |
| </target> | |
| <target name="all" depends="SurfaceArea"> | |
| </target> | |
| <target name="install" depends="SurfaceArea.jar"> | |
| </target> | |
| </project> |