Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6803 buildadm 1
<?xml version="1.0"?>
2
 
3
<!--
4
   Licensed to the Apache Software Foundation (ASF) under one or more
5
   contributor license agreements.  See the NOTICE file distributed with
6
   this work for additional information regarding copyright ownership.
7
   The ASF licenses this file to You under the Apache License, Version 2.0
8
   (the "License"); you may not use this file except in compliance with
9
   the License.  You may obtain a copy of the License at
10
 
11
       http://www.apache.org/licenses/LICENSE-2.0
12
 
13
   Unless required by applicable law or agreed to in writing, software
14
   distributed under the License is distributed on an "AS IS" BASIS,
15
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
   See the License for the specific language governing permissions and
17
   limitations under the License.
18
-->
19
<!--
20
  =======================================================================
21
    Build file to fetch optional libraries for Apache Ant
22
  =======================================================================
23
-->
24
<project name="fetch" default="all" basedir=".">
25
 
26
  <description>
27
This build file downloads JAR files that optional Ant tasks use,
28
and installs them in a location that is accessible the next time Ant runs.
29
 
30
You can choose three locations, by going -Ddest=LOCATION on the command line
31
-Ddest=user     user lib dir  ${user.home}/.ant/lib
32
-Ddest=system   ant lib dir   ${ant.home}/lib
33
-Ddest=optional optional dir  $${basedir}/lib/optional  (for Ant developers)
34
 
35
You may also need to set proxy settings. On Java 1.5, Ant tries to get
36
this from the OS, unless you use the -noproxy option.
37
 
38
Proxies can be configured manually setting the JVM proxy values in the
39
ANT_OPTS environment variable.
40
 
41
For example, to set the proxy up in the tcsh shell, the command would
42
be something like:
43
 
44
For csh/tcsh:
45
 setenv ANT_OPTS "-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
46
For bash:
47
 export ANT_OPTS="-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080"
48
For Windows, set the environment variable in the appropriate dialog box
49
and open a new console. or, by hand
50
 set ANT_OPTS = -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080
51
  </description>
52
 
53
  <!-- Give user a chance to override without editing this file
54
       (and without typing -D each time it compiles it) -->
55
  <property file="${user.home}/.ant/ant.properties"/>
56
  <property name="lib.dir" location="lib"/>
57
  <property name="optional.dir" location="${lib.dir}/optional"/>
58
  <property name="userlib.dir" location="${user.home}/.ant/lib"/>
59
 
60
  <!-- Load in our properties table -->
61
  <property file="${lib.dir}/libraries.properties"/>
62
 
63
  <!-- Temporary cache for working files -->
64
  <property name="temp.dir" location="${user.home}/.ant/tempcache"/>
65
  <property name="keep.temp.dir" value="true"/>
66
 
67
  <import file="get-m2.xml"/>
68
 
69
  <target name="pick-dest">
70
    <fail>
71
      <condition>
72
        <not>
73
          <isset property="dest"/>
74
        </not>
75
      </condition>ERROR
76
Set -Ddest=LOCATION on the command line
77
  -Ddest=user     user lib dir  ${user.home}/.ant/lib
78
  -Ddest=system   ant lib dir   ${ant.home}/lib
79
  -Ddest=optional optional dir  $${basedir}/lib/optional  (for Ant developers)
80
    </fail>
81
 
82
    <condition property="dest.dir"
83
               value="${lib.dir}">
84
      <equals arg1="${dest}" arg2="system"/>
85
    </condition>
86
    <condition property="dest.dir"
87
               value="${optional.dir}">
88
      <equals arg1="${dest}" arg2="optional"/>
89
    </condition>
90
    <condition property="dest.dir"
91
               value="${userlib.dir}">
92
      <equals arg1="${dest}" arg2="user"/>
93
    </condition>
94
    <fail unless="dest.dir">Unknown destination : ${dest}</fail>
95
    <echo>Downloading to ${dest.dir}</echo>
96
    <property name="m2.dest.dir" value="${dest.dir}"/>
97
  </target>
98
 
99
 
100
  <target name="macros" depends="pick-dest,get-m2"
101
          xmlns:artifact="antlib:org.apache.maven.artifact.ant">
102
    <fail>
103
      Cannot execute multiple targets due to the bug in Maven Ant tasks
104
      <condition>
105
        <contains string="${ant.project.invoked-targets}" substring=","/>
106
      </condition>
107
    </fail>
108
    <macrodef name="f2">
109
      <attribute name="project"/>
110
      <attribute name="archive" default="@{project}"/>
111
      <attribute name="repository" default="${m2.repo}"/>
112
      <attribute name="id" default="central"/>
113
      <sequential>
114
        <fail>
115
          Unknown archive @{archive} -no property @{archive}.version defined in ${lib.dir}/libraries.properties.
116
          <condition>
117
            <not>
118
              <isset property="@{archive}.version"/>
119
            </not>
120
          </condition>
121
        </fail>
122
        <artifact:dependencies pathID="@{archive}.path" useScope="runtime">
123
          <dependency groupId="@{project}"
