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