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