2002/03/21 01:19:26
[org.ibex.core.git] / build.xml
1 <project name="xwt" default="run" basedir=".">
2
3     <!-- required so that libgcj.jar doesn't interfere with non-gcj compilation -->
4     <property name="build.sysclasspath" value="first"/>
5
6     <property name="gcc-path" value="/usr/local/gcc"/>
7     <property name="build.compiler" value="jikes"/>
8     <property environment="env"/>
9
10     <!-- the hostname of a cygwin machine running sshd; used for .cab-signing and running Win32 binaries -->
11     <property name="cygwin-host" value="vmware"/>
12
13     <!-- a path on ${cygwin-host} which maps to the root of this XWT tree; usually exported from the build machine using samba -->
14     <property name="cygwin-path" value="z:/xwt"/>
15
16     <!-- set up our classpath -->
17     <path id="classpath">
18         <pathelement path="${envCLASSPATH}"/>
19         <pathelement path="bin/"/>
20         <fileset dir="lib">
21             <include name="**/*.jar"/>
22         </fileset>
23     </path>
24
25     <!-- purges binaries we've built -->
26     <target name="clean">
27         <bash>
28             find . -name \*\~ | xargs rm -f
29             find . -name \#\*\# | xargs rm -f
30             rm -rf bin-* bin xwt/html/dist/
31         </bash>
32     </target>
33
34     <!-- creates javadoc documentation -->
35     <target name="genjavadoc" unless="javadoc_ok">
36        <javadoc sourcepath="src" destdir="www/html/javadoc/" package="yes" protected="no" packagenames="org.xwt.*"/>
37     </target>
38
39     <!-- creates javasrc documentation -->
40     <target name="genjavasrc" unless="javasrc_ok">
41        <java classname="javasrc.app.JavaSrc" fork="yes">
42            <classpath refid="classpath"/>
43            <jvmarg value="-Doutdir=www/html/javasrc/"/>
44            <arg value="src/org/xwt/"/>
45        </java>
46     </target>
47
48     <!-- compiles all .java files into .class files; all other tasks predepend on this since they need the <taskdef/>'s -->
49     <target name="compile">
50         <mkdir dir="bin/"/>
51         <echo message="compiling  .java -> .class"/>
52         <javac destdir="bin/" deprecation="no">
53             <src path="src/"/>
54             <include name="**/*.java"/>
55             <classpath>
56                 <!-- don't EVER include the following line anywhere else; it causes really bizarre errors -->
57                 <pathelement location="${gcc-path}/share/libgcj.jar"/>
58                 <path refid="classpath"/>
59             </classpath>
60         </javac>
61         <taskdef name="bash" classname="org.xwt.tasks.BashTask">
62             <classpath path="bin/"/>
63         </taskdef>
64     </target>
65
66     <target name="build" depends="compile">
67         <mkdir dir="www/html/dist/"/>
68         <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="build"/>
69     </target>
70
71     <target name="dist" depends="compile,build">
72
73         <mkdir dir="www/html/dist/"/>
74
75         <zip update="true" zipfile="www/html/demo.xwar" basedir="src"
76              includes="org/xwt/demo/**,xwt/standard/**,org/xwt/themes/**"/>
77         <zip update="true" zipfile="www/html/demo.xwar" basedir="src/org/xwt/demo/" includes="main.xwt"/>
78
79         <zip update="true" zipfile="www/html/chess.xwar" basedir=src"
80              includes="org/xwt/chess/**,xwt/standard/**,org/xwt/themes/**"/>
81         <zip update="true" zipfile="www/html/chess.xwar" basedir="src/org/xwt/chess/" includes="main.xwt"/>
82
83         <zip update="true" zipfile="www/html/mail.xwar" basedir="src"
84              includes="org/xwt/mail/**,xwt/standard/**,org/xwt/themes/**,org/gimp/tigert/**,org/xwt/fonts/**"/>
85         <zip update="true" zipfile="www/html/mail.xwar" basedir="src/org/xwt/mail/" includes="main.xwt"/>
86
87         <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="dist"/>
88
89     </target>
90
91     <target name="run" depends="compile,build">
92         <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="run"/>
93     </target>
94
95     <!-- rebuild the www/ area -->
96     <target name="www" depends="compile">
97         <mkdir dir="www/html/javadoc/"/>
98         <mkdir dir="www/html/javasrc/"/>
99         <uptodate property="javadoc_ok" targetfile="www/html/javadoc/index.html">
100             <srcfiles dir= "src/" includes="**/*.java"/>
101         </uptodate>
102         <uptodate property="javasrc_ok" targetfile="www/html/javasrc/index.html">
103             <srcfiles dir= "src/" includes="**/*.java"/>
104         </uptodate>
105         <antcall target="genjavadoc"/>
106         <antcall target="genjavasrc"/>
107         <bash>
108             # throw on the prefix/suffix where needed
109             for A in `find www/html -name \*.html_`
110             do (cat www/html/prefix.html; cat $A; cat www/html/suffix.html; cat "$A"_ 2>/dev/null; cat www/html/tagline.html) > `echo $A | sed s/_\$//g`
111             done
112         </bash>
113     </target>
114
115     <target name="compile-server">
116         <mkdir dir="www/webapps/classes/"/>
117         <mkdir dir="www/webapps/lib/"/>
118         <javac destdir="www/webapps/classes/" deprecation="no">
119             <src path="www/src/"/>
120             <classpath refid="classpath"/>
121         </javac>
122     </target>
123
124     <target name="push" depends="compile,compile-server">
125         <bash>
126
127             find www/html -name \*~ | xargs rm -f
128
129             # this is still pretty ugly...
130             cp lib/j2ee-javax.jar lib/xmlrpc.jar lib/imap.jar lib/pop3.jar lib/mail.jar lib/mailapi.jar www/webapps/lib/
131
132             # throw on the prefix/suffix where needed
133             rm -f /tmp/delete-$$
134             for A in `find www/html -name \*.html_`
135             do (cat www/html/prefix.html; cat $A; cat www/html/suffix.html; cat "$A"_ 2>/dev/null; cat www/html/tagline.html) > `echo $A | sed s/_\$//g`
136                echo $A | sed s/_\$//g >> /tmp/delete-$$
137             done
138
139             # in theory, we should be able to slam a fully-functional
140             # copy of the xwt server onto any debian machine with the
141             # right packages preinstalled (roughly: bind, apache, libapache-mod-ssl
142             # apache-ssl, sshd, rsync, j2sdk, tomcat)
143
144             # first, clone the currently running copy of xwt, so we can use rsync to save bandwidth
145             ssh root@xwt.org "rm -rf /xwt-new; mkdir -p /xwt; mkdir -p /xwt-new; cd /xwt; tar cf - . | tar xf - -C /xwt-new"
146
147             # now, rsync to process our changes
148             rsync -Pv --delete -rze ssh www/ root@xwt.org:/xwt-new/www/
149
150             # clean up generated html
151             cat /tmp/delete-$$ | xargs rm
152             rm -f /tmp/delete-$$
153             
154             # stop services, clean up, transfer control, and restart services
155             ssh root@xwt.org "chmod +x /xwt-new/www/bounce.sh; /xwt-new/www/bounce.sh"
156         </bash>
157     </target>
158
159 </project>
160
161
162        <!-- old javago optimization code - - reintegrate at some point
163           lib/javago.`uname` -threshold 300 -not-inline-constructor -not-use-invokespecial org/xwt/Box.class
164           lib/javago.`uname` -threshold 300 -not-inline-constructor -not-use-invokespecial org/xwt/Box.class
165           lib/javago.`uname` -threshold 200 -not-inline-constructor -not-use-invokespecial org/xwt/Surface.class
166           lib/javago.`uname` -threshold 50 -not-inline-constructor -not-use-invokespecial org/xwt/GetPutHandler*
167           lib/javago.`uname` -threshold 200 -not-inline-constructor -not-use-invokespecial org/xwt/util/DirtyList.class
168        -->