[r810858] Set java version system properties correctly if -Djava6=true property
[harmony.git] / build.xml
blob082ac69dab8289ef3718d3d7c1915e7f96772330
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"
152                         prefix="${archive.dir.prefix}hdk-${harmony.version}"
153                         mode="755">
154                 <include name="jdk/jre/bin/java"/>
155                 <include name="jdk/bin/*"/>
156             </tarfileset>
157             <tarfileset dir="${target.dir}/hdk"
158                         prefix="${archive.dir.prefix}hdk-${harmony.version}">
159                 <include name="**"/>
160                 <exclude name="jdk/jre/bin/java"/>
161                 <exclude name="jdk/bin/*"/>
162                 <exclude name="jdk/jre/README"/>
163             </tarfileset>
164             <tarfileset dir="${target.dir}/hdk/jdk/jre"
165                         prefix="${archive.dir.prefix}hdk-${harmony.version}">
166                 <include name="README"/>
167             </tarfileset>
168         </tar>
170         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" />
171         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" type="sha" />
173     </target>
175     <target name="bundle-hdk-zip" depends="init" unless="is.unix">
176         <!-- create the tar file and then md5 checksum using harmony-hdk-rev as the root,
177              and setting exec bits as needed -->
178         <zip destfile="${target.dir}/${deploy.hdk.zip}" >
179             <zipfileset dir="${target.dir}/hdk"
180                         prefix="${archive.dir.prefix}hdk-${harmony.version}"
181                         filemode="755">
182                 <include name="jdk/jre/bin/java.exe"/>
183                 <include name="jdk/jre/bin/javaw.exe"/>
184                 <include name="jdk/bin/*"/>
185             </zipfileset>
186             <zipfileset dir="${target.dir}/hdk"
187                         prefix="${archive.dir.prefix}hdk-${harmony.version}">
188                 <include name="**"/>
189                 <exclude name="jdk/jre/bin/java.exe"/>
190                 <exclude name="jdk/jre/bin/javaw.exe"/>
191                 <exclude name="jdk/bin/*"/>
192                 <exclude name="jdk/jre/README"/>
193             </zipfileset>
194             <zipfileset dir="${target.dir}/hdk/jdk/jre"
195                         prefix="${archive.dir.prefix}hdk-${harmony.version}">
196                 <include name="README"/>
197             </zipfileset>
198         </zip>
200         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" />
201         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" type="sha" />
202     </target>
204     <!-- ============================================================== -->
205     <!-- creates the JDK bundle appropriate for the platform            -->
206     <!-- ============================================================== -->
207     <target name="bundle-jdk"
208         depends="assemble-jdk-doc,
209                  bundle-jdk-tgz,
210                  bundle-jdk-zip" />
212     <target name="bundle-jdk-tgz" depends="init" if="is.unix">
214         <tar tarfile="${target.dir}/${deploy.jdk.tar}" compression="gzip" >
215             <tarfileset dir="${target.dir}/hdk/jdk"
216                         prefix="${archive.dir.prefix}jdk-${harmony.version}"
217                         mode="755">
218                 <include name="jre/bin/java"/>
219                 <include name="bin/*"/>
220             </tarfileset>
221             <tarfileset dir="${target.dir}/hdk/jdk"
222                         prefix="${archive.dir.prefix}jdk-${harmony.version}">
223                 <include name="**"/>
224                 <exclude name="jre/bin/java"/>
225                 <exclude name="bin/*"/>
226                 <exclude name="jre/README"/>
227             </tarfileset>
228             <tarfileset dir="${target.dir}/hdk/jdk/jre"
229                         prefix="${archive.dir.prefix}jdk-${harmony.version}">
230                 <include name="README"/>
231             </tarfileset>
232         </tar>
234         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" />
235         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" type="sha" />
237     </target>
239     <target name="bundle-jdk-zip" depends="init" unless="is.unix">
240         <zip destfile="${target.dir}/${deploy.jdk.zip}">
241             <zipfileset dir="${target.dir}/hdk/jdk"
242                         prefix="${archive.dir.prefix}jdk-${harmony.version}"
243                         filemode="755">
244                 <include name="jre/bin/java.exe"/>
245                 <include name="jre/bin/javaw.exe"/>
246                 <include name="bin/*"/>
247             </zipfileset>
248             <zipfileset dir="${target.dir}/hdk/jdk"
249                         prefix="${archive.dir.prefix}jdk-${harmony.version}">
250                 <include name="**"/>
251                 <exclude name="jre/bin/java.exe"/>
252                 <exclude name="jre/bin/javaw.exe"/>
253                 <exclude name="bin/*"/>
254                 <exclude name="jre/README"/>
255             </zipfileset>
256             <zipfileset dir="${target.dir}/hdk/jdk/jre"
257                         prefix="${archive.dir.prefix}jdk-${harmony.version}">
258                 <include name="README"/>
259             </zipfileset>
260         </zip>
261         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" />
262         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" type="sha" />
263     </target>
265     <!-- ============================================================== -->
266     <!-- creates the JRE bundle appropriate for the platform            -->
267     <!-- ============================================================== -->
268     <target name="bundle-jre" 
269         depends="assemble-jre-doc,
270                  bundle-jre-tgz,
271                  bundle-jre-zip" />
274     <target name="bundle-jre-tgz" depends="init" if="is.unix">
276         <tar tarfile="${target.dir}/${deploy.jre.tar}" compression="gzip" >
277             <tarfileset dir="${target.dir}/hdk/jdk/jre"
278                         prefix="${archive.dir.prefix}jre-${harmony.version}"
279                         mode="755">
280                 <include name="bin/java"/>
281             </tarfileset>
282             <tarfileset dir="${target.dir}/hdk/jdk/jre"
283                         prefix="${archive.dir.prefix}jre-${harmony.version}">
284                 <include name="**"/>
285                 <exclude name="bin/java"/>
286             </tarfileset>
287         </tar>
289         <chksum dir="${target.dir}" file="${deploy.jre.tar}" />
290         <chksum dir="${target.dir}" file="${deploy.jre.tar}" type="sha" />
292     </target>
294     <target name="bundle-jre-zip" depends="init" unless="is.unix">
295         <zip destfile="${target.dir}/${deploy.jre.zip}">
296             <zipfileset dir="${target.dir}/hdk/jdk/jre"
297                         prefix="${archive.dir.prefix}jre-${harmony.version}"
298                         filemode="755">
299                 <include name="bin/java.exe"/>
300                 <include name="bin/javaw.exe"/>
301             </zipfileset>
302             <zipfileset dir="${target.dir}/hdk/jdk/jre"
303                         prefix="${archive.dir.prefix}jre-${harmony.version}">
304                 <include name="**"/>
305                 <exclude name="bin/java.exe"/>
306                 <exclude name="bin/javaw.exe"/>
307             </zipfileset>
308         </zip>
309         <chksum dir="${target.dir}" file="${deploy.jre.zip}" />
310         <chksum dir="${target.dir}" file="${deploy.jre.zip}" type="sha" />
311     </target>
314     <!-- ============================================================== -->
315     <!-- from the classlib and vm builds, creates the hdk and jre       -->
316     <!-- ============================================================== -->
317     <target name="assemble-artifacts"
318         depends="init,
319                  assemble-stuff,
320                  chmod-stuff"/>
322     <target name="assemble-stuff">
323         <!-- create the top-level hdk directory -->
324         <mkdir dir="${target.dir}/hdk"/>
326         <!-- copy the classlib/deploy tree as the hdk
327              filtering out the jre, as that comes from
328              working_vm -->
329         <copy todir="${target.dir}/hdk">
330             <fileset dir="working_classlib/deploy">
331                 <exclude name="**/jre/**/*" />
332                 <exclude name="**/jdk/lib/*" />
333                 <exclude name="**/jdk/include/*" />
334                 <exclude name="**/*.pdb" unless="copy.progdb" />
335             </fileset>
336         </copy>
338         <!-- now copy the drlvm/build/deploy -->
339         <!-- set overwrite flag to take hythr from VM -->
340         <copy todir="${target.dir}/hdk" overwrite="true">
341             <fileset dir="working_vm/deploy">
342                 <exclude name="**/*.pdb" unless="copy.progdb" />
343             </fileset>
344         </copy>
346         <!-- now copy the working_jdktools/deploy/jdk -->
347         <copy todir="${target.dir}/hdk/jdk/">
348             <fileset dir="working_jdktools/deploy/jdk">
349                 <exclude name="**/*.pdb" unless="copy.progdb" />
350             </fileset>
351         </copy>
352     </target>
354     <target name="chmod-stuff" if="is.unix">
355         <chmod file="${target.dir}/hdk/jdk/bin/*" perm="ugo+x" />
356         <chmod file="${target.dir}/hdk/jdk/jre/bin/java*" perm="ugo+x" />
357         <chmod file="${target.dir}/hdk/jdk/jre/bin/keytool*" perm="ugo+x" />
358         <chmod file="${target.dir}/hdk/jdk/jre/bin/policytool*" perm="ugo+x" />
359         <chmod file="${target.dir}/hdk/jdk/jre/bin/unpack200*" perm="ugo+x" />
360         <chmod file="${target.dir}/hdk/jdk/jre/bin/pack200*" perm="ugo+x" />
361     </target>
363     <target name="assemble-jdk">
365         <!-- create the top-level jdk directory -->
366         <mkdir dir="${target.dir}/jdk"/>
368         <!-- now copy the drlvm/build/deploy/jre
369              contents into the jre in the JDK -->
370         <copy todir="${target.dir}/jdk/jre">
371             <fileset dir="working_vm/build/deploy/jdk/jre">
372                 <exclude name="**/*.pdb" unless="copy.progdb" />
373             </fileset>
374         </copy>
376         <!-- now copy the drlvm/build/deploy/jre
377              contents into the jre in the JDK -->
378         <copy todir="${target.dir}/jdk/">
379             <fileset dir="working_jdktools/deploy/jdk">
380                 <exclude name="**/*.pdb" unless="copy.progdb" />
381             </fileset>
382         </copy>
384     </target>
386     <!-- ============================================================== -->
387     <!-- copies a license and notices into the root of the hdk          -->
388     <!-- ============================================================== -->
389     <target name="assemble-hdk-doc">
391         <copy todir="${target.dir}/hdk" overwrite="true">
392             <fileset dir="./">
393                 <include name="LICENSE" />
394                 <include name="NOTICE" />
395             </fileset>
396         </copy>
398     </target>
400     <!-- ============================================================== -->
401     <!-- copies a license and notices into the root of the JDK and JRE  -->
402     <!-- ============================================================== -->
403     <target name="assemble-jre-doc">
405         <copy todir="${target.dir}/hdk/jdk/jre" overwrite="true">
406             <fileset dir="./">
407                 <include name="LICENSE" />
408                 <include name="NOTICE" />
409             </fileset>
410         </copy>
411     </target>
413     <target name="assemble-jdk-doc">
414         <copy todir="${target.dir}/hdk/jdk/" overwrite="true">
415             <fileset dir="./">
416                 <include name="LICENSE" />
417                 <include name="NOTICE" />
418             </fileset>
419         </copy>
420     </target>
422     <!-- ============================================================== -->
423     <!-- ensures dependencies are up to date, then builds classlib      -->
424     <!-- ============================================================== -->
426     <propertyset id="required.props">
427         <propertyref name="hy.cfg" />
428         <propertyref name="hy.local.zlib" />
429         <propertyref name="use.libstdc++5" />
430         <propertyref name="harmony.java.version" />
431     </propertyset>
432     
433     <target name="build-classlib" depends="auto-fetch-classlib-libs">
434         <ant antfile="working_classlib/build.xml" target="build" inheritAll="false" >
435             <propertyset refid="required.props" />
436             <property name="svn.info" value="${harmony.long.version}"/>
437             <property name="svn.revision" value="${harmony.version}"/>
438             <property name="keep.working" value="true" />
439         </ant>
440         <!-- hack to make sure the vm doesn't use the classlib
441              LICENSE/NOTICE files as they don't cover ICU4C
442           -->
443         <copy todir="working_classlib/deploy" overwrite="true">
444             <fileset dir=".">
445                 <include name="LICENSE" />
446                 <include name="NOTICE" />
447             </fileset>
448         </copy>                                                             
449     </target>
451     <target name="auto-fetch-classlib-libs" if="auto.fetch">
452         <ant target="fetch-classlib-libs">
453             <propertyset refid="required.props" />
454             <property name="svn.info" value="${harmony.long.version}"/>
455             <property name="svn.revision" value="${harmony.version}"/>
456         </ant>
457     </target>
459     <target name="fetch-classlib-libs">
460         <ant antfile="working_classlib/build.xml" target="fetch-depends" inheritall="false" >
461             <propertyset refid="required.props" />
462             <property name="svn.info" value="${harmony.long.version}"/>
463             <property name="svn.revision" value="${harmony.version}"/>
464         </ant>
465     </target>
467     <target name="clean-classlib">
468         <ant antfile="working_classlib/build.xml" target="clean" inheritAll="false" >
469             <propertyset refid="required.props" />
470             <property name="svn.info" value="${harmony.long.version}"/>
471             <property name="svn.revision" value="${harmony.version}"/>
472             <property name="keep.working" value="true" />
473         </ant>
474     </target>
476     <target name="init-classlib-hdk">
477         <ant antfile="working_classlib/build.xml"
478                 target="-init-hdk" inheritAll="false" >
479             <property name="hy.cfg" value="${hy.cfg}"/>
480             <property name="svn.info" value="${harmony.long.version}"/>
481             <property name="svn.revision" value="${harmony.version}"/>
482             <property name="keep.working" value="true" />
483         </ant>
484     </target>
486     <!-- ============================================================== -->
487     <!-- ensures that dependencies are up to date and then builds a vm  -->
488     <!-- ============================================================== -->
489     <target name="build-vm" depends="auto-fetch-vm-libs">
490         <ant antfile="working_vm/build.xml" target="build" inheritAll="false" >
491             <propertyset refid="required.props" />
492             <property name="svn.info" value="${harmony.long.version}"/>
493             <property name="svn.revision" value="${harmony.version}"/>
494             <property name="deploy.canonical.flag" value="true"/>
495         </ant>
496     </target>
498     <target name="auto-fetch-vm-libs" if="auto.fetch">
499         <ant target="fetch-vm-libs">
500             <propertyset refid="required.props" />
501             <property name="svn.info" value="${harmony.long.version}"/>
502             <property name="svn.revision" value="${harmony.version}"/>
503         </ant>
504     </target>
506     <target name="fetch-vm-libs">
507         <ant antfile="working_vm/build.xml" target="fetch-depends" inheritall="false" >
508             <propertyset refid="required.props" />
509             <property name="svn.info" value="${harmony.long.version}"/>
510             <property name="svn.revision" value="${harmony.version}"/>
511         </ant>
512     </target>
514     <target name="clean-vm">
515         <ant antfile="working_vm/build.xml" target="clean" inheritall="false" >
516             <propertyset refid="required.props" />
517             <property name="svn.info" value="${harmony.long.version}"/>
518             <property name="svn.revision" value="${harmony.version}"/>
519             <property name="deploy.canonical.flag" value="true"/>
520         </ant>
521     </target>
523     <!-- ============================================================== -->
524     <!-- fetches the common resources                                   -->
525     <!-- ============================================================== -->
526     <target name="build-commonresources" depends="auto-fetch-commonresources"/>
528     <target name="auto-fetch-commonresources" if="auto.fetch">
529         <ant target="fetch-commonresources">
530             <propertyset refid="required.props" />
531             <property name="svn.info" value="${harmony.long.version}"/>
532             <property name="svn.revision" value="${harmony.version}"/>
533         </ant>
534     </target>
536     <target name="fetch-commonresources">
537         <ant antfile="common_resources/build.xml" target="fetch-depends" inheritall="false" >
538             <property name="hy.cfg" value="${hy.cfg}"/>
539             <property name="svn.info" value="${harmony.long.version}"/>
540             <property name="svn.revision" value="${harmony.version}"/>
541         </ant>
542     </target>
544     <!-- ============================================================== -->
545     <!-- ensures dependencies are up to date, then builds jdktools      -->
546     <!-- ============================================================== -->
547     <target name="build-jdktools" depends="auto-fetch-jdktools-libs">
548         <ant antfile="working_jdktools/build.xml" target="build" inheritall="false" >
549             <property name="hy.cfg" value="${hy.cfg}"/>
550             <property name="svn.info" value="${harmony.long.version}"/>
551             <property name="svn.revision" value="${harmony.version}"/>
552         </ant>
553     </target>
555     <target name="auto-fetch-jdktools-libs" if="auto.fetch">
556         <ant target="fetch-jdktools-libs" inheritall="false" >
557             <property name="hy.cfg" value="${hy.cfg}"/>
558         </ant>
559     </target>
561     <target name="fetch-jdktools-libs">
562         <ant antfile="working_jdktools/build.xml" target="fetch-depends" inheritall="false" >
563             <property name="hy.cfg" value="${hy.cfg}"/>
564         </ant>
565     </target>
567     <target name="clean-jdktools">
568         <ant antfile="working_jdktools/build.xml" target="clean" inheritall="false" >
569             <property name="hy.cfg" value="${hy.cfg}"/>
570             <property name="svn.info" value="${harmony.long.version}"/>
571             <property name="svn.revision" value="${harmony.version}"/>
572         </ant>
573     </target>
575     <!-- ============================================================== -->
576     <!-- recreates distribution dir                                     -->
577     <!-- ============================================================== -->
578     <target name="setup" depends="init, properties">
579         <delete dir="${target.dir}"/>
580         <mkdir dir="${target.dir}"/>
581     </target>
584     <!-- ============================================================== -->
585     <!-- hard reset - removes checked out classlib and vm tree          -->
586     <!-- ============================================================== -->
587     <target name="reset"
588         description="removes vm and classlib dirs and resets - BE SURE YOU WANT TO DO THIS"
589         depends="clean">
591         <!-- delete the working directories and then do an svn update to reset them -->
592         <delete dir="working_classlib"/>
593         <delete dir="working_vm"/>
595         <exec executable="svn" dir="." failonerror="true">
596             <arg line="update" />
597         </exec>
599     </target>
601     <target name="clean"
602         depends="init-classlib-hdk,
603                  clean-jdktools,
604                  clean-classlib,
605                  clean-vm,
606                  clean-tests" >
607         <delete dir="${target.dir}" failonerror="false" />
608     </target>
610     <!-- ============================================================== -->
611     <!-- switches the working_vm directory to vm module (DRLVM for now) -->
612     <!-- ============================================================== -->
613     <target name="switch-svn-vm" depends="init" if="is.svn">
614         <exec executable="svn" dir="working_vm" failonerror="true">
615             <arg line="-r${svn.revision}"/>
616             <arg line="switch" />
617             <arg line="${vm.svn.url}" />
618         </exec>
619     </target>
621     <!-- ============================================================== -->
622     <!-- switches the working_classlib directory to classlib            -->
623     <!-- ============================================================== -->
624     <target name="switch-svn-classlib" depends="init" if="is.svn">
625         <exec executable="svn" dir="working_classlib" failonerror="true">
626             <arg line="-r${svn.revision}"/>
627             <arg line="switch" />
628             <arg line="${classlib.svn.url}" />
629         </exec>
630     </target>
632     <!-- ============================================================== -->
633     <!-- switches the working_jdktools directory to jdktools            -->
634     <!-- ============================================================== -->
635     <target name="switch-svn-jdktools" depends="init" if="is.svn">
636         <exec executable="svn" dir="working_jdktools" failonerror="true">
637             <arg line="-r${svn.revision}"/>
638             <arg line="switch" />
639             <arg line="${jdktools.svn.url}" />
640         </exec>
641     </target>
643     <!-- ============================================================== -->
644     <!-- switches the common_resources directory to common_resources    -->
645     <!-- ============================================================== -->
646     <target name="switch-svn-commonresources" depends="init" if="is.svn">
647         <exec executable="svn" dir="common_resources" failonerror="true">
648             <arg line="-r${svn.revision}"/>
649             <arg line="switch" />
650             <arg line="${commonresources.svn.url}" />
651         </exec>
652     </target>
654     <!-- ============================================================== -->
655     <!-- sets up a platform                                             -->
656     <!-- ============================================================== -->
657     <target name="init" depends="svn-prop">
658         <!-- Determine our operating system -->
659         <condition property="is.windows">
660             <os family="windows" />
661         </condition>
663         <condition property="is.unix">
664             <os family="unix" />
665         </condition>
667         <condition property="is.linux">
668             <os name="linux" />
669         </condition>
671         <!-- this special case makes sense -->
672         <condition property="harmony.os" value="windows">
673             <isset property="is.windows"/>
674         </condition>
675         <condition property="harmony.os" value="linux">
676             <os name="linux" />
677         </condition>
679         <property name="harmony.os" value="${os.name}" />
681         <!-- Conditions for different architectures -->
682         <condition property="is.x86_64">
683             <os arch="x86_64"/>
684         </condition>
685         <condition property="is.x86">
686             <or>
687                 <os arch="x86"/>
688                 <os arch="i386"/>
689             </or>
690         </condition>
691         <condition property="is.ia64">
692             <os arch="ia64" />
693         </condition>
694         <condition property="is.64bit">
695             <or>
696                 <os arch="ia64" />
697                 <os arch="x86_64"/>
698             </or>
699         </condition>
700         <condition property="is.32bit">
701             <or>
702                 <os arch="x86"/>
703                 <os arch="i386"/>
704             </or>
705         </condition>
706         <condition property="harmony.bits" value="32">
707             <isset property="is.32bit" />
708         </condition>
709         <property name="harmony.bits" value="64" />
711         <!-- Normalized architecture name -->
712         <condition property="harmony.arch" value="x86">
713             <isset property="is.x86" />
714         </condition>
715         <condition property="harmony.arch" value="x86_64">
716             <or>
717                 <os arch="x86_64"/>
718                 <os arch="amd64"/>
719                 <os arch="em64t"/>
720             </or>
721         </condition>
722         <property name="harmony.arch" value="${os.arch}" />
724         <property name="harmony.deploy.suffix" value="-snapshot" />
726         <condition property="harmony.java.version" value="6.0" else="5.0">
727             <isset property="java6" />
728         </condition>
730         <property name="deploy.file.prefix"
731                   value="apache-harmony-${harmony.java.version}-" />
733         <property name="archive.dir.prefix"
734                   value="harmony-${harmony.java.version}-" />
736         <property name="deploy.hdk.file.prefix"
737                  value="${deploy.file.prefix}hdk-r${harmony.version}" />
738         <property name="deploy.hdk.tar"
739                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
740         <property name="deploy.hdk.zip"
741                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
743         <property name="deploy.jdk.file.prefix"
744                  value="${deploy.file.prefix}jdk-r${harmony.version}" />
745         <property name="deploy.jdk.tar"
746                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
747         <property name="deploy.jdk.zip"
748                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
750         <property name="deploy.jre.file.prefix"
751                  value="${deploy.file.prefix}jre-r${harmony.version}" />
752         <property name="deploy.jre.tar"
753                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
754         <property name="deploy.jre.zip"
755                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
757         <property name="deploy.src.file.prefix"
758                  value="${deploy.file.prefix}src-r${harmony.version}" />
759         <property name="deploy.src.tar"
760                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.tar.gz" />
761         <property name="deploy.src.zip"
762                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.zip" />
764         <!-- copy symbol debug info to debug build on Windows -->
765         <condition property="copy.progdb">
766             <equals arg1="${hy.cfg}" arg2="debug" />
767         </condition>
768         
769         <!-- workaround for drlvm build till it starts with a script-->
770         <condition property="custom.props" value="-Dhy.javac.compiler=${hy.javac.compiler}"
771             else="">
772             <isset property="hy.javac.compiler"/>
773         </condition>
775     </target>
777     <target name="properties" depends="init">
778         <echo>
779                    Apache Harmony Federated Build
780             ==========================================
781             svn rev          :  ${harmony.version}
782             operating system :  ${harmony.os}
783             CPU architecture :  ${harmony.arch}
784             word length      :  ${harmony.bits}
785             ant os name/arch :  ${os.name}/${os.arch}
786             hosting Java     :  ${java.version} (${java.vendor})
787             build mode       :  ${hy.cfg}
788             output location  :  ${target.dir}
789             SVN root         :  ${svn.root}
790         </echo>
791     </target>
793     <!-- ============================================================== -->
794     <!-- svn-prop: gets svn revision number of the build.xml file       -->
795     <!-- ============================================================== -->
796     <target name="svn-prop">
797         
798         <tempfile suffix=".xml" property="svn.tmp"/>
799         <exec executable="svn" output="${svn.tmp}" resultproperty="svn.rc">
800             <arg line="info ${basedir} --non-interactive --xml" />
801         </exec>
802         <condition property="svn.info.file" value="${svn.tmp}">
803             <equals arg1="0" arg2="${svn.rc}"/>
804         </condition>
805         <xmlproperty file="${svn.info.file}" prefix="federated" 
806             keeproot="no" collapseAttributes="yes"/>
807         <delete file="${svn.tmp}" quiet="true"/>
809         <condition property="is.svn">
810             <isset property="federated.entry.revision"/>
811         </condition>
812         <condition property="svn.revision" value="${federated.entry.revision}" else="unknown">
813             <isset property="is.svn"/>
814         </condition>
815             <condition property="svn.root" 
816                 value="${federated.entry.repository.root}"
817                 else="http://svn.apache.org/repos/asf">
818                 <isset property="is.svn"/>
819             </condition>
821         <condition property="svn.info" value="${svn.root} ${svn.revision}">
822             <isset property="is.svn"/>
823         </condition>
824         <tstamp>
825             <format property="svn.info" pattern="'Unknown revision at' dd-MMM-yyyy hh:mm aa"/>
826         </tstamp>
828         <property name="harmony.version" value="${svn.revision}" />
829         <property name="harmony.long.version" value="${svn.info}" />
831         <!-- default SVN URLs -->
832         <condition property="classlib.svn.url"
833                    value="${svn.root}/harmony/enhanced/classlib/branches/java6"
834                    else="${svn.root}/harmony/enhanced/classlib/trunk">
835             <isset property="java6" />
836         </condition>
838         <property name="vm.svn.url" value="${svn.root}/harmony/enhanced/drlvm/trunk" />
840         <condition property="jdktools.svn.url"
841                    value="${svn.root}/harmony/enhanced/jdktools/branches/java6"
842                    else="${svn.root}/harmony/enhanced/jdktools/trunk">
843             <isset property="java6" />
844         </condition>
846         <property name="commonresources.svn.url" value="${svn.root}/harmony/enhanced/common_resources/trunk" />
847     </target>
849     <target name="bundle-src-tgz" depends="init" if="is.unix">
851         <tar tarfile="${target.dir}/${deploy.src.tar}" compression="gzip"
852              longfile="gnu" >
853             <tarfileset dir="${target.dir}/src" prefix="${deploy.file.prefix}src-r${harmony.version}" mode="755">
854                 <include name="debian/rules"/>
855             </tarfileset>
856             <tarfileset dir="${target.dir}/src" prefix="${deploy.file.prefix}src-r${harmony.version}">
857                 <include name="**"/>
858                 <exclude name="debian/rules"/>
859             </tarfileset>
860         </tar>
862         <chksum dir="${target.dir}" file="${deploy.src.tar}" />
863         <chksum dir="${target.dir}" file="${deploy.src.tar}" type="sha" />
865     </target>
867     <target name="bundle-src-zip" depends="init" unless="is.unix">
868         <zip destfile="${target.dir}/${deploy.src.zip}">
869             <zipfileset dir="${target.dir}/src"
870                         prefix="${deploy.file.prefix}src-r${harmony.version}"
871                         filemode="755">
872                 <include name="debian/rules"/>
873             </zipfileset>
874             <zipfileset dir="${target.dir}/src"
875                         prefix="${deploy.file.prefix}src-r${harmony.version}">
876                 <include name="**"/>
877                 <exclude name="debian/rules"/>
878             </zipfileset>
879         </zip>
880         <chksum dir="${target.dir}" file="${deploy.src.zip}" />
881         <chksum dir="${target.dir}" file="${deploy.src.zip}" type="sha" />
882     </target>
884     <target name="copy-src" depends="init,populate-src">
885         <exec executable="svn">
886             <arg value="export" />
887             <arg value="." />
888             <arg value="${target.dir}/src" />
889         </exec>
890         <echo file="${target.dir}/src/release.properties">
891 harmony.version=${harmony.version}
892 harmony.long.version=${harmony.long.version}
893 harmony.deploy.suffix=${harmony.deploy.suffix}
894 harmony.java.version=${harmony.java.version}
895         </echo>
896         <chmod file="${target.dir}/src/debian/rules" perm="ugo+x" />
897     </target>
899     <target name="test"
900             depends="test-classlib,test-jdktools,process-test-output" />
902     <target name="clean-tests">
903         <delete dir="build/test_report" />
904     </target>
906     <target name="test-classlib" depends="clean-tests">
907         <ant antfile="working_classlib/make/build-test.xml"
908              target="test-modules" inheritAll="false" >
909             <propertyset refid="required.props" />
910             <property name="svn.info" value="${harmony.long.version}"/>
911             <property name="svn.revision" value="${harmony.version}"/>
912             <property name="keep.working" value="true" />
913             <property name="tests.output" location="build/test_report" />
914             <property name="test.jre.home" location="target/hdk/jdk/jre" />
915         </ant>
916     </target>
918     <target name="test-jdktools" depends="clean-tests">
919         <ant antfile="working_jdktools/make/build-test.xml"
920              target="test-modules" inheritAll="false" >
921             <propertyset refid="required.props" />
922             <property name="svn.info" value="${harmony.long.version}"/>
923             <property name="svn.revision" value="${harmony.version}"/>
924             <property name="keep.working" value="true" />
925             <property name="tests.output" location="build/test_report" />
926             <property name="test.jre.home" location="target/hdk/jdk/jre" />
927         </ant>
928     </target>
930     <target name="process-test-output">
931         <ant antfile="working_classlib/make/build-test.xml"
932              target="process-test-output" inheritAll="false" >
933             <propertyset refid="required.props" />
934             <property name="svn.info" value="${harmony.long.version}"/>
935             <property name="svn.revision" value="${harmony.version}"/>
936             <property name="keep.working" value="true" />
937             <property name="tests.output" location="build/test_report" />
938             <property name="test.jre.home" location="target/hdk/jdk/jre" />
939         </ant>
940     </target>
942     <!-- ============================================================== -->
943     <!-- produces a nice looking checksum                               -->
944     <!-- ============================================================== -->
945     <macrodef name="chksum">
946         <attribute name="dir" />
947         <attribute name="file" />
948         <attribute name="type" default="md5" />
949         <sequential>
950             <checksum property="@{file}.@{type}"
951                       file="@{dir}/@{file}"
952                       algorithm="@{type}" />
953             <echo file="@{dir}/@{file}.@{type}"
954                   message="${@{file}.@{type}}  @{file}${line.separator}" />
955         </sequential>
956     </macrodef>
958 </project>