[r781482] Fixing various license and readme issues. I think this fixes:
[harmony.git] / build.xml
blob81f937bca7af47c44007c6d6f7e84c84a6f249d9
1 <?xml version="1.0" encoding="UTF-8"?>
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
11          http://www.apache.org/licenses/LICENSE-2.0
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 -->
21 <project name="build-harmony" default="build" basedir=".">
23     <!-- name of the target directory to use for building and final assembly -->
24     <property name="target.dir" value="target" />
26     <!-- release property file which is added to source release -->
27     <property file="release.properties" />
29     <!-- debug or release version -->
30     <property name="hy.cfg" value="release" />
32     <property name="hy.local.zlib" value="false" />
34     <description>
35         Apache Harmony project federation script
36     </description>
38     <target name="help">
39         <echo>
40 Apache Harmony Ant Build
42 Usage:
44   ant build
45     Compiles the java and native code to produce a jdk in
46     "target/hdk".
48   ant clean
49     Removes all the files generated by a build.
51   ant rebuild
52     Performs a full build - that is 'clean' then 'build'.
54   ant snapshot
55     Produces a archive (tar/zip) of a build.
57   ant fetch-depends
58     Fetches dependencies. Note: Some of Harmony's dependencies are
59     licensed under terms other than the Apache License v2.
61   ant properties
62     Display the common build properties.
64         </echo>
65     </target>
68     <!-- ============================================================== -->
69     <!--     main target - should checkout, build and package hdk,
70              jdk and jre                                                -->
71     <!-- ============================================================== -->
72     <target name="all"
73         description="setup and build complete implementation"
74         depends="setup,
75                  populate-src,
76                  clean,
77                  build,
78                  bundle-hdk,
79                  bundle-jdk,
80                  bundle-jre"/>
81     
82     <target name="snapshot"
83         description="setup and build complete src + binaries set"
84         depends="bundle-src,
85                  clean,
86                  build,
87                  bundle-hdk,
88                  bundle-jdk,
89                  bundle-jre"/>
91     <target name="build"
92         description="build complete implementation"
93         depends="properties,
94                  build-classlib,
95                  build-vm,
96                  build-commonresources,
97                  build-jdktools,
98                  assemble-artifacts"/>
99     
100     <target name="bundle-src" 
101         description="assemble source snapshot"
102         depends="clean,
103                  setup,
104                  copy-src,
105                  bundle-src-tgz,
106                  bundle-src-zip" />
108     <!-- ============================================================== -->
109     <!--     populates the source directories, working_classlib,
110              working_vm, working_jdktools, and common_resources         -->
111     <!-- ============================================================== -->
112     <target name="populate-src" 
113         description="checkout the class library and VM source trees"
114         depends="init,
115                  properties,
116                  switch-svn-vm,
117                  switch-svn-classlib,
118                  switch-svn-jdktools,
119                  switch-svn-commonresources" />
121     <!-- ============================================================== -->
122     <!--     creates the HDK bundle appropriate for the platform        -->
123     <!-- ============================================================== -->
124     <target name="bundle-hdk" 
125         depends="assemble-artifacts,
126                  assemble-hdk-doc,
127                  bundle-hdk-tgz,
128                  bundle-hdk-zip" />
130     <!-- ============================================================== -->
131     <!--     builds with a clean first                                  -->
132     <!-- ============================================================== -->
133     <target name="rebuild" depends="clean, build"
134         description="Performs a full build - that is 'clean' then 'build'" />
136     <!-- ============================================================== -->
137     <!--     fetches external dependencies                              -->
138     <!-- ============================================================== -->
139     <target name="fetch-depends"
140         description="Fetches dependencies. Note: Some of Harmony dependencies are licensed under terms other than the Apache License v2."
141         depends="fetch-classlib-libs,
142                  fetch-vm-libs,
143                  fetch-commonresources,
144                  fetch-jdktools-libs"/>
146     <target name="bundle-hdk-tgz" depends="init" if="is.unix">
148         <!-- create the tar file and then md5 checksum using harmony-hdk-rev as the root,
149              and setting exec bits as needed -->
150         <tar tarfile="${target.dir}/${deploy.hdk.tar}" compression="gzip">
151             <tarfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}" mode="755">
152                 <include name="jdk/jre/bin/java"/>
153                 <include name="jdk/bin/*"/>
154             </tarfileset>
155             <tarfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}">
156                 <include name="**"/>
157                 <exclude name="jdk/jre/bin/java"/>
158                 <exclude name="jdk/bin/*"/>
159                 <exclude name="jdk/jre/README"/>
160             </tarfileset>
161             <tarfileset dir="${target.dir}/hdk/jdk/jre"
162                         prefix="harmony-hdk-${harmony.version}">
163                 <include name="README"/>
164             </tarfileset>
165         </tar>
167         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" />
168         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" type="sha" />
170     </target>
172     <target name="bundle-hdk-zip" depends="init" unless="is.unix">
173         <!-- create the tar file and then md5 checksum using harmony-hdk-rev as the root,
174              and setting exec bits as needed -->
175         <zip destfile="${target.dir}/${deploy.hdk.zip}" >
176             <zipfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}" filemode="755">
177                 <include name="jdk/jre/bin/java.exe"/>
178                 <include name="jdk/jre/bin/javaw.exe"/>
179                 <include name="jdk/bin/*"/>
180             </zipfileset>
181             <zipfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}">
182                 <include name="**"/>
183                 <exclude name="jdk/jre/bin/java.exe"/>
184                 <exclude name="jdk/jre/bin/javaw.exe"/>
185                 <exclude name="jdk/bin/*"/>
186                 <exclude name="jdk/jre/README"/>
187             </zipfileset>
188             <zipfileset dir="${target.dir}/hdk/jdk/jre"
189                         prefix="harmony-hdk-${harmony.version}">
190                 <include name="README"/>
191             </zipfileset>
192         </zip>
194         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" />
195         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" type="sha" />
196     </target>
198     <!-- ============================================================== -->
199     <!-- creates the JDK bundle appropriate for the platform            -->
200     <!-- ============================================================== -->
201     <target name="bundle-jdk"
202         depends="assemble-jdk-doc,
203                  bundle-jdk-tgz,
204                  bundle-jdk-zip" />
206     <target name="bundle-jdk-tgz" depends="init" if="is.unix">
208         <tar tarfile="${target.dir}/${deploy.jdk.tar}" compression="gzip" >
209             <tarfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}" mode="755">
210                 <include name="jre/bin/java"/>
211                 <include name="bin/*"/>
212             </tarfileset>
213             <tarfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}">
214                 <include name="**"/>
215                 <exclude name="jre/bin/java"/>
216                 <exclude name="bin/*"/>
217                 <exclude name="jre/README"/>
218             </tarfileset>
219             <tarfileset dir="${target.dir}/hdk/jdk/jre"
220                         prefix="harmony-jdk-${harmony.version}">
221                 <include name="README"/>
222             </tarfileset>
223         </tar>
225         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" />
226         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" type="sha" />
228     </target>
230     <target name="bundle-jdk-zip" depends="init" unless="is.unix">
231         <zip destfile="${target.dir}/${deploy.jdk.zip}">
232             <zipfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}" filemode="755">
233                 <include name="jre/bin/java.exe"/>
234                 <include name="jre/bin/javaw.exe"/>
235                 <include name="bin/*"/>
236             </zipfileset>
237             <zipfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}">
238                 <include name="**"/>
239                 <exclude name="jre/bin/java.exe"/>
240                 <exclude name="jre/bin/javaw.exe"/>
241                 <exclude name="bin/*"/>
242                 <exclude name="jre/README"/>
243             </zipfileset>
244             <zipfileset dir="${target.dir}/hdk/jdk/jre"
245                         prefix="harmony-jdk-${harmony.version}">
246                 <include name="README"/>
247             </zipfileset>
248         </zip>
249         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" />
250         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" type="sha" />
251     </target>
253     <!-- ============================================================== -->
254     <!-- creates the JRE bundle appropriate for the platform            -->
255     <!-- ============================================================== -->
256     <target name="bundle-jre" 
257         depends="assemble-jre-doc,
258                  bundle-jre-tgz,
259                  bundle-jre-zip" />
262     <target name="bundle-jre-tgz" depends="init" if="is.unix">
264         <tar tarfile="${target.dir}/${deploy.jre.tar}" compression="gzip" >
265             <tarfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}" mode="755">
266                 <include name="bin/java"/>
267             </tarfileset>
268             <tarfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}">
269                 <include name="**"/>
270                 <exclude name="bin/java"/>
271             </tarfileset>
272         </tar>
274         <chksum dir="${target.dir}" file="${deploy.jre.tar}" />
275         <chksum dir="${target.dir}" file="${deploy.jre.tar}" type="sha" />
277     </target>
279     <target name="bundle-jre-zip" depends="init" unless="is.unix">
280         <zip destfile="${target.dir}/${deploy.jre.zip}">
281             <zipfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}" filemode="755">
282                 <include name="bin/java.exe"/>
283                 <include name="bin/javaw.exe"/>
284             </zipfileset>
285             <zipfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}">
286                 <include name="**"/>
287                 <exclude name="bin/java.exe"/>
288                 <exclude name="bin/javaw.exe"/>
289             </zipfileset>
290         </zip>
291         <chksum dir="${target.dir}" file="${deploy.jre.zip}" />
292         <chksum dir="${target.dir}" file="${deploy.jre.zip}" type="sha" />
293     </target>
296     <!-- ============================================================== -->
297     <!-- from the classlib and vm builds, creates the hdk and jre       -->
298     <!-- ============================================================== -->
299     <target name="assemble-artifacts"
300         depends="init,
301                  assemble-stuff,
302                  chmod-stuff"/>
304     <target name="assemble-stuff">
305         <!-- create the top-level hdk directory -->
306         <mkdir dir="${target.dir}/hdk"/>
308         <!-- copy the classlib/deploy tree as the hdk
309              filtering out the jre, as that comes from
310              working_vm -->
311         <copy todir="${target.dir}/hdk">
312             <fileset dir="working_classlib/deploy">
313                 <exclude name="**/jre/**/*" />
314                 <exclude name="**/jdk/lib/*" />
315                 <exclude name="**/jdk/include/*" />
316                 <exclude name="**/*.pdb" unless="copy.progdb" />
317             </fileset>
318         </copy>
320         <!-- now copy the drlvm/build/deploy -->
321         <!-- set overwrite flag to take hythr from VM -->
322         <copy todir="${target.dir}/hdk" overwrite="true">
323             <fileset dir="working_vm/deploy">
324                 <exclude name="**/*.pdb" unless="copy.progdb" />
325             </fileset>
326         </copy>
328         <!-- now copy the working_jdktools/deploy/jdk -->
329         <copy todir="${target.dir}/hdk/jdk/">
330             <fileset dir="working_jdktools/deploy/jdk">
331                 <exclude name="**/*.pdb" unless="copy.progdb" />
332             </fileset>
333         </copy>
334     </target>
336     <target name="chmod-stuff" if="is.unix">
337         <chmod file="${target.dir}/hdk/jdk/bin/*" perm="ugo+x" />
338         <chmod file="${target.dir}/hdk/jdk/jre/bin/java*" perm="ugo+x" />
339         <chmod file="${target.dir}/hdk/jdk/jre/bin/keytool*" perm="ugo+x" />
340         <chmod file="${target.dir}/hdk/jdk/jre/bin/policytool*" perm="ugo+x" />
341         <chmod file="${target.dir}/hdk/jdk/jre/bin/unpack200*" perm="ugo+x" />
342         <chmod file="${target.dir}/hdk/jdk/jre/bin/pack200*" perm="ugo+x" />
343     </target>
345     <target name="assemble-jdk">
347         <!-- create the top-level jdk directory -->
348         <mkdir dir="${target.dir}/jdk"/>
350         <!-- now copy the drlvm/build/deploy/jre
351              contents into the jre in the JDK -->
352         <copy todir="${target.dir}/jdk/jre">
353             <fileset dir="working_vm/build/deploy/jdk/jre">
354                 <exclude name="**/*.pdb" unless="copy.progdb" />
355             </fileset>
356         </copy>
358         <!-- now copy the drlvm/build/deploy/jre
359              contents into the jre in the JDK -->
360         <copy todir="${target.dir}/jdk/">
361             <fileset dir="working_jdktools/deploy/jdk">
362                 <exclude name="**/*.pdb" unless="copy.progdb" />
363             </fileset>
364         </copy>
366     </target>
368     <!-- ============================================================== -->
369     <!-- copies a license and notices into the root of the hdk          -->
370     <!-- ============================================================== -->
371     <target name="assemble-hdk-doc">
373         <copy todir="${target.dir}/hdk" overwrite="true">
374             <fileset dir="./">
375                 <include name="LICENSE" />
376                 <include name="NOTICE" />
377             </fileset>
378         </copy>
380     </target>
382     <!-- ============================================================== -->
383     <!-- copies a license and notices into the root of the JDK and JRE  -->
384     <!-- ============================================================== -->
385     <target name="assemble-jre-doc">
387         <copy todir="${target.dir}/hdk/jdk/jre" overwrite="true">
388             <fileset dir="./">
389                 <include name="LICENSE" />
390                 <include name="NOTICE" />
391             </fileset>
392         </copy>
393     </target>
395     <target name="assemble-jdk-doc">
396         <copy todir="${target.dir}/hdk/jdk/" overwrite="true">
397             <fileset dir="./">
398                 <include name="LICENSE" />
399                 <include name="NOTICE" />
400             </fileset>
401         </copy>
402     </target>
404     <!-- ============================================================== -->
405     <!-- ensures dependencies are up to date, then builds classlib      -->
406     <!-- ============================================================== -->
408     <propertyset id="required.props">
409         <propertyref name="hy.cfg" />
410         <propertyref name="hy.local.zlib" />
411         <propertyref name="use.libstdc++5" />
412     </propertyset>
413     
414     <target name="build-classlib" depends="auto-fetch-classlib-libs">
415         <ant antfile="working_classlib/build.xml" target="build" inheritAll="false" >
416             <propertyset refid="required.props" />
417             <property name="svn.info" value="${harmony.long.version}"/>
418             <property name="svn.revision" value="${harmony.version}"/>
419             <property name="keep.working" value="true" />
420         </ant>
421         <!-- hack to make sure the vm doesn't use the classlib
422              LICENSE/NOTICE files as they don't cover ICU4C
423           -->
424         <copy todir="working_classlib/deploy" overwrite="true">
425             <fileset dir=".">
426                 <include name="LICENSE" />
427                 <include name="NOTICE" />
428             </fileset>
429         </copy>                                                             
430     </target>
432     <target name="auto-fetch-classlib-libs" if="auto.fetch">
433         <ant target="fetch-classlib-libs">
434             <propertyset refid="required.props" />
435             <property name="svn.info" value="${harmony.long.version}"/>
436             <property name="svn.revision" value="${harmony.version}"/>
437         </ant>
438     </target>
440     <target name="fetch-classlib-libs">
441         <ant antfile="working_classlib/build.xml" target="fetch-depends" inheritall="false" >
442             <propertyset refid="required.props" />
443             <property name="svn.info" value="${harmony.long.version}"/>
444             <property name="svn.revision" value="${harmony.version}"/>
445         </ant>
446     </target>
448     <target name="clean-classlib">
449         <ant antfile="working_classlib/build.xml" target="clean" inheritAll="false" >
450             <propertyset refid="required.props" />
451             <property name="svn.info" value="${harmony.long.version}"/>
452             <property name="svn.revision" value="${harmony.version}"/>
453             <property name="keep.working" value="true" />
454         </ant>
455     </target>
457     <target name="init-classlib-hdk">
458         <ant antfile="working_classlib/make/build-native.xml"
459                 target="copy-makefile-includes" inheritAll="false" >
460             <property name="hy.cfg" value="${hy.cfg}"/>
461             <property name="svn.info" value="${harmony.long.version}"/>
462             <property name="svn.revision" value="${harmony.version}"/>
463             <property name="keep.working" value="true" />
464         </ant>
465     </target>
467     <!-- ============================================================== -->
468     <!-- ensures that dependencies are up to date and then builds a vm  -->
469     <!-- ============================================================== -->
470     <target name="build-vm" depends="auto-fetch-vm-libs">
471         <ant antfile="working_vm/build.xml" target="build" inheritAll="false" >
472             <propertyset refid="required.props" />
473             <property name="svn.info" value="${harmony.long.version}"/>
474             <property name="svn.revision" value="${harmony.version}"/>
475             <property name="deploy.canonical.flag" value="true"/>
476         </ant>
477     </target>
479     <target name="auto-fetch-vm-libs" if="auto.fetch">
480         <ant target="fetch-vm-libs">
481             <propertyset refid="required.props" />
482             <property name="svn.info" value="${harmony.long.version}"/>
483             <property name="svn.revision" value="${harmony.version}"/>
484         </ant>
485     </target>
487     <target name="fetch-vm-libs">
488         <ant antfile="working_vm/build.xml" target="fetch-depends" inheritall="false" >
489             <propertyset refid="required.props" />
490             <property name="svn.info" value="${harmony.long.version}"/>
491             <property name="svn.revision" value="${harmony.version}"/>
492         </ant>
493     </target>
495     <target name="clean-vm">
496         <ant antfile="working_vm/build.xml" target="clean" inheritall="false" >
497             <propertyset refid="required.props" />
498             <property name="svn.info" value="${harmony.long.version}"/>
499             <property name="svn.revision" value="${harmony.version}"/>
500             <property name="deploy.canonical.flag" value="true"/>
501         </ant>
502     </target>
504     <!-- ============================================================== -->
505     <!-- fetches the common resources                                   -->
506     <!-- ============================================================== -->
507     <target name="build-commonresources" depends="auto-fetch-commonresources"/>
509     <target name="auto-fetch-commonresources" if="auto.fetch">
510         <ant target="fetch-commonresources">
511             <propertyset refid="required.props" />
512             <property name="svn.info" value="${harmony.long.version}"/>
513             <property name="svn.revision" value="${harmony.version}"/>
514         </ant>
515     </target>
517     <target name="fetch-commonresources">
518         <ant antfile="common_resources/build.xml" target="fetch-depends" inheritall="false" >
519             <property name="hy.cfg" value="${hy.cfg}"/>
520             <property name="svn.info" value="${harmony.long.version}"/>
521             <property name="svn.revision" value="${harmony.version}"/>
522         </ant>
523     </target>
525     <!-- ============================================================== -->
526     <!-- ensures dependencies are up to date, then builds jdktools      -->
527     <!-- ============================================================== -->
528     <target name="build-jdktools" depends="auto-fetch-jdktools-libs">
529         <ant antfile="working_jdktools/build.xml" target="build" inheritall="false" >
530             <property name="hy.cfg" value="${hy.cfg}"/>
531             <property name="svn.info" value="${harmony.long.version}"/>
532             <property name="svn.revision" value="${harmony.version}"/>
533         </ant>
534     </target>
536     <target name="auto-fetch-jdktools-libs" if="auto.fetch">
537         <ant target="fetch-jdktools-libs" inheritall="false" >
538             <property name="hy.cfg" value="${hy.cfg}"/>
539         </ant>
540     </target>
542     <target name="fetch-jdktools-libs">
543         <ant antfile="working_jdktools/build.xml" target="fetch-depends" inheritall="false" >
544             <property name="hy.cfg" value="${hy.cfg}"/>
545         </ant>
546     </target>
548     <target name="clean-jdktools">
549         <ant antfile="working_jdktools/build.xml" target="clean" inheritall="false" >
550             <property name="hy.cfg" value="${hy.cfg}"/>
551             <property name="svn.info" value="${harmony.long.version}"/>
552             <property name="svn.revision" value="${harmony.version}"/>
553         </ant>
554     </target>
556     <!-- ============================================================== -->
557     <!-- recreates distribution dir                                     -->
558     <!-- ============================================================== -->
559     <target name="setup" depends="init, properties">
560         <delete dir="${target.dir}"/>
561         <mkdir dir="${target.dir}"/>
562     </target>
565     <!-- ============================================================== -->
566     <!-- hard reset - removes checked out classlib and vm tree          -->
567     <!-- ============================================================== -->
568     <target name="reset"
569         description="removes vm and classlib dirs and resets - BE SURE YOU WANT TO DO THIS"
570         depends="clean">
572         <!-- delete the working directories and then do an svn update to reset them -->
573         <delete dir="working_classlib"/>
574         <delete dir="working_vm"/>
576         <exec executable="svn" dir="." failonerror="true">
577             <arg line="update" />
578         </exec>
580     </target>
582     <target name="clean"
583         depends="init-classlib-hdk,
584                  clean-jdktools,
585                  clean-classlib,
586                  clean-vm" >
587         <delete dir="${target.dir}" failonerror="false" />
588     </target>
590     <!-- ============================================================== -->
591     <!-- switches the working_vm directory to vm module (DRLVM for now) -->
592     <!-- ============================================================== -->
593     <target name="switch-svn-vm" depends="init" if="is.svn">
594         <exec executable="svn" dir="working_vm" failonerror="true">
595             <arg line="-r${svn.revision}"/>
596             <arg line="switch" />
597             <arg line="${vm.svn.url}" />
598         </exec>
599     </target>
601     <!-- ============================================================== -->
602     <!-- switches the working_classlib directory to classlib            -->
603     <!-- ============================================================== -->
604     <target name="switch-svn-classlib" depends="init" if="is.svn">
605         <exec executable="svn" dir="working_classlib" failonerror="true">
606             <arg line="-r${svn.revision}"/>
607             <arg line="switch" />
608             <arg line="${classlib.svn.url}" />
609         </exec>
610     </target>
612     <!-- ============================================================== -->
613     <!-- switches the working_jdktools directory to jdktools            -->
614     <!-- ============================================================== -->
615     <target name="switch-svn-jdktools" depends="init" if="is.svn">
616         <exec executable="svn" dir="working_jdktools" failonerror="true">
617             <arg line="-r${svn.revision}"/>
618             <arg line="switch" />
619             <arg line="${jdktools.svn.url}" />
620         </exec>
621     </target>
623     <!-- ============================================================== -->
624     <!-- switches the common_resources directory to common_resources    -->
625     <!-- ============================================================== -->
626     <target name="switch-svn-commonresources" depends="init" if="is.svn">
627         <exec executable="svn" dir="common_resources" failonerror="true">
628             <arg line="-r${svn.revision}"/>
629             <arg line="switch" />
630             <arg line="${commonresources.svn.url}" />
631         </exec>
632     </target>
634     <!-- ============================================================== -->
635     <!-- sets up a platform                                             -->
636     <!-- ============================================================== -->
637     <target name="init" depends="svn-prop">
638         <!-- Determine our operating system -->
639         <condition property="is.windows">
640             <os family="windows" />
641         </condition>
643         <condition property="is.unix">
644             <os family="unix" />
645         </condition>
647         <condition property="is.linux">
648             <os name="linux" />
649         </condition>
651         <!-- this special case makes sense -->
652         <condition property="harmony.os" value="windows">
653             <isset property="is.windows"/>
654         </condition>
655         <condition property="harmony.os" value="linux">
656             <os name="linux" />
657         </condition>
659         <property name="harmony.os" value="${os.name}" />
661         <!-- Conditions for different architectures -->
662         <condition property="is.x86_64">
663             <os arch="x86_64"/>
664         </condition>
665         <condition property="is.x86">
666             <or>
667                 <os arch="x86"/>
668                 <os arch="i386"/>
669             </or>
670         </condition>
671         <condition property="is.ia64">
672             <os arch="ia64" />
673         </condition>
674         <condition property="is.64bit">
675             <or>
676                 <os arch="ia64" />
677                 <os arch="x86_64"/>
678             </or>
679         </condition>
680         <condition property="is.32bit">
681             <or>
682                 <os arch="x86"/>
683                 <os arch="i386"/>
684             </or>
685         </condition>
686         <condition property="harmony.bits" value="32">
687             <isset property="is.32bit" />
688         </condition>
689         <property name="harmony.bits" value="64" />
691         <!-- Normalized architecture name -->
692         <condition property="harmony.arch" value="x86">
693             <isset property="is.x86" />
694         </condition>
695         <condition property="harmony.arch" value="x86_64">
696             <or>
697                 <os arch="x86_64"/>
698                 <os arch="amd64"/>
699                 <os arch="em64t"/>
700             </or>
701         </condition>
702         <property name="harmony.arch" value="${os.arch}" />
704         <property name="harmony.deploy.suffix" value="-snapshot" />
706         <property name="deploy.hdk.file.prefix"
707                  value="apache-harmony-hdk-r${harmony.version}" />
708         <property name="deploy.hdk.tar"
709                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
710         <property name="deploy.hdk.zip"
711                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
713         <property name="deploy.jdk.file.prefix"
714                  value="apache-harmony-jdk-r${harmony.version}" />
715         <property name="deploy.jdk.tar"
716                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
717         <property name="deploy.jdk.zip"
718                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
720         <property name="deploy.jre.file.prefix"
721                  value="apache-harmony-jre-r${harmony.version}" />
722         <property name="deploy.jre.tar"
723                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
724         <property name="deploy.jre.zip"
725                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
727         <property name="deploy.src.file.prefix"
728                  value="apache-harmony-src-r${harmony.version}" />
729         <property name="deploy.src.tar"
730                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.tar.gz" />
731         <property name="deploy.src.zip"
732                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.zip" />
734         <!-- copy symbol debug info to debug build on Windows -->
735         <condition property="copy.progdb">
736             <equals arg1="${hy.cfg}" arg2="debug" />
737         </condition>
738         
739         <!-- workaround for drlvm build till it starts with a script-->
740         <condition property="custom.props" value="-Dhy.javac.compiler=${hy.javac.compiler}"
741             else="">
742             <isset property="hy.javac.compiler"/>
743         </condition>
745     </target>
747     <target name="properties" depends="init">
748         <echo>
749                    Apache Harmony Federated Build
750             ==========================================
751             svn rev          :  ${harmony.version}
752             operating system :  ${harmony.os}
753             CPU architecture :  ${harmony.arch}
754             word length      :  ${harmony.bits}
755             ant os name/arch :  ${os.name}/${os.arch}
756             hosting Java     :  ${java.version} (${java.vendor})
757             build mode       :  ${hy.cfg}
758             output location  :  ${target.dir}
759             SVN root         :  ${svn.root}
760         </echo>
761     </target>
763     <!-- ============================================================== -->
764     <!-- svn-prop: gets svn revision number of the build.xml file       -->
765     <!-- ============================================================== -->
766     <target name="svn-prop">
767         
768         <tempfile suffix=".xml" property="svn.tmp"/>
769         <exec executable="svn" output="${svn.tmp}" resultproperty="svn.rc">
770             <arg line="info ${basedir} --non-interactive --xml" />
771         </exec>
772         <condition property="svn.info.file" value="${svn.tmp}">
773             <equals arg1="0" arg2="${svn.rc}"/>
774         </condition>
775         <xmlproperty file="${svn.info.file}" prefix="federated" 
776             keeproot="no" collapseAttributes="yes"/>
777         <delete file="${svn.tmp}" quiet="true"/>
779         <condition property="is.svn">
780             <isset property="federated.entry.revision"/>
781         </condition>
782         <condition property="svn.revision" value="${federated.entry.revision}" else="unknown">
783             <isset property="is.svn"/>
784         </condition>
785             <condition property="svn.root" 
786                 value="${federated.entry.repository.root}"
787                 else="http://svn.apache.org/repos/asf">
788                 <isset property="is.svn"/>
789             </condition>
791         <condition property="svn.info" value="${svn.root} ${svn.revision}">
792             <isset property="is.svn"/>
793         </condition>
794         <tstamp>
795             <format property="svn.info" pattern="'Unknown revision at' dd-MMM-yyyy hh:mm aa"/>
796         </tstamp>
798         <property name="harmony.version" value="${svn.revision}" />
799         <property name="harmony.long.version" value="${svn.info}" />
801         <!-- default SVN URLs -->
802         <condition property="classlib.svn.url"
803                    value="${svn.root}/harmony/enhanced/classlib/branches/java6"
804                    else="${svn.root}/harmony/enhanced/classlib/trunk">
805             <isset property="java6" />
806         </condition>
808         <property name="vm.svn.url" value="${svn.root}/harmony/enhanced/drlvm/trunk" />
810         <condition property="jdktools.svn.url"
811                    value="${svn.root}/harmony/enhanced/jdktools/branches/java6"
812                    else="${svn.root}/harmony/enhanced/jdktools/trunk">
813             <isset property="java6" />
814         </condition>
816         <property name="commonresources.svn.url" value="${svn.root}/harmony/enhanced/common_resources/trunk" />
817     </target>
819     <target name="bundle-src-tgz" depends="init" if="is.unix">
821         <tar tarfile="${target.dir}/${deploy.src.tar}" compression="gzip"
822              longfile="gnu" >
823             <tarfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}" mode="755">
824                 <include name="debian/rules"/>
825             </tarfileset>
826             <tarfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}">
827                 <include name="**"/>
828                 <exclude name="debian/rules"/>
829             </tarfileset>
830         </tar>
832         <chksum dir="${target.dir}" file="${deploy.src.tar}" />
833         <chksum dir="${target.dir}" file="${deploy.src.tar}" type="sha" />
835     </target>
837     <target name="bundle-src-zip" depends="init" unless="is.unix">
838         <zip destfile="${target.dir}/${deploy.src.zip}">
839             <zipfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}" filemode="755">
840                 <include name="debian/rules"/>
841             </zipfileset>
842             <zipfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}">
843                 <include name="**"/>
844                 <exclude name="debian/rules"/>
845             </zipfileset>
846         </zip>
847         <chksum dir="${target.dir}" file="${deploy.src.zip}" />
848         <chksum dir="${target.dir}" file="${deploy.src.zip}" type="sha" />
849     </target>
851     <target name="copy-src" depends="init,populate-src">
852         <exec executable="svn">
853             <arg value="export" />
854             <arg value="." />
855             <arg value="${target.dir}/src" />
856         </exec>
857         <echo file="${target.dir}/src/release.properties">
858 harmony.version=${harmony.version}
859 harmony.long.version=${harmony.long.version}
860 harmony.deploy.suffix=${harmony.deploy.suffix}
861         </echo>
862         <chmod file="${target.dir}/src/debian/rules" perm="ugo+x" />
863     </target>
865     <!-- ============================================================== -->
866     <!-- produces a nice looking checksum                               -->
867     <!-- ============================================================== -->
868     <macrodef name="chksum">
869         <attribute name="dir" />
870         <attribute name="file" />
871         <attribute name="type" default="md5" />
872         <sequential>
873             <checksum property="@{file}.@{type}"
874                       file="@{dir}/@{file}"
875                       algorithm="@{type}" />
876             <echo file="@{dir}/@{file}.@{type}"
877                   message="${@{file}.@{type}}  @{file}${line.separator}" />
878         </sequential>
879     </macrodef>
881 </project>