Added a line to remove the Jar file in the cleanall target.
[people/mcb30/edk2.git] / edk2 / Tools / Source / SurfaceArea / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!--\r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution.  The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8 \r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 -->\r
12 <project default="all" basedir="." name="SurfaceArea">\r
13   <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
14   <property environment="env" />\r
15   <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
16   <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
17 \r
18   <path id="classpath">\r
19     <fileset dir="${WORKSPACE}/Tools/Jars">\r
20       <include name="*.jar"/>\r
21     </fileset>\r
22     <fileset dir="${env.XMLBEANS_HOME}/lib">\r
23       <include name="*.jar"/>\r
24     </fileset>\r
25     <pathelement path = "${env.CLASSPATH}"/>\r
26   </path>\r
27 \r
28   <target name="init">\r
29     <uptodate targetfile="${WORKSPACE}/Tools/Jars/SurfaceArea.jar" property="jar.newer">\r
30       <srcfiles dir="${WORKSPACE}/Tools/XMLSchema" includes="*.xsd"/>\r
31     </uptodate>\r
32   </target>\r
33 \r
34   <!--\r
35     Generate SurfaceArea.jar and source code \r
36     -->\r
37   <target name="SurfaceArea.jar" depends="init">\r
38     <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler">\r
39       <classpath refid="classpath"/>\r
40       <arg value="-javasource"/>\r
41       <arg value="1.5"/>\r
42       <arg value="-dl"/>\r
43       <arg value="-out"/>\r
44       <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>\r
45       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>\r
46       <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>\r
47       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>\r
48     </java>\r
49   </target>\r
50   \r
51   <target name="SurfaceArea.java" depends="init">\r
52     <antcall target="SurfaceArea.java.clean"/>\r
53     <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler">\r
54       <classpath refid="classpath"/>\r
55       <arg value="-javasource"/>\r
56       <arg value="1.5"/>\r
57       <arg value="-dl"/>\r
58       <arg value="-srconly"/>\r
59       <arg value="-src"/>\r
60       <arg value="${WORKSPACE}/Tools/Source/SurfaceArea"/>\r
61       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>\r
62       <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>\r
63       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>\r
64     </java>\r
65   </target>\r
66   \r
67   <target name="SurfaceArea" depends="init" unless="jar.newer">\r
68     <antcall target="SurfaceArea.java.clean"/>\r
69     <java classname="org.apache.xmlbeans.impl.tool.SchemaCompiler">\r
70       <classpath refid="classpath"/>\r
71       <arg value="-javasource"/>\r
72       <arg value="1.5"/>\r
73       <arg value="-dl"/>\r
74       <arg value="-src"/>\r
75       <arg value="${WORKSPACE}/Tools/Source/SurfaceArea"/>\r
76       <arg value="-out"/>\r
77       <arg value="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>\r
78       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>\r
79       <arg value="${WORKSPACE}/Tools/XMLSchema/FarManifest.xsd"/>\r
80       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>\r
81     </java>\r
82   </target>\r
83   \r
84   <target name="SurfaceArea.java.clean">\r
85     <delete includeemptydirs="true">\r
86       <fileset dir="${WORKSPACE}/Tools/Source/SurfaceArea" includes="**/*" excludes="build.xml"/>\r
87     </delete>\r
88   </target>\r
89 \r
90   <target name="SurfaceArea.jar.clean">\r
91   </target>\r
92   \r
93   <!--\r
94     Surface Area Description file validation\r
95     -->\r
96   <target name="validate">\r
97     <echo message="Validating ... ${SURFACE_AREA_FILE}"/>\r
98     <!--\r
99       java -classpath %cp% org.apache.xmlbeans.impl.tool.InstanceValidator %*\r
100     -->\r
101     <copy file="${SURFACE_AREA_FILE}" tofile="${SURFACE_AREA_FILE}.xml"/>\r
102     <java classname="org.apache.xmlbeans.impl.tool.InstanceValidator" \r
103       outputproperty="XMLBEANS_OUTPUT" >\r
104           \r
105       <classpath refid="classpath"/>\r
106       <arg value="-dl"/>\r
107       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>\r
108       <arg value="${SURFACE_AREA_FILE}.xml"/>\r
109       \r
110     </java>   \r
111 \r
112     <delete file="${SURFACE_AREA_FILE}.xml" quiet="true"/>\r
113     <echo message="Result ... ${XMLBEANS_OUTPUT}"/>\r
114   </target>\r
115   \r
116   <!--\r
117     beautify xml file\r
118     -->\r
119   <target name="pretty">\r
120     <echo message="Beautify ... ${SURFACE_AREA_FILE}"/>\r
121     <!--\r
122       java -classpath %cp% org.apache.xmlbeans.impl.tool.PrettyPrinter %*\r
123     -->\r
124     <java classname="org.apache.xmlbeans.impl.tool.PrettyPrinter" \r
125       errorproperty="XMLBEANS_OUTPUT"\r
126       output="${SURFACE_AREA_FILE}">\r
127           \r
128       <classpath refid="classpath"/>\r
129       <arg value="-indent"/>\r
130       <arg value="2"/>\r
131       <arg value="${SURFACE_AREA_FILE}"/>\r
132       \r
133     </java>\r
134 \r
135     <if>\r
136       <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>\r
137       <then>\r
138         <echo message="Result ... DONE"/>\r
139       </then>\r
140       <else>\r
141         <echo message="Result ... ${XMLBEANS_OUTPUT}"/>\r
142       </else>\r
143     </if>\r
144   </target>\r
145 \r
146   <!--\r
147     generate Surface Area template file from schema\r
148     -->\r
149   <target name="generate">\r
150     <echo message="Generating ... ${SURFACE_AREA_FILE}"/>\r
151     <!--\r
152       java -classpath %cp% org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator %*\r
153     -->\r
154     <java classname="org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator" fork="true"\r
155       errorproperty="XMLBEANS_OUTPUT" \r
156       output="${SURFACE_AREA_FILE}.tmp">\r
157           \r
158       <classpath refid="classpath"/>\r
159       <arg value="-dl"/>\r
160       <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>\r
161       <arg value="-name"/>\r
162       <arg value="${SURFACE_AREA_ELEMENT}"/>\r
163       \r
164     </java>\r
165 \r
166     <concat destfile="${SURFACE_AREA_FILE}">\r
167       <header trimleading="yes" filtering="no"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]>\r
168       </header>\r
169       <fileset file="${SURFACE_AREA_FILE}.tmp"/>\r
170     </concat>\r
171     \r
172     <delete file="${SURFACE_AREA_FILE}.tmp" deleteonexit="true" quiet="true"/>\r
173     <if>\r
174       <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>\r
175       <then>\r
176         <echo message="Result ... DONE"/>\r
177       </then>\r
178       <else>\r
179         <echo message="Result ... ${XMLBEANS_OUTPUT}"/>\r
180       </else>\r
181     </if>\r
182   </target>\r
183 \r
184   <target name="clean" depends="SurfaceArea.java.clean">\r
185   </target>\r
186 \r
187   <target name="cleanall" depends="SurfaceArea.jar.clean">\r
188     <delete file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>\r
189     <if>\r
190       <available file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>\r
191       <then>\r
192         <echo message="You must manually remove the file: ${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>\r
193         <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>\r
194       </then>\r
195     </if>\r
196   </target>\r
197 \r
198   <target name="all" depends="SurfaceArea">\r
199   </target>\r
200 \r
201   <target name="install" depends="SurfaceArea.jar">\r
202   </target>\r
203 \r
204 </project>  \r