- <target name="dist" depends="compile,build">
-
- <mkdir dir="www/html/dist/"/>
-
- <zip update="true" zipfile="www/html/demo.xwar" basedir="src" includes="org/xwt/demo/**,xwt/standard/**,org/xwt/themes/**"/>
- <zip update="true" zipfile="www/html/demo.xwar" basedir="src/org/xwt/demo/" includes="main.xwt"/>
-
- <zip update="true" zipfile="www/html/chess.xwar" basedir="src" includes="org/xwt/chess/**,xwt/standard/**,org/xwt/themes/**"/>
- <zip update="true" zipfile="www/html/chess.xwar" basedir="src/org/xwt/chess/" includes="main.xwt"/>
-
- <zip update="true" zipfile="www/html/mail.xwar" basedir="src"
- includes="org/xwt/mail/**,xwt/standard/**,org/xwt/themes/**,org/gimp/tigert/**,org/xwt/fonts/**"
- excludes="org/xwt/mail/main.xwt"
- />
- <zip update="true" zipfile="www/html/mail.xwar" basedir="src/org/xwt/mail/" includes="main.xwt"/>
-
- <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="dist"/>
-
- </target>
-
- <target name="run" depends="compile,build">
- <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="run"/>
- </target>
-
- <!-- rebuild the www/ area -->
- <target name="www" depends="compile">
- <mkdir dir="www/html/javadoc/"/>
- <mkdir dir="www/html/javasrc/"/>
- <uptodate property="javadoc_ok" targetfile="www/html/javadoc/index.html">
- <srcfiles dir= "src/" includes="**/*.java"/>
- </uptodate>
- <uptodate property="javasrc_ok" targetfile="www/html/javasrc/index.html">
- <srcfiles dir= "src/" includes="**/*.java"/>
- </uptodate>
- <antcall target="genjavadoc"/>
- <antcall target="genjavasrc"/>
- <bash>
- # throw on the prefix/suffix where needed
- for A in `find www/html -name \*.html_`
- 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`
- done
- </bash>
- </target>
-
- <target name="compile-server">
- <mkdir dir="www/webapps/classes/"/>
- <mkdir dir="www/webapps/lib/"/>
- <javac destdir="www/webapps/classes/" deprecation="no">
- <src path="www/src/"/>
- <classpath refid="classpath"/>
- </javac>
- </target>
-
- <target name="staging">
- <property name="staging-flag" value="-Dstaging"/>
- <property name="host" value="xwt-staging.org"/>
- <antcall target="really-push"/>
- </target>
-
- <target name="production">
- <property name="staging-flag" value=""/>
- <property name="host" value="xwt.org"/>
- <antcall target="really-push"/>
- </target>
-
- <!-- required packages: bind, apache, libapache-mod-ssl, libapache-mod-jk, sshd, rsync, j2sdk, tomcat, gnuchess -->
- <target name="really-push" depends="compile,www">
-
- <copy todir="www/webapps/classes/">
- <fileset dir="bin/" includes="org/xwt/server/**"/>
- </copy>
-
- <bash host="root@${host}">
- # first, clone the currently running copy of xwt, so we can use rsync to save bandwidth
- rm -rf /xwt-new
- mkdir -p /xwt
- mkdir -p /xwt-new
- cd /xwt
- tar cf - . | tar xf - -C /xwt-new
- </bash>
-
- <bash>
- # tidy up and rsync our changes
- find www/html -name \*~ | xargs rm -f
- rsync -Pv --delete -rze ssh www/ root@${host}:/xwt-new/www/
- </bash>
-
- <bash host="root@${host}">
- # stop services
- /sbin/start-stop-daemon --stop --pidfile /var/log/xwt/apache.pid --exec /usr/sbin/apache
- /sbin/start-stop-daemon --stop --pidfile /var/log/xwt/tomcat.pid --user www-data
-
- rm -rf /xwt-old
- mv /xwt /xwt-old
- mv /xwt-new /xwt
-
- mkdir /var/log/xwt &>/dev/null
- chown www-data /var/log/xwt/
-
- ln -s /xwt/www/webapps /xwt/www/webapps/ROOT
- ln -s /xwt/www/webapps /xwt/www/webapps/WEB-INF
- ln -s /xwt/www/launch /xwt/www/launch/ROOT
- ln -s /xwt/www/launch /xwt/www/launch/WEB-INF
-
- export JAVA_HOME=/usr/lib/j2sdk1.3
- export CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tools.jar:/usr/share/tomcat/classes:/usr/share/tomcat/lib/tomcat.jar
-
- touch /var/log/xwt/tomcat.log
- chown www-data /var/log/xwt/tomcat.log
-
- test ${host} == "xwt-staging.org" && echo -e "User-agent: *\nDisallow: /\n" > /xwt/www/html/robots.txt
-
- /sbin/start-stop-daemon \
- --start --pidfile /var/log/xwt/tomcat.pid --make-pidfile --chuid www-data --exec \
- /usr/lib/j2sdk1.3/bin/java -- -server -Dtomcat.home=/usr/share/tomcat -Xmx500M \
- org.apache.tomcat.startup.Main -config /xwt/www/etc/server.xml start \
- >> /var/log/xwt/tomcat.log 2>&1 &
-
- /sbin/start-stop-daemon --start --pidfile /var/log/xwt/apache.pid --exec /usr/sbin/apache -- -f /xwt/www/etc/httpd.conf ${staging-flag}
- </bash>
-
- </target>
-
-