svn-gvsig-desktop / tags / gvSIG_3D_Animation_1_9_SNAPSHOT_build_13 / binaries / ant / utilities.xml @ 33794
History | View | Annotate | Download (8.95 KB)
1 | 13236 | jmvivo | <project name="ant_libs"> |
---|---|---|---|
2 | <dirname file="${ant.file.ant_libs}" property="ant.file.ant_libs.dir"/> |
||
3 | 13296 | jmvivo | |
4 | <!--
|
||
5 | ====================================
|
||
6 | Compilation base properties
|
||
7 | ====================================
|
||
8 | -->
|
||
9 | 13236 | jmvivo | <property name="JUNIT_HOME" location="${ant.file.ant_libs.dir}" /> |
10 | 13272 | jmvivo | <property name="JavaSourceVersion" value="1.5"/> |
11 | <property name="JavaTargetVersion" value="1.5"/> |
||
12 | <property name="debug" value="on"/> |
||
13 | 19921 | jmvivo | <property name="debuglevel" value="lines, vars, source"/> |
14 | 13272 | jmvivo | <property name="encoding" value="ISO_8859_1"/> |
15 | 13236 | jmvivo | |
16 | 13296 | jmvivo | |
17 | |||
18 | |||
19 | <!--
|
||
20 | ====================================
|
||
21 | ant4eclipse library load
|
||
22 | ====================================
|
||
23 | -->
|
||
24 | 13236 | jmvivo | <taskdef resource="net/sf/ant4eclipse/antlib.xml" > |
25 | <classpath>
|
||
26 | <pathelement location="${ant.file.ant_libs.dir}/ant4eclipse-0.5.0.rc1.jar"/> |
||
27 | </classpath>
|
||
28 | </taskdef>
|
||
29 | |||
30 | 13296 | jmvivo | |
31 | |||
32 | |||
33 | <!--
|
||
34 | ====================================
|
||
35 | ant-contrib library load
|
||
36 | ====================================
|
||
37 | -->
|
||
38 | 13236 | jmvivo | <taskdef resource="net/sf/antcontrib/antlib.xml"> |
39 | <classpath>
|
||
40 | <pathelement location="${ant.file.ant_libs.dir}/ant-contrib-1.0b3.jar"/> |
||
41 | 13296 | jmvivo | <pathelement location="${ant.file.ant_libs.dir}/bcel-5.1.jar"/> |
42 | <pathelement location="${ant.file.ant_libs.dir}/commons-httpclient-3.0.1.jar"/> |
||
43 | <pathelement location="${ant.file.ant_libs.dir}/commons-logging-1.0.4.jar"/> |
||
44 | <pathelement location="${ant.file.ant_libs.dir}/ivy-1.3.1.jar"/> |
||
45 | 13236 | jmvivo | </classpath>
|
46 | </taskdef>
|
||
47 | 13296 | jmvivo | |
48 | |||
49 | |||
50 | 13804 | jmvivo | <!--
|
51 | ====================================
|
||
52 | gvSIG ant utilities library load
|
||
53 | ====================================
|
||
54 | -->
|
||
55 | <taskdef name="javacLikeEclipse" classname="org.gvsig.utilities.ant.taskdefs.JavacLikeEclipse"> |
||
56 | <classpath>
|
||
57 | <pathelement location="${ant.file.ant_libs.dir}/org.gvsig.utilities.ant.jar"/> |
||
58 | </classpath>
|
||
59 | </taskdef>
|
||
60 | 13296 | jmvivo | |
61 | |||
62 | 13804 | jmvivo | |
63 | 13236 | jmvivo | <!--
|
64 | 13296 | jmvivo | ====================================
|
65 | utilities tasks alias
|
||
66 | ====================================
|
||
67 | -->
|
||
68 | 13236 | jmvivo | |
69 | 13296 | jmvivo | <!--
|
70 | ** loadEclipseClasspath Task **
|
||
71 | |||
72 | 13236 | jmvivo | Load the classpath from eclipse into the property 'eclipseClasspath'
|
73 | of the project recived in 'project' attribute. 'project' must
|
||
74 | be a directory of the workspace.
|
||
75 | |||
76 | - Use 'property="otherProperty"' : for change the return property
|
||
77 | |||
78 | 13296 | jmvivo | Example:
|
79 | 13236 | jmvivo | |
80 | |||
81 | <target name="compile" description="compile the source" >
|
||
82 | <loadEclipseClasspath project="${basedir}>
|
||
83 | <mkdir dir="${build}" />
|
||
84 | <javac srcdir="${src}"
|
||
85 | destdir="${build}"
|
||
86 | source="${JavaSourceVersion}"
|
||
87 | target="${JavaTargetVersion}"
|
||
88 | debug="${debug}"
|
||
89 | debuglevel="${debuglevel}"
|
||
90 | classpath="${eclipseClasspath}"
|
||
91 | encoding="${encoding}"/>
|
||
92 | </target>
|
||
93 | |||
94 | -->
|
||
95 | <presetdef name="loadEclipseClasspath"> |
||
96 | <getEclipseClasspath
|
||
97 | property="eclipseClasspath" |
||
98 | runtime="true"/> |
||
99 | |||
100 | </presetdef>
|
||
101 | |||
102 | <!--
|
||
103 | 13296 | jmvivo | ** gvSIG-javac Task **
|
104 | 13236 | jmvivo | |
105 | 13296 | jmvivo | Javac whit default values to compile gvSIG proyects
|
106 | |||
107 | Example (minimal syntax):
|
||
108 | |||
109 | <gvSIG-javac
|
||
110 | classpath="${eclipseClasspath}"
|
||
111 | />
|
||
112 | |||
113 | Example with exclude:
|
||
114 | |||
115 | <gvSIG-javac
|
||
116 | classpath="${eclipseClasspath}"
|
||
117 | exclude="org/gvsig/test/**"
|
||
118 | />
|
||
119 | |||
120 | 13236 | jmvivo | -->
|
121 | 28156 | jmvivo | <presetdef name="gvSIG-javac-old"> |
122 | 13804 | jmvivo | <javacLikeEclipse
|
123 | srcdir="${src}" |
||
124 | 13236 | jmvivo | destdir="${build}" |
125 | source="${JavaSourceVersion}" |
||
126 | target="${JavaTargetVersion}" |
||
127 | 18104 | jmvivo | sourcepath="${eclipseClasspath}" |
128 | 19919 | jmvivo | debug="${debug}" |
129 | 28156 | jmvivo | debuglevel="" |
130 | 18104 | jmvivo | encoding="${encoding}"> |
131 | </javacLikeEclipse>
|
||
132 | </presetdef>
|
||
133 | |||
134 | 28156 | jmvivo | <macrodef name="gvSIG-javac"> |
135 | <attribute name="classpath" default=""/> |
||
136 | <attribute name="srcdir" default="${src}"/> |
||
137 | <attribute name="destdir" default="${build}"/> |
||
138 | <attribute name="source" default="${JavaSourceVersion}"/> |
||
139 | <attribute name="target" default="${JavaTargetVersion}"/> |
||
140 | <attribute name="sourcepath" default="${eclipseClasspath}"/> |
||
141 | <attribute name="debug" default="${debug}"/> |
||
142 | <attribute name="debuglevel" default="${debuglevel}"/> |
||
143 | <attribute name="encoding" default="${encoding}"/> |
||
144 | <attribute name="includes" default=""/> |
||
145 | <attribute name="excludes" default=""/> |
||
146 | <sequential>
|
||
147 | <echo>javac debug="@{debug}" debuglevel="@{debuglevel}"</echo> |
||
148 | <javac
|
||
149 | classpath="@{classpath}" |
||
150 | srcdir="@{srcdir}" |
||
151 | destdir="@{destdir}" |
||
152 | source="@{source}" |
||
153 | target="@{target}" |
||
154 | debug="@{debug}" |
||
155 | sourcepath="@{sourcepath}" |
||
156 | encoding="@{encoding}" |
||
157 | includes="@{includes}" |
||
158 | excludes="@{excludes}" |
||
159 | >
|
||
160 | </javac>
|
||
161 | <copy todir="@{destdir}" overwrite="true"> |
||
162 | <fileset
|
||
163 | dir="@{srcdir}" |
||
164 | defaultexcludes="yes" |
||
165 | excludes="**/*.java,**/.svn,**/*.class" |
||
166 | includes="**/**"/> |
||
167 | </copy>
|
||
168 | </sequential>
|
||
169 | </macrodef>
|
||
170 | |||
171 | 18104 | jmvivo | <!-- generamos siempre el debug
|
172 | <presetdef name="gvSIG-javac">
|
||
173 | <javacLikeEclipse
|
||
174 | srcdir="${src}"
|
||
175 | destdir="${build}"
|
||
176 | source="${JavaSourceVersion}"
|
||
177 | target="${JavaTargetVersion}"
|
||
178 | 13236 | jmvivo | debug="${debug}"
|
179 | debuglevel="${debuglevel}"
|
||
180 | sourcepath="${eclipseClasspath}"
|
||
181 | encoding="${encoding}">
|
||
182 | 13804 | jmvivo | </javacLikeEclipse>
|
183 | 13236 | jmvivo | </presetdef>
|
184 | 18104 | jmvivo | -->
|
185 | 13236 | jmvivo | |
186 | 13296 | jmvivo | <!--
|
187 | 13804 | jmvivo | ** gvSIG-import-build-number Target **
|
188 | 13236 | jmvivo | |
189 | 13296 | jmvivo | Automate import of build.number gvSIG file
|
190 | 13236 | jmvivo | |
191 | 13296 | jmvivo | Example (minimal syntax):
|
192 | |||
193 | <antcall target="gvSIG-import-build-number"/>
|
||
194 | |||
195 | -->
|
||
196 | |||
197 | <target name="gvSIG-import-build-number"> |
||
198 | <!-- check buildNumberFile property -->
|
||
199 | <if>
|
||
200 | <not>
|
||
201 | <and>
|
||
202 | <isset property="buildNumberFile"/> |
||
203 | <available file="${buildNumberFile}" type="file"/> |
||
204 | </and>
|
||
205 | </not>
|
||
206 | <then>
|
||
207 | 13526 | cesar | <fail message="Error: property buildNumberFile not set or file not available: ${buildNumberFile}"/> |
208 | 13296 | jmvivo | </then>
|
209 | </if>
|
||
210 | <property name="localBuildNumberFile" value="${basedir}/build.number"/> |
||
211 | <!-- copy the file if is needed-->
|
||
212 | <if>
|
||
213 | <not>
|
||
214 | <and>
|
||
215 | <available file="${localBuildNumberFile}" type="file"/> |
||
216 | <filesmatch file1="${buildNumberFile}" file2="${localBuildNumberFile}"/> |
||
217 | </and>
|
||
218 | </not>
|
||
219 | <then>
|
||
220 | <copy file="${buildNumberFile}" tofile="${localBuildNumberFile}" overwrite="true"/> |
||
221 | </then>
|
||
222 | </if>
|
||
223 | </target>
|
||
224 | |||
225 | 13341 | cesar | <!-- Declare Junit task -->
|
226 | <taskdef name="gvSIG-junit" classname="org.apache.tools.ant.taskdefs.optional.junit2.JUnitTask" onerror="fail"> |
||
227 | <classpath>
|
||
228 | 13351 | cesar | <pathelement location="${ant.file.ant_libs.dir}/junit.jar"/> |
229 | 13341 | cesar | <pathelement location="${ant.file.ant_libs.dir}/gvsig-ant-junit.jar"/> |
230 | </classpath>
|
||
231 | </taskdef>
|
||
232 | 13804 | jmvivo | |
233 | 13341 | cesar | <target name="generic-run-tests"> |
234 | <!--
|
||
235 | === Input Parameters ===
|
||
236 | JUnitSummaryFile: File to log the success of the project
|
||
237 | JUnitProjectResults: File to log the details of the JUnit execution
|
||
238 | TestSuite.Name: Name of the TestSuite class to run
|
||
239 | 13804 | jmvivo | |
240 | 13341 | cesar | === Throws ====
|
241 | JUnitTestFailed: If any of the tests failed
|
||
242 | -->
|
||
243 | <!-- define these properties in case they are not already set -->
|
||
244 | <property name="JUnitProjectResults" value="JUnitProjectResults"/> |
||
245 | <property name="JUnitProjectResultsFile" value="JUnitProjectResults.txt"/> |
||
246 | <property name="JUnitGlobalResults" value="JUnitGlobalResults"/> |
||
247 | <property name="JUnitGlobalResultsFile" value="JUnitGlobalResults.txt"/> |
||
248 | <property name="JUnitSummaryFile" location="JUnitSummary.txt"/> |
||
249 | <loadEclipseClasspath project="${basedir}"/> |
||
250 | <property name="test-classpath" value="${build-test}:${build}:${eclipseClasspath}"/> |
||
251 | <gvSIG-junit
|
||
252 | fork="yes" |
||
253 | dir="${basedir}" |
||
254 | printsummary="on" |
||
255 | haltonfailure="off" |
||
256 | errorproperty="gvsig.tests.error" |
||
257 | failureproperty="gvsig.tests.failure"> |
||
258 | <formatter type="brief" usefile="yes"/> |
||
259 | <classpath id="test-classpath" |
||
260 | path="${build-test}:${build}:${eclipseClasspath}"/> |
||
261 | <test name="${TestSuite.Name}" outFile="${JUnitProjectResults}" /> |
||
262 | </gvSIG-junit>
|
||
263 | <!-- define these properties in case they are not already set -->
|
||
264 | <property name="gvsig.tests.error" value="false"/> |
||
265 | <property name="gvsig.tests.failure" value="false"/> |
||
266 | <if>
|
||
267 | <and>
|
||
268 | <equals arg1="${gvsig.tests.error}" arg2="false" /> |
||
269 | <equals arg1="${gvsig.tests.failure}" arg2="false" /> |
||
270 | </and>
|
||
271 | <then>
|
||
272 | 13422 | cesar | <echo file="${JUnitSummaryFile}" append="true">JUnitTests for ${target.project.name}: SUCCESS.${line.separator}</echo> |
273 | 13341 | cesar | </then>
|
274 | <else>
|
||
275 | <throw id="JUnitTestFailed" message="JUnitTestFailed"/> |
||
276 | </else>
|
||
277 | </if>
|
||
278 | </target>
|
||
279 | 13804 | jmvivo | |
280 | 13341 | cesar | <target name="concat-test-output"> |
281 | <property name="target.project.dir" location="../${target.project.name}"/> |
||
282 | 13526 | cesar | <if>
|
283 | <available file="${target.project.dir}" type="dir"/> |
||
284 | <then>
|
||
285 | <echo append="yes" file="${JUnitGlobalResultsFile}">${line.separator}${line.separator} ===== Details for ${target.project.name}: =====${line.separator}</echo> |
||
286 | <concat destfile="${JUnitGlobalResultsFile}.tmp" |
||
287 | binary="true"> |
||
288 | <fileset file="${JUnitGlobalResultsFile}"/> |
||
289 | <fileset file="${target.project.dir}/${JUnitProjectResultsFile}"/> |
||
290 | </concat>
|
||
291 | <move file="${JUnitGlobalResultsFile}.tmp" tofile="${JUnitGlobalResultsFile}"/> |
||
292 | <delete file="${target.project.dir}/${JUnitProjectResultsFile}"/> |
||
293 | </then>
|
||
294 | </if>
|
||
295 | 13341 | cesar | </target>
|
296 | 13804 | jmvivo | |
297 | 13422 | cesar | <target name="compile-tests"> |
298 | <!-- Create the time stamp -->
|
||
299 | <tstamp/> |
||
300 | <!-- Create the build directory structure used by compile -->
|
||
301 | <mkdir dir="${build-test}"/> |
||
302 | <!-- Compile the Java code from ${src} to ${build} -->
|
||
303 | <loadEclipseClasspath project="${basedir}"/> |
||
304 | <gvSIG-javac
|
||
305 | srcdir="${src-test}" |
||
306 | destdir="${build-test}" |
||
307 | classpath="${eclipseClasspath}"/> |
||
308 | <copy todir="${build-test}"> |
||
309 | 13526 | cesar | <fileset dir="${src-test}" |
310 | 13422 | cesar | excludes="**/*.java"/> |
311 | </copy>
|
||
312 | </target>
|
||
313 | 13804 | jmvivo | |
314 | 13236 | jmvivo | </project> |