124
                      artifactId="@{archive}"
125
                      version="${@{archive}.version}">
126
            <!-- exclude dependencies of ant-antunit (they should be in optional scope) -->
127
            <exclusion groupId="org.apache.ant" artifactId="ant"/>
128
            <exclusion groupId="org.apache.ant" artifactId="ant-launcher"/>
129
          </dependency>
130
          <artifact:remoteRepository url="@{repository}" id="@{id}"/>
131
        </artifact:dependencies>
132
        <!-- now we are left with the problem of getting the files into our directory -->
133
        <copy todir="${dest.dir}">
134
          <path refid="@{archive}.path"/>
135
          <flattenmapper/>
136
        </copy>
137
      </sequential>
138
    </macrodef>
139
  </target>
140
 
141
  <target name="nonm2-macros" depends="pick-dest">
142
    <macrodef name="get-ftp-file">
143
      <attribute name="host"/>
144
      <attribute name="port" default="21"/>
145
      <attribute name="remotedir"/>
146
      <attribute name="filename"/>
147
      <attribute name="localdir" default="${dest.dir}"/>
148
      <attribute name="user" default="anonymous"/>
149
      <attribute name="pw" default="anonymous"/>
150
      <sequential>
151
        <ftp server="@{host}" port="@{port}" userid="@{user}" password="@{pw}" passive="true"
152
             remotedir="@{remotedir}" action="get" depends="true" preserveLastModified="true"
153
             skipFailedTransfers="true">
154
          <fileset dir="@{localdir}">
155
            <include name="@{filename}"/>
156
          </fileset>
157
        </ftp>
158
      </sequential>
159
    </macrodef>
160
  </target>
161
 
162
 
163
  <!-- any init stuff -->
164
  <target name="init" depends="macros"/>
165
 
166
  <target name="init-no-m2" depends="nonm2-macros"/>
167
 
168
  <target name="init-cache">
169
    <available property="temp.cache.already.exists" file="${temp.dir}" type="dir"/>
170
    <condition property="user.wants.temp.cache">
171
      <and>
172
        <isset property="keep.temp.dir"/>
173
        <not>
174
          <or>
175
            <equals arg1="${keep.temp.dir}" arg2="false" casesensitive="false"/>
176
            <equals arg1="${keep.temp.dir}" arg2="no" casesensitive="false"/>
177
            <equals arg1="${keep.temp.dir}" arg2="off" casesensitive="false"/>
178
          </or>
179
        </not>
180
      </and>
181
    </condition>
182
    <condition property="delete.temp.cache">
183
      <and>
184
        <not>
185
          <isset property="temp.cache.already.exists"/>
186
        </not>
187
        <not>
188
          <isset property="user.wants.temp.cache"/>
189
        </not>
190
      </and>
191
    </condition>
192
  </target>
193
 
194
  <target name="-setup-temp-cache" depends="init-cache" unless="temp.cache.already.exists"
195
          description="Set up temporary cache for downloaded files">
196
    <mkdir dir="${temp.dir}"/>
197
  </target>
198
 
199
  <target name="-cleanup-temp-cache" depends="init-cache" if="delete.temp.cache"
200
          description="Get rid of the temporary cache directory">
201
    <delete dir="${temp.dir}"/>
202
  </target>
203
 
204
 
205
  <target name="diag" depends="init">
206
    <echoproperties/>
207
  </target>
208
 
209
  <target name="antunit"
210
          description="load AntUnit library"
211
          depends="init">
212
    <f2 project="org.apache.ant" archive="ant-antunit"/>
213
  </target>
214
 
215
  <target name="ivy"
216
          description="load Ivy dependency manager"
217
          depends="init">
218
    <f2 project="org.apache.ivy" archive="ivy"/>
219
  </target>
220
 
221
  <target name="logging"
222
          description="load logging libraries (Commons and Log4j)"
223
          depends="init">
224
    <f2 project="log4j"/>
225
    <f2 project="commons-logging" archive="commons-logging-api"/>
226
  </target>
227
 
228
  <target name="junit"
229
          description="load JUnit libraries"
230
          depends="init">
231
    <f2 project="junit"/>
232
    <f2 project="org.hamcrest" archive="hamcrest-library"/>
233
  </target>
234
 
235
  <target name="junitlauncher"
236
    description="load junitlauncher libraries"
237
    depends="init">
238
    <f2 project="org.junit.platform" archive="junit-platform-launcher" />
239
  </target>
240
 
241
  <target name="junit-engine-jupiter"
242
          description="load junit jupiter engine libraries (necessary only for internal Ant project tests)"
243
          depends="init">
244
    <f2 project="org.junit.jupiter" archive="junit-jupiter-engine" />
245
  </target>
246
 
247
  <target name="junit-engine-vintage"
248
          description="load junit vintage engine libraries (necessary only for internal Ant project tests)"
249
          depends="init">
250
    <f2 project="org.junit.vintage" archive="junit-vintage-engine" />
251
  </target>
252
 
253
  <target name="xml"
254
          description="load full XML libraries (Xalan and xml-resolver)"
