7e6368386fda57d20308d59b7c3f380dcd4bf274
[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/FarManifest.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/FarManifest.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" fork="true">
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/FarManifest.xsd"/>
80 <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsdconfig"/>
81 </java>
82 </target>
83
84 <target name="SurfaceArea.java.clean">
85 <delete includeemptydirs="true" failonerror="false">
86 <fileset dir="${WORKSPACE}/Tools/Source/SurfaceArea/org" includes="**/*"/>
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 resultproperty="XMLBEANS_RESULT"
105 errorproperty="XMLBEANS_ERROR">
106
107 <classpath refid="classpath"/>
108 <arg value="-dl"/>
109 <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
110 <arg value="${SURFACE_AREA_FILE}.xml"/>
111
112 </java>
113
114 <delete file="${SURFACE_AREA_FILE}.xml" quiet="true"/>
115 <if>
116 <contains string="${XMLBEANS_OUTPUT}" substring="NOT valid"/>
117 <then>
118 <fail message="Result ... ${XMLBEANS_OUTPUT}"/>
119 </then>
120 <else>
121 <echo message="Result ... ${XMLBEANS_OUTPUT}"/>
122 </else>
123 </if>
124 </target>
125
126 <!--
127 beautify xml file
128 -->
129 <target name="pretty">
130 <echo message="Beautify ... ${SURFACE_AREA_FILE}"/>
131 <!--
132 java -classpath %cp% org.apache.xmlbeans.impl.tool.PrettyPrinter %*
133 -->
134 <java classname="org.apache.xmlbeans.impl.tool.PrettyPrinter"
135 errorproperty="XMLBEANS_OUTPUT"
136 output="${SURFACE_AREA_FILE}">
137
138 <classpath refid="classpath"/>
139 <arg value="-indent"/>
140 <arg value="2"/>
141 <arg value="${SURFACE_AREA_FILE}"/>
142
143 </java>
144
145 <if>
146 <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>
147 <then>
148 <echo message="Result ... DONE"/>
149 </then>
150 <else>
151 <echo message="Result ... ${XMLBEANS_OUTPUT}"/>
152 </else>
153 </if>
154 </target>
155
156 <!--
157 generate Surface Area template file from schema
158 -->
159 <target name="generate">
160 <echo message="Generating ... ${SURFACE_AREA_FILE}"/>
161 <!--
162 java -classpath %cp% org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator %*
163 -->
164 <java classname="org.apache.xmlbeans.impl.xsd2inst.SchemaInstanceGenerator" fork="true"
165 errorproperty="XMLBEANS_OUTPUT"
166 output="${SURFACE_AREA_FILE}.tmp">
167
168 <classpath refid="classpath"/>
169 <arg value="-dl"/>
170 <arg value="${WORKSPACE}/Tools/XMLSchema/SurfaceArea.xsd"/>
171 <arg value="-name"/>
172 <arg value="${SURFACE_AREA_ELEMENT}"/>
173
174 </java>
175
176 <concat destfile="${SURFACE_AREA_FILE}">
177 <header trimleading="yes" filtering="no"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]>
178 </header>
179 <fileset file="${SURFACE_AREA_FILE}.tmp"/>
180 </concat>
181
182 <delete file="${SURFACE_AREA_FILE}.tmp" deleteonexit="true" quiet="true"/>
183 <if>
184 <equals arg1="${XMLBEANS_OUTPUT}" arg2=""/>
185 <then>
186 <echo message="Result ... DONE"/>
187 </then>
188 <else>
189 <echo message="Result ... ${XMLBEANS_OUTPUT}"/>
190 </else>
191 </if>
192 </target>
193
194 <target name="clean" depends="SurfaceArea.java.clean">
195 </target>
196
197 <target name="cleanall" depends="SurfaceArea.jar.clean">
198 <delete file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
199 <if>
200 <available file="${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
201 <then>
202 <echo message="You must manually remove the file: ${WORKSPACE}/Tools/Jars/SurfaceArea.jar"/>
203 <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
204 </then>
205 </if>
206 </target>
207
208 <target name="all" depends="SurfaceArea">
209 </target>
210
211 <target name="install" depends="SurfaceArea.jar">
212 </target>
213
214 </project>