[r586954] Making hy.local.zlib change again - the classlib issue is now fixed.
[harmony.git] / build.xml
blob444b13aae073c7da2655ab8969546f19b9b58cab
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="default" basedir=".">
23     <!-- name of the target directory to use for building and final assembly -->
24     <property name="target.dir" value="target" />
26     <!-- classlib location to tell DRLVM build -->
27     <property name="drlvm.classlib.offset" value="../../../working_classlib"/>
29     <!-- release property file which is added to source release -->
30     <property file="release.properties" />
32     <!-- debug or release version -->
33     <property name="hy.cfg" value="release" />
35     <property name="hy.no.sig" value="false" />
36     <property name="hy.local.zlib" value="false" />
38     <description>
39         Apache Harmony subproject federation script
40     </description>
42     <!-- ================================================================================ -->
43     <!--     main target - should checkout, build and package hdk, jdk and jre            -->
44     <!-- ================================================================================ -->
45     <target name="default"
46         description="setup and build complete implementation"
47         depends="setup,
48                  populate_source,
49                  build-all,
50                  assemble_artifacts,
51                  bundle_hdk,
52                  bundle_jdk,
53                  bundle_jre"/>
54     
55     <target name="make-snapshot"
56         description="setup and build complete src + binaries set"
57         depends="bundle_src,
58                  build-all,
59                  assemble_artifacts,
60                  bundle_hdk,
61                  bundle_jdk,
62                  bundle_jre"/>
64     <target name="build-all"
65         description="build complete implementation"
66         depends="show_props,
67                  build_classlib,
68                  build_vm,
69                  build_commonresources,
70                  build_jdktools"/>
71     
72     <target name="bundle_src" 
73         description="assemble source snapshot"
74         depends="setup,copy_source,bundle_src_tgz,bundle_src_zip" />
76     <!-- =============================================================================== -->
77     <!--     populates the source directories, working_classlib and working_vm           -->
78     <!-- =============================================================================== -->
79     <target name="populate_source" depends="init, show_props, switch_svn_vm, switch_svn_classlib, 
80                                                                                 switch_svn_jdktools, switch_svn_commonresources"
81             description="checkout the class library and VM source trees"/>
83     <!-- ================================================================================ -->
84     <!--     creates the HDK bundle appropriate for the platform                          -->
85     <!-- ================================================================================ -->
86     <target name="bundle_hdk" depends="assemble_artifacts, assemble_hdk_doc,bundle_hdk_tgz,bundle_hdk_zip"/>
88     <target name="bundle_hdk_tgz" depends="init" if="is.unix">
90         <!-- create the tar file and then md5 checksum using harmony-hdk-rev as the root,
91              and setting exec bits as needed -->
92         <tar tarfile="${target.dir}/${deploy.hdk.tar}" compression="gzip">
93             <tarfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}" mode="755">
94                 <include name="jdk/jre/bin/java"/>
95                 <include name="jdk/bin/*"/>
96             </tarfileset>
97             <tarfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}">
98                 <include name="**"/>
99                 <exclude name="jdk/jre/bin/java"/>
100                 <exclude name="jdk/bin/*"/>
101             </tarfileset>
102         </tar>
104         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" />
105         <chksum dir="${target.dir}" file="${deploy.hdk.tar}" type="sha" />
107     </target>
109     <target name="bundle_hdk_zip" depends="init" unless="is.unix">
110         <!-- create the tar file and then md5 checksum using harmony-hdk-rev as the root,
111              and setting exec bits as needed -->
112         <zip destfile="${target.dir}/${deploy.hdk.zip}" >
113             <zipfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}" filemode="755">
114                 <include name="jdk/jre/bin/java.exe"/>
115                 <include name="jdk/jre/bin/javaw.exe"/>
116                 <include name="jdk/bin/*"/>
117             </zipfileset>
118             <zipfileset dir="${target.dir}/hdk" prefix="harmony-hdk-${harmony.version}">
119                 <include name="**"/>
120                 <exclude name="jdk/jre/bin/java.exe"/>
121                 <exclude name="jdk/jre/bin/javaw.exe"/>
122                 <exclude name="jdk/bin/*"/>
123             </zipfileset>
124         </zip>
126         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" />
127         <chksum dir="${target.dir}" file="${deploy.hdk.zip}" type="sha" />
128     </target>
130     <!-- ================================================================================ -->
131     <!--     creates the JDK bundle appropriate for the platform                          -->
132     <!-- ================================================================================ -->
133     <target name="bundle_jdk" depends="assemble_jdk_doc,bundle_jdk_tgz,bundle_jdk_zip"/>
135     <target name="bundle_jdk_tgz" depends="init" if="is.unix">
137         <tar tarfile="${target.dir}/${deploy.jdk.tar}" compression="gzip" >
138             <tarfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}" mode="755">
139                 <include name="jre/bin/java"/>
140                 <include name="bin/*"/>
141             </tarfileset>
142             <tarfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}">
143                 <include name="**"/>
144                 <exclude name="jre/bin/java"/>
145                 <exclude name="bin/*"/>
146             </tarfileset>
147         </tar>
149         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" />
150         <chksum dir="${target.dir}" file="${deploy.jdk.tar}" type="sha" />
152     </target>
154     <target name="bundle_jdk_zip" depends="init" unless="is.unix">
155         <zip destfile="${target.dir}/${deploy.jdk.zip}">
156             <zipfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}" filemode="755">
157                 <include name="jre/bin/java.exe"/>
158                 <include name="jre/bin/javaw.exe"/>
159                 <include name="bin/*"/>
160             </zipfileset>
161             <zipfileset dir="${target.dir}/hdk/jdk" prefix="harmony-jdk-${harmony.version}">
162                 <include name="**"/>
163                 <exclude name="jre/bin/java.exe"/>
164                 <exclude name="jre/bin/javaw.exe"/>
165                 <exclude name="bin/*"/>
166             </zipfileset>
167         </zip>
168         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" />
169         <chksum dir="${target.dir}" file="${deploy.jdk.zip}" type="sha" />
170     </target>
172     <!-- ================================================================================ -->
173     <!--     creates the JRE bundle appropriate for the platform                          -->
174     <!-- ================================================================================ -->
175     <target name="bundle_jre" depends="assemble_jre_doc,bundle_jre_tgz,bundle_jre_zip"/>
178     <target name="bundle_jre_tgz" depends="init" if="is.unix">
180         <tar tarfile="${target.dir}/${deploy.jre.tar}" compression="gzip" >
181             <tarfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}" mode="755">
182                 <include name="bin/java"/>
183             </tarfileset>
184             <tarfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}">
185                 <include name="**"/>
186                 <exclude name="bin/java"/>
187             </tarfileset>
188         </tar>
190         <chksum dir="${target.dir}" file="${deploy.jre.tar}" />
191         <chksum dir="${target.dir}" file="${deploy.jre.tar}" type="sha" />
193     </target>
195     <target name="bundle_jre_zip" depends="init" unless="is.unix">
196         <zip destfile="${target.dir}/${deploy.jre.zip}">
197             <zipfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}" filemode="755">
198                 <include name="bin/java.exe"/>
199                 <include name="bin/javaw.exe"/>
200             </zipfileset>
201             <zipfileset dir="${target.dir}/hdk/jdk/jre" prefix="harmony-jre-${harmony.version}">
202                 <include name="**"/>
203                 <exclude name="bin/java.exe"/>
204                 <exclude name="bin/javaw.exe"/>
205             </zipfileset>
206         </zip>
207         <chksum dir="${target.dir}" file="${deploy.jre.zip}" />
208         <chksum dir="${target.dir}" file="${deploy.jre.zip}" type="sha" />
209     </target>
212     <!-- ================================================================================ -->
213     <!--    from the classlib and vm builds, creates the hdk and jre                      -->
214     <!-- ================================================================================ -->
215     <target name="assemble_artifacts" depends="init, assemble_stuff, chmod_stuff"/>
217     <target name="assemble_stuff">
218         <!-- create the top-level hdk directory -->
219         <mkdir dir="${target.dir}/hdk"/>
221         <!-- copy the classlib/deploy tree as the hdk
222              filtering out the jre, as that comes from
223              working_vm -->
224         <copy todir="${target.dir}/hdk">
225             <fileset dir="working_classlib/deploy">
226                 <exclude name="**/jre/**/*" />
227                 <exclude name="**/jdk/lib/*" />
228                 <exclude name="**/jdk/include/*" />
229                 <exclude name="**/*.pdb" unless="copy.progdb" />
230             </fileset>
231         </copy>
233         <!-- now copy the drlvm/build/deploy -->
234         <!-- set overwrite flag to take hythr from VM -->
235         <copy todir="${target.dir}/hdk" overwrite="true">
236             <fileset dir="working_vm/build/deploy">
237                 <exclude name="**/*.pdb" unless="copy.progdb" />
238             </fileset>
239         </copy>
241         <!-- now copy the working_jdktools/deploy/jdk -->
242         <copy todir="${target.dir}/hdk/jdk/">
243             <fileset dir="working_jdktools/deploy/jdk">
244                 <exclude name="**/*.pdb" unless="copy.progdb" />
245             </fileset>
246         </copy>
247     </target>
249     <target name="chmod_stuff" if="is.unix">
250         <chmod file="${target.dir}/hdk/jdk/bin/*" perm="ugo+x" />
251         <chmod file="${target.dir}/hdk/jdk/jre/bin/java*" perm="ugo+x" />
252     </target>
254     <target name="assemble_jdk">
256         <!-- create the top-level jdk directory -->
257         <mkdir dir="${target.dir}/jdk"/>
259         <!-- now copy the drlvm/build/deploy/jre
260              contents into the jre in the JDK -->
261         <copy todir="${target.dir}/jdk/jre">
262             <fileset dir="working_vm/build/deploy/jdk/jre">
263                 <exclude name="**/*.pdb" unless="copy.progdb" />
264             </fileset>
265         </copy>
267         <!-- now copy the drlvm/build/deploy/jre
268              contents into the jre in the JDK -->
269         <copy todir="${target.dir}/jdk/">
270             <fileset dir="working_jdktools/deploy/jdk">
271                 <exclude name="**/*.pdb" unless="copy.progdb" />
272             </fileset>
273         </copy>
275     </target>
277     <!-- ================================================================================ -->
278     <!--    copy license and notices into the root of the hdk                             -->
279     <!-- ================================================================================ -->
280     <target name="assemble_hdk_doc">
282         <copy todir="${target.dir}/hdk">
283             <fileset dir="./">
284                 <include name="COPYRIGHT" />
285                 <include name="LICENSE" />
286                 <include name="NOTICE" />
287                 <include name="THIRD_PARTY_NOTICES.txt" />
288             </fileset>
289         </copy>
291     </target>
293     <!-- ================================================================================ -->
294     <!--    copy license and notices into the root of the JDK and JRE                     -->
295     <!-- ================================================================================ -->
296     <target name="assemble_jre_doc">
298         <copy todir="${target.dir}/hdk/jdk/jre">
299             <fileset dir="./">
300                 <include name="COPYRIGHT" />
301                 <include name="LICENSE" />
302                 <include name="NOTICE" />
303                 <include name="THIRD_PARTY_NOTICES.txt" />
304             </fileset>
305         </copy>
306     </target>
308     <target name="assemble_jdk_doc">
309         <copy todir="${target.dir}/hdk/jdk/">
310             <fileset dir="./">
311                 <include name="COPYRIGHT" />
312                 <include name="LICENSE" />
313                 <include name="NOTICE" />
314                 <include name="THIRD_PARTY_NOTICES.txt" />
315             </fileset>
316         </copy>
317     </target>
319     <!-- ================================================================================ -->
320     <!--    build the classlib - ensure depends are up to date an then rebuild            -->
321     <!-- ================================================================================ -->
322     <target name="build_classlib" depends="auto_fetch_classlib_libs">
323         <ant antfile="working_classlib/build.xml" target="rebuild" inheritAll="false" >
324             <property name="hy.cfg" value="${hy.cfg}"/>
325             <property name="hy.no.sig" value="${hy.no.sig}"/>
326             <property name="hy.local.zlib" value="${hy.local.zlib}"/>
327             <property name="svn.info" value="${harmony.long.version}"/>
328             <property name="svn.version" value="${harmony.version}"/>
329             <property name="keep.working" value="true" />
330         </ant>
331     </target>
333     <target name="auto_fetch_classlib_libs" if="auto.fetch">
334         <ant target="fetch_classlib_libs">
335             <property name="hy.cfg" value="${hy.cfg}"/>
336             <property name="hy.no.sig" value="${hy.no.sig}"/>
337             <property name="hy.local.zlib" value="${hy.local.zlib}"/>
338             <property name="svn.info" value="${harmony.long.version}"/>
339             <property name="svn.version" value="${harmony.version}"/>
340         </ant>
341     </target>
343     <target name="fetch_classlib_libs">
344         <ant antfile="working_classlib/build.xml" target="fetch-depends" inheritall="false" >
345             <property name="hy.cfg" value="${hy.cfg}"/>
346             <property name="hy.no.sig" value="${hy.no.sig}"/>
347             <property name="hy.local.zlib" value="${hy.local.zlib}"/>
348             <property name="svn.info" value="${harmony.long.version}"/>
349             <property name="svn.version" value="${harmony.version}"/>
350         </ant>
351     </target>
353     <target name="clean_classlib">
354         <ant antfile="working_classlib/build.xml" target="clean" inheritAll="false" >
355             <property name="hy.cfg" value="${hy.cfg}"/>
356             <property name="hy.no.sig" value="${hy.no.sig}"/>
357             <property name="hy.local.zlib" value="${hy.local.zlib}"/>
358             <property name="svn.info" value="${harmony.long.version}"/>
359             <property name="svn.version" value="${harmony.version}"/>
360             <property name="keep.working" value="true" />
361         </ant>
362     </target>
364     <target name="init_classlib_hdk">
365         <ant antfile="working_classlib/make/build-native.xml"
366                 target="copy-makefile-includes" inheritAll="false" >
367             <property name="hy.cfg" value="${hy.cfg}"/>
368             <property name="svn.info" value="${harmony.long.version}"/>
369             <property name="svn.version" value="${harmony.version}"/>
370             <property name="keep.working" value="true" />
371         </ant>
372     </target>
374     <!-- ================================================================================ -->
375     <!--    build the vm - ensure depends are up to date an then rebuild            -->
376     <!-- ================================================================================ -->
377     <target name="build_vm" depends="init,build_vm_unix,build_vm_windows"/>
379     <target name="clean_vm"
380             depends="init,build_vm_unix_clean,build_vm_windows_clean"/>
382     <target name="build_vm_unix"
383             depends="build_vm_unix_auto_update, build_vm_unix_clean, build_vm_unix_build"
384             if="is.unix" />
386     <target name="build_vm_unix_update" depends="init" if="is.unix">
387         <exec executable="sh" dir="working_vm/build" failonerror="true">
388             <arg line="build.sh update -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
389             <arg line="-Ddeploy.canonical.flag=true"/>
390             <env key="BUILD_CFG" value="${hy.cfg}"/>
391         </exec>
392     </target>
394     <target name="build_vm_unix_auto_update" if="auto.fetch">
395         <ant target="build_vm_unix_update" inheritall="true"/>
396     </target>
398     <target name="build_vm_unix_clean"  depends="init" if="is.unix">
399         <exec executable="sh" dir="working_vm/build" failonerror="true">
400             <arg line="build.sh clean -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
401             <arg line="-Ddeploy.canonical.flag=true"/>
402             <env key="BUILD_CFG" value="${hy.cfg}"/>
403         </exec>
404     </target>
406     <target name="build_vm_unix_build" depends="init" if="is.unix">
407         <exec executable="sh" dir="working_vm/build" failonerror="true">
408             <arg line="build.sh -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
409             <arg line="-Ddeploy.canonical.flag=true"/>
410             <arg line="-Dsvn.revision=${harmony.version}" />
411             <arg line="-Dhy.no.sig=${hy.no.sig}"/>
412             <arg line="-Dhy.local.zlib=${hy.local.zlib}"/>
413             <arg line="${custom.props}"/>
414             <env key="BUILD_CFG" value="${hy.cfg}"/>
415         </exec>
416     </target>
418     <target name="build_vm_windows"
419             depends="build_vm_windows_auto_update, build_vm_windows_clean, build_vm_windows_build"
420             unless="is.unix" />
422     <target name="build_vm_windows_update" unless="is.unix">
423         <exec executable="cmd" dir="working_vm/build" failonerror="true">
424             <arg line="/c build.bat update -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
425             <arg line="-Ddeploy.canonical.flag=true"/>
426             <env key="BUILD_CFG" value="${hy.cfg}"/>
427             <env key="CXX" value="msvc"/>
428         </exec>
429     </target>
431     <target name="build_vm_windows_auto_update" if="auto.fetch">
432         <ant target="build_vm_windows_update" inheritall="true"/>
433     </target>
435     <target name="build_vm_windows_clean" depends="init" unless="is.unix">
436         <exec executable="cmd" dir="working_vm/build" failonerror="true">
437             <arg line="/c build.bat clean -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
438             <arg line="-Ddeploy.canonical.flag=true"/>
439             <env key="BUILD_CFG" value="${hy.cfg}"/>
440             <env key="CXX" value="msvc"/>
441         </exec>
442     </target>
444     <target name="build_vm_windows_build" depends="init" unless="is.unix">
445         <exec executable="cmd" dir="working_vm/build" failonerror="true">
446             <arg line="/c build.bat -Dexternal.dep.CLASSLIB.loc=${drlvm.classlib.offset}"/>
447             <arg line="-Ddeploy.canonical.flag=true"/>
448             <arg line="-Dhy.no.sig=${hy.no.sig}"/>
449             <arg line="-Dhy.local.zlib=${hy.local.zlib}"/>
450             <arg line="${custom.props}"/>
451             <env key="BUILD_CFG" value="${hy.cfg}"/>
452             <env key="CXX" value="msvc"/>
453         </exec>
454     </target>
456     <!-- ================================================================================ -->
457     <!--    build the common resources - ensure depends are up to date an then rebuild            -->
458     <!-- ================================================================================ -->
459     <target name="build_commonresources">
460         <ant antfile="common_resources/build.xml" target="fetch-depends" inheritall="false" >
461             <property name="hy.cfg" value="${hy.cfg}"/>
462             <property name="svn.info" value="${harmony.long.version}"/>
463             <property name="svn.version" value="${harmony.version}"/>
464         </ant>
465     </target>
467     <!-- ================================================================================ -->
468     <!--    build the common resources - ensure depends are up to date an then rebuild            -->
469     <!-- ================================================================================ -->
470     <target name="build_jdktools" depends="auto_fetch_jdktools_libs">
471         <ant antfile="working_jdktools/build.xml" target="rebuild" inheritall="false" >
472             <property name="hy.cfg" value="${hy.cfg}"/>
473             <property name="svn.info" value="${harmony.long.version}"/>
474             <property name="svn.version" value="${harmony.version}"/>
475         </ant>
476     </target>
478     <target name="auto_fetch_jdktools_libs" if="auto.fetch">
479         <ant target="fetch_jdktools_libs" inheritall="false" >
480             <property name="hy.cfg" value="${hy.cfg}"/>
481         </ant>
482     </target>
484     <target name="fetch_jdktools_libs" if="auto.fetch">
485         <ant antfile="working_jdktools/build.xml" target="fetch-depends" inheritall="false" >
486             <property name="hy.cfg" value="${hy.cfg}"/>
487         </ant>
488     </target>
490     <target name="clean_jdktools">
491         <ant antfile="working_jdktools/build.xml" target="clean" inheritall="false" >
492             <property name="hy.cfg" value="${hy.cfg}"/>
493             <property name="svn.info" value="${harmony.long.version}"/>
494             <property name="svn.version" value="${harmony.version}"/>
495         </ant>
496     </target>
498     <!-- ================================================================================ -->
499     <!--    trivial setup                                                                 -->
500     <!-- ================================================================================ -->
501     <target name="setup" depends="init, show_props">
502         <delete dir="${target.dir}"/>
503         <mkdir dir="${target.dir}"/>
504     </target>
507     <!-- ================================================================================ -->
508     <!--    hard reset - remove checked out classlib and vm tree- be sure you want this   -->
509     <!-- ================================================================================ -->
510     <target name="reset"
511         description="removes vm and classlib dirs and resets - BE SURE YOU WANT TO DO THIS"
512         depends="clean">
514         <!-- delete the working directories and then do an svn update to reset them -->
515         <delete dir="working_classlib"/>
516         <delete dir="working_vm"/>
518         <exec executable="svn" dir="." failonerror="true">
519             <arg line="update" />
520         </exec>
522     </target>
524     <target name="clean"
525             depends="init_classlib_hdk,clean_jdktools,clean_classlib,clean_vm" >
526         <delete dir="${target.dir}" failonerror="false" />
527     </target>
529     <!-- ================================================================================ -->
530     <!--    Switches the working_vm directory to vm choice - wired for DRLVM for now      -->
531     <!-- ================================================================================ -->
532     <target name="switch_svn_vm" depends="init" if="is.svn">
533         <exec executable="svn" dir="working_vm" failonerror="true">
534             <arg line="-r${svn.revision}"/>
535             <arg line="switch" />
536             <arg line="${vm.svn.url}" />
537         </exec>
538     </target>
540     <!-- ================================================================================ -->
541     <!--    Switches the working_vm directory to classlib choice                          -->
542     <!-- ================================================================================ -->
543     <target name="switch_svn_classlib" depends="init" if="is.svn">
544         <exec executable="svn" dir="working_classlib" failonerror="true">
545             <arg line="-r${svn.revision}"/>
546             <arg line="switch" />
547             <arg line="${classlib.svn.url}" />
548         </exec>
549     </target>
551     <!-- ================================================================================ -->
552     <!--    Switches the working_jdktools directory to jdktools                           -->
553     <!-- ================================================================================ -->
554     <target name="switch_svn_jdktools" depends="init" if="is.svn">
555         <exec executable="svn" dir="working_jdktools" failonerror="true">
556             <arg line="-r${svn.revision}"/>
557             <arg line="switch" />
558             <arg line="${jdktools.svn.url}" />
559         </exec>
560     </target>
562     <!-- ================================================================================ -->
563     <!--    Switches the common_resources directory to common_resources                   -->
564     <!-- ================================================================================ -->
565     <target name="switch_svn_commonresources" depends="init" if="is.svn">
566         <exec executable="svn" dir="common_resources" failonerror="true">
567             <arg line="-r${svn.revision}"/>
568             <arg line="switch" />
569             <arg line="${commonresources.svn.url}" />
570         </exec>
571     </target>
573     <!-- ================================================================================ -->
574     <!--   init :                                                                         -->
575     <!--     basic setup - reused stuff from classlib/properties.xml for expediency       -->
576     <!-- ================================================================================ -->
577     <target name="init" depends="svn-prop">
578         <!-- Determine our operating system -->
579         <condition property="is.windows">
580             <os family="windows" />
581         </condition>
583         <condition property="is.unix">
584             <os name="linux" />
585         </condition>
587         <condition property="is.linux">
588             <os name="linux" />
589         </condition>
591         <!-- this special case makes sense -->
592         <condition property="harmony.os" value="windows">
593             <isset property="is.windows"/>
594         </condition>
595         <condition property="harmony.os" value="linux">
596             <os name="linux" />
597         </condition>
599         <property name="harmony.os" value="${os.name}" />
601         <!-- Conditions for different architectures -->
602         <condition property="is.x86_64">
603             <os arch="x86_64"/>
604         </condition>
605         <condition property="is.x86">
606             <or>
607                 <os arch="x86"/>
608                 <os arch="i386"/>
609             </or>
610         </condition>
611         <condition property="is.ia64">
612             <os arch="ia64" />
613         </condition>
614         <condition property="is.64bit">
615             <or>
616                 <os arch="ia64" />
617                 <os arch="x86_64"/>
618             </or>
619         </condition>
620         <condition property="is.32bit">
621             <or>
622                 <os arch="x86"/>
623                 <os arch="i386"/>
624             </or>
625         </condition>
626         <condition property="harmony.bits" value="32">
627             <isset property="is.32bit" />
628         </condition>
629         <property name="harmony.bits" value="64" />
631         <!-- Normalized architecture name -->
632         <condition property="harmony.arch" value="x86">
633             <isset property="is.x86" />
634         </condition>
635         <condition property="harmony.arch" value="x86_64">
636             <or>
637                 <os arch="x86_64"/>
638                 <os arch="amd64"/>
639                 <os arch="em64t"/>
640             </or>
641         </condition>
642         <property name="harmony.arch" value="${os.arch}" />
644         <property name="harmony.deploy.suffix" value="-snapshot" />
646         <property name="deploy.hdk.file.prefix"
647                  value="apache-harmony-hdk-r${harmony.version}" />
648         <property name="deploy.hdk.tar"
649                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
650         <property name="deploy.hdk.zip"
651                  value="${deploy.hdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
653         <property name="deploy.jdk.file.prefix"
654                  value="apache-harmony-jdk-r${harmony.version}" />
655         <property name="deploy.jdk.tar"
656                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
657         <property name="deploy.jdk.zip"
658                  value="${deploy.jdk.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
660         <property name="deploy.jre.file.prefix"
661                  value="apache-harmony-jre-r${harmony.version}" />
662         <property name="deploy.jre.tar"
663                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.tar.gz" />
664         <property name="deploy.jre.zip"
665                  value="${deploy.jre.file.prefix}-${harmony.os}-${harmony.arch}-${harmony.bits}${harmony.deploy.suffix}.zip" />
667         <property name="deploy.src.file.prefix"
668                  value="apache-harmony-src-r${harmony.version}" />
669         <property name="deploy.src.tar"
670                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.tar.gz" />
671         <property name="deploy.src.zip"
672                  value="${deploy.src.file.prefix}${harmony.deploy.suffix}.zip" />
674         <!-- copy symbol debug info to debug build on Windows -->
675         <condition property="copy.progdb">
676             <equals arg1="${hy.cfg}" arg2="debug" />
677         </condition>
678         
679         <!-- workaround for drlvm build till it starts with a script-->
680         <condition property="custom.props" value="-Dhy.javac.compiler=${hy.javac.compiler}"
681             else="">
682             <isset property="hy.javac.compiler"/>
683         </condition>
685     </target>
687     <target name="show_props" depends="init">
688         <echo>
689                    Apache Harmony Federated Build
690             ==========================================
691             svn rev          :  ${harmony.version}
692             operating system :  ${harmony.os}
693             architecture     :  ${harmony.arch}-${harmony.bits}
694             ant os name/arch :  ${os.name}/${os.arch}
695             hosting Java     :  ${java.version} (${java.vendor})
696             build mode       :  ${hy.cfg}
697             output location  :  ${target.dir}
698             DRLVM classlib   :  ${drlvm.classlib.offset}
699             SVN root         :  ${svn.root}
700         </echo>
701     </target>
703     <!-- ================================================================================ -->
704     <!-- svn-prop : get svn revision number of the build.xml file                         -->
705     <!--                                                                                  -->
706     <!--         taken from classlib/properties.xml, because of uncertainty               -->
707     <!--         of state of the working_classlib dir, I need a copy                      -->
708     <!--   TODO - we want to be able to pass property in to ant so we don't need a        -->
709     <!--      pause and it's reproducable                                                 -->
710     <!-- ================================================================================ -->
711     <target name="svn-prop">
712         <exec executable="svn"
713               dir="."
714               failifexecutionfails="false"
715               resultproperty="svn.rc">
716             <arg value="info" />
717             <arg value="build.xml" />
718             <redirector outputproperty="svn.revision.tmp">
719                 <outputfilterchain>
720                     <linecontains>
721                         <contains value="Revision: " />
722                     </linecontains>
723                     <tokenfilter>
724                         <replacestring from="Revision: " to=""/>
725                     </tokenfilter>
726                 </outputfilterchain>
727             </redirector>
728         </exec>
729         <condition property="is.svn" value="true">
730             <equals arg1="${svn.rc}" arg2="0" />
731         </condition>
732         <condition property="svn.revision" value="${svn.revision.tmp}" >
733             <equals arg1="${svn.rc}" arg2="0" />
734         </condition>
735         <property name="svn.revision" value="unknown" />
736         <property name="harmony.version" value="${svn.revision}" />
738         <exec executable="svn"
739               failifexecutionfails="false"
740               resultproperty="svn.rc">
741             <arg value="info" />
742             <redirector outputproperty="svn.root.tmp">
743                 <outputfilterchain>
744                     <linecontainsregexp>
745                         <regexp pattern="Repository Root:" />
746                     </linecontainsregexp>
747                     <tokenfilter>
748                         <replacestring from="Repository Root: " to=""/>
749                     </tokenfilter>
750                     <striplinebreaks/>
751                 </outputfilterchain>
752             </redirector>
753         </exec>
754         <condition property="svn.info" value="${svn.root.tmp} ${svn.revision}" >
755             <equals arg1="${svn.rc}" arg2="0" />
756         </condition>
757         <tstamp>
758             <format property="svn.info"
759                     pattern="'Unknown revision at' dd-MMM-yyyy hh:mm aa"/>
760         </tstamp>
761         <property name="harmony.long.version" value="${svn.info}" />
763         <condition property="svn.root" value="${svn.root.tmp}" >
764             <equals arg1="${svn.rc}" arg2="0" />
765         </condition>
767         <!-- default SVN URLs -->
768         <property name="svn.root" value="http://svn.apache.org/repos/asf"/>
770         <condition property="classlib.svn.url"
771                    value="${svn.root}/harmony/enhanced/classlib/branches/java6"
772                    else="${svn.root}/harmony/enhanced/classlib/trunk">
773             <isset property="java6" />
774         </condition>
776         <property name="vm.svn.url" value="${svn.root}/harmony/enhanced/drlvm/trunk" />
777         <property name="jdktools.svn.url" value="${svn.root}/harmony/enhanced/jdktools/trunk" />
778         <property name="commonresources.svn.url" value="${svn.root}/harmony/enhanced/common_resources" />
779     </target>
781     <target name="bundle_src_tgz" depends="init" if="is.unix">
783         <tar tarfile="${target.dir}/${deploy.src.tar}" compression="gzip"
784              longfile="gnu" >
785             <tarfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}">
786                 <include name="**"/>
787             </tarfileset>
788         </tar>
790         <chksum dir="${target.dir}" file="${deploy.src.tar}" />
791         <chksum dir="${target.dir}" file="${deploy.src.tar}" type="sha" />
793     </target>
795     <target name="bundle_src_zip" depends="init" unless="is.unix">
796         <zip destfile="${target.dir}/${deploy.src.zip}">
797             <zipfileset dir="${target.dir}/src" prefix="apache-harmony-src-r${harmony.version}">
798                 <include name="**"/>
799             </zipfileset>
800         </zip>
801         <chksum dir="${target.dir}" file="${deploy.src.zip}" />
802         <chksum dir="${target.dir}" file="${deploy.src.zip}" type="sha" />
803     </target>
805     <target name="copy_source" depends="init,populate_source">
806         <exec executable="svn">
807             <arg value="export" />
808             <arg value="." />
809             <arg value="${target.dir}/src" />
810         </exec>
811         <exec executable="svn">
812             <arg value="export" />
813             <arg value="working_classlib/modules/concurrent/standard" />
814             <arg value="${target.dir}/src/working_classlib/modules/concurrent/standard" />
815         </exec>
816         <echo file="${target.dir}/src/release.properties">
817 harmony.version=${harmony.version}
818 harmony.long.version=${harmony.long.version}
819 harmony.deploy.suffix=${harmony.deploy.suffix}
820         </echo>
821     </target>
823     <!-- ================================================================================ -->
824     <!-- produces a nicer looking checksum - taken from classlib/build.xml                -->
825     <!-- ================================================================================ -->
826     <macrodef name="chksum">
827         <attribute name="dir" />
828         <attribute name="file" />
829         <attribute name="type" default="md5" />
830         <sequential>
831             <checksum property="@{file}.@{type}"
832                       file="@{dir}/@{file}"
833                       algorithm="@{type}" />
834             <echo file="@{dir}/@{file}.@{type}"
835                   message="${@{file}.@{type}}  @{file}${line.separator}" />
836         </sequential>
837     </macrodef>
839 </project>