1 <project name="xwt" default="run" basedir=".">
3 <!-- required so that libgcj.jar doesn't interfere with non-gcj compilation -->
4 <property name="build.sysclasspath" value="first"/>
6 <property name="gcc-path" value="/usr/local/gcc"/>
7 <property name="build.compiler" value="jikes"/>
8 <property environment="env"/>
10 <!-- the hostname of a cygwin machine running sshd; used for .cab-signing and running Win32 binaries -->
11 <property name="cygwin-host" value="vmware"/>
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"/>
16 <!-- set up our classpath -->
18 <pathelement path="${envCLASSPATH}"/>
19 <pathelement path="bin/"/>
20 <fileset dir="www/webapps/lib">
21 <include name="**/*.jar"/>
24 <include name="**/*.jar"/>
28 <!-- purges binaries we've built -->
31 find . -name \*\~ | xargs rm -f
32 find . -name \#\*\# | xargs rm -f
33 rm -rf bin-* bin xwt/html/dist/
37 <!-- creates javadoc documentation -->
38 <target name="genjavadoc" unless="javadoc_ok">
39 <javadoc sourcepath="src" destdir="www/html/javadoc/" package="yes" protected="no" packagenames="org.xwt.*"/>
42 <!-- creates javasrc documentation -->
43 <target name="genjavasrc" unless="javasrc_ok">
44 <java classname="javasrc.app.JavaSrc" fork="yes">
45 <classpath refid="classpath"/>
46 <jvmarg value="-Doutdir=www/html/javasrc/"/>
47 <arg value="src/org/xwt/"/>
51 <!-- compiles all .java files into .class files; all other tasks predepend on this since they need the <taskdef/>'s -->
52 <target name="compile">
54 <echo message="compiling .java -> .class"/>
55 <javac destdir="bin/" deprecation="no">
57 <include name="**/*.java"/>
59 <!-- don't EVER include the following line anywhere else; it causes really bizarre errors -->
60 <pathelement location="${gcc-path}/share/libgcj.jar"/>
61 <path refid="classpath"/>
64 <taskdef name="bash" classname="org.xwt.tasks.BashTask">
65 <classpath path="bin/"/>
69 <target name="build" depends="compile">
70 <mkdir dir="www/html/dist/"/>
71 <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="build"/>
74 <target name="dist" depends="compile,build">
76 <mkdir dir="www/html/dist/"/>
78 <zip update="true" zipfile="www/html/demo.xwar" basedir="src" includes="org/xwt/demo/**,xwt/standard/**,org/xwt/themes/**"/>
79 <zip update="true" zipfile="www/html/demo.xwar" basedir="src/org/xwt/demo/" includes="main.xwt"/>
81 <zip update="true" zipfile="www/html/chess.xwar" basedir="src" includes="org/xwt/chess/**,xwt/standard/**,org/xwt/themes/**"/>
82 <zip update="true" zipfile="www/html/chess.xwar" basedir="src/org/xwt/chess/" includes="main.xwt"/>
84 <zip update="true" zipfile="www/html/mail.xwar" basedir="src"
85 includes="org/xwt/mail/**,xwt/standard/**,org/xwt/themes/**,org/gimp/tigert/**,org/xwt/fonts/**"
86 excludes="org/xwt/mail/main.xwt"
88 <zip update="true" zipfile="www/html/mail.xwar" basedir="src/org/xwt/mail/" includes="main.xwt"/>
90 <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="dist"/>
94 <target name="run" depends="compile,build">
95 <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="run"/>
98 <!-- rebuild the www/ area -->
99 <target name="www" depends="compile">
100 <mkdir dir="www/html/javadoc/"/>
101 <mkdir dir="www/html/javasrc/"/>
102 <uptodate property="javadoc_ok" targetfile="www/html/javadoc/index.html">
103 <srcfiles dir= "src/" includes="**/*.java"/>
105 <uptodate property="javasrc_ok" targetfile="www/html/javasrc/index.html">
106 <srcfiles dir= "src/" includes="**/*.java"/>
108 <antcall target="genjavadoc"/>
109 <antcall target="genjavasrc"/>
111 # throw on the prefix/suffix where needed
112 for A in `find www/html -name \*.html_`
113 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`
118 <target name="compile-server">
119 <mkdir dir="www/webapps/classes/"/>
120 <mkdir dir="www/webapps/lib/"/>
121 <javac destdir="www/webapps/classes/" deprecation="no">
122 <src path="www/src/"/>
123 <classpath refid="classpath"/>
127 <target name="staging">
128 <property name="staging-flag" value="-Dstaging"/>
129 <property name="host" value="xwt-staging.org"/>
130 <antcall target="really-push"/>
133 <target name="production">
134 <property name="staging-flag" value=""/>
135 <property name="host" value="xwt.org"/>
136 <antcall target="really-push"/>
139 <!-- required packages: bind, apache, libapache-mod-ssl, libapache-mod-jk, sshd, rsync, j2sdk, tomcat, gnuchess -->
140 <target name="really-push" depends="compile,www">
142 <copy todir="www/webapps/classes/">
143 <fileset dir="bin/" includes="org/xwt/server/**"/>
146 <bash host="root@${host}">
147 # first, clone the currently running copy of xwt, so we can use rsync to save bandwidth
152 tar cf - . | tar xf - -C /xwt-new
156 # tidy up and rsync our changes
157 find www/html -name \*~ | xargs rm -f
158 rsync -Pv --delete -rze ssh www/ root@${host}:/xwt-new/www/
161 <bash host="root@${host}">
163 /sbin/start-stop-daemon --stop --pidfile /var/log/xwt/apache.pid --exec /usr/sbin/apache
164 /sbin/start-stop-daemon --stop --pidfile /var/log/xwt/tomcat.pid --user www-data
170 mkdir /var/log/xwt &>/dev/null
171 chown www-data /var/log/xwt/
173 ln -s /xwt/www/webapps /xwt/www/webapps/ROOT
174 ln -s /xwt/www/webapps /xwt/www/webapps/WEB-INF
175 ln -s /xwt/www/launch /xwt/www/launch/ROOT
176 ln -s /xwt/www/launch /xwt/www/launch/WEB-INF
178 export JAVA_HOME=/usr/lib/j2sdk1.3
179 export CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tools.jar:/usr/share/tomcat/classes:/usr/share/tomcat/lib/tomcat.jar
181 touch /var/log/xwt/tomcat.log
182 chown www-data /var/log/xwt/tomcat.log
184 test ${host} == "xwt-staging.org" && echo -e "User-agent: *\nDisallow: /\n" > /xwt/www/html/robots.txt
186 /sbin/start-stop-daemon \
187 --start --pidfile /var/log/xwt/tomcat.pid --make-pidfile --chuid www-data --exec \
188 /usr/lib/j2sdk1.3/bin/java -- -server -Dtomcat.home=/usr/share/tomcat -Xmx500M \
189 org.apache.tomcat.startup.Main -config /xwt/www/etc/server.xml start \
190 >> /var/log/xwt/tomcat.log 2>&1 &
192 /sbin/start-stop-daemon --start --pidfile /var/log/xwt/apache.pid --exec /usr/sbin/apache -- -f /xwt/www/etc/httpd.conf ${staging-flag}
201 <!-- old javago optimization code - - reintegrate at some point
202 lib/javago.`uname` -threshold 300 -not-inline-constructor -not-use-invokespecial org/xwt/Box.class
203 lib/javago.`uname` -threshold 300 -not-inline-constructor -not-use-invokespecial org/xwt/Box.class
204 lib/javago.`uname` -threshold 200 -not-inline-constructor -not-use-invokespecial org/xwt/Surface.class
205 lib/javago.`uname` -threshold 50 -not-inline-constructor -not-use-invokespecial org/xwt/GetPutHandler*
206 lib/javago.`uname` -threshold 200 -not-inline-constructor -not-use-invokespecial org/xwt/util/DirtyList.class