audk/Tools/Source/SurfaceArea/build.xml

204 lines
6.8 KiB
XML

<?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/FDPManifest.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/Source/SurfaceArea"/>
<arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
<arg value="${WORKSPACE}/Tools/XMLSchema/FDPManifest.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">
<classpath refid="classpath"/>
<arg value="-javasource"/>
<arg value="1.5"/>
<arg value="-dl"/>
<arg value="-src"/>
<arg value="${WORKSPACE}/Tools/Source/SurfaceArea"/>
<arg value="-out"/>
<arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
<arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
<arg value="${WORKSPACE}/Tools/XMLSchema/FDPManifest.xsd"/>
<arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>
</java>
</target>
<target name="SurfaceArea.java.clean">
<delete includeemptydirs="true">
<fileset dir="${WORKSPACE}/Tools/Source/SurfaceArea" includes="**/*" excludes="build.xml"/>
</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" >
<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"/>
<echo message="Result ... ${XMLBEANS_OUTPUT}"/>
</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">
<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>