255
          depends="init">
256
    <f2 project="xalan"/>
257
    <f2 project="xml-resolver"/>
258
  </target>
259
 
260
  <target name="networking"
261
          description="load networking libraries (commons-net and JSch)"
262
          depends="init">
263
    <f2 project="commons-net"/>
264
    <f2 project="com.jcraft" archive="jsch"/>
265
  </target>
266
 
267
  <target name="regexp"
268
          description="load regexp libraries"
269
          depends="init">
270
    <f2 project="jakarta-regexp"/>
271
    <f2 project="oro"/>
272
  </target>
273
 
274
  <target name="antlr"
275
          description="load ANother Tool for Language Recognition (ANTLR)"
276
          depends="init">
277
    <f2 project="antlr"/>
278
  </target>
279
 
280
  <target name="bcel"
281
          description="load Byte Code Engineering Library (BCEL)"
282
          depends="init">
283
    <f2 project="org.apache.bcel" archive="bcel"/>
284
  </target>
285
 
286
  <target name="jdepend"
287
          description="load JDepend libraries"
288
          depends="init">
289
    <f2 project="jdepend"/>
290
  </target>
291
 
292
  <target name="bsf"
293
          description="load Bean Scripting Framework"
294
          depends="init">
295
    <f2 project="bsf"/>
296
  </target>
297
 
298
  <target name="jruby"
299
          description="load JRuby"
300
          depends="bsf">
301
    <f2 project="org.jruby" archive="jruby"/>
302
  </target>
303
 
304
  <target name="beanshell"
305
          description="load BeanShell support"
306
          depends="bsf">
307
    <f2 project="org.beanshell" archive="bsh"/>
308
    <f2 project="org.beanshell" archive="bsh-core"/>
309
  </target>
310
 
311
  <target name="jython"
312
          description="load Jython"
313
          depends="bsf">
314
    <f2 project="org.python" archive="jython"/>
315
  </target>
316
 
317
  <target name="rhino"
318
          description="load Rhino"
319
          depends="bsf">
320
    <f2 project="org.mozilla" archive="rhino"/>
321
  </target>
322
 
323
  <target name="script"
324
          description="load script languages (except Jython)"
325
          depends="bsf,jruby,beanshell,rhino"/>
326
 
327
  <target name="debugging"
328
    description="internal Ant debugging"
329
    depends="init">
330
    <f2 project="which"/>
331
  </target>
332
 
333
  <target name="javamail"
334
          description="load Java Mail"
335
          depends="init">
336
    <f2 project="javax.mail" archive="javax.mail-api"/>
337
  </target>
338
 
339
  <target name="jspc"
340
          description="load Jasper"
341
          depends="init">
342
    <f2 project="tomcat" archive="jasper-compiler"/>
343
    <f2 project="tomcat" archive="jasper-runtime"/>
344
    <f2 project="javax.servlet" archive="servlet-api"/>
345
  </target>
346
 
347
  <target name="jai"
348
          description="load Java Advanced Imaging"
349
          depends="init">
350
    <f2 project="javax.media" archive="jai-core" id="jboss"
351
        repository="https://repository.jboss.org/nexus/content/groups/public/"/>
352
    <f2 project="com.sun.media" archive="jai-codec" id="jboss"
353
        repository="https://repository.jboss.org/nexus/content/groups/public/"/>
354
  </target>
355
 
356
  <target name="netrexx"
357
          description="load NetRexx compiler"
358
          depends="init-no-m2,-setup-temp-cache,-fetch-netrexx,-fetch-netrexx-no-commons-net">
359
    <copy todir="${dest.dir}" flatten="true">
360
      <zipfileset src="${temp.dir}/NetRexx.zip">
361
        <include name="NetRexx\lib\NetRexxC.jar"/>
362
        <include name="NetRexx\browse\license.txt"/>
363
      </zipfileset>
364
    </copy>
365
    <antcall target="-cleanup-temp-cache"/>
366
  </target>
367
 
368
  <available property="have.commons.net" classname="org.apache.commons.net.ftp.FTPClientConfig"/>
369
 
370
  <target name="-fetch-netrexx" if="have.commons.net">
371
    <get-ftp-file host="ftp.software.ibm.com" remotedir="/software/awdtools/netrexx"
372
            filename="NetRexx.zip" localdir="${temp.dir}"/>
373
  </target>
374
 
375
  <target name="-fetch-netrexx-no-commons-net" unless="have.commons.net">
376
    <get src="ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRexx.zip"
377
         dest="${temp.dir}/NetRexx.zip" skipexisting="true"/>
378
  </target>
379
 
380
  <target name="xz"
381
          description="load XZ for Java"
382
          depends="init">
383
    <f2 project="org.tukaani" archive="xz"/>
384
  </target>
385
 
386
  <target name="all"
387
    description="load all the libraries (except jython)"
388
    depends="antunit,ivy,logging,junit,junitlauncher,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging,script,
389
      javamail,jspc,jai,xz,netrexx,junit-engine-vintage,junit-engine-jupiter"/>
390
</project>