2002/06/05 20:05:52
[org.ibex.core.git] / build.xml
index 30e9c91..98fac38 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -7,7 +7,7 @@
     <property name="build.compiler" value="jikes"/>
     <property environment="env"/>
 
-    <!-- the hostname of a cygwin machine running sshd; used for .cab-signing and running Win32 binaries -->
+    <!-- the hostname of a cygwin machine running sshd; used for running Win32 binaries -->
     <property name="cygwin-host" value="vmware"/>
 
     <!-- a path on ${cygwin-host} which maps to the root of this XWT tree; usually exported from the build machine using samba -->
@@ -17,6 +17,9 @@
     <path id="classpath">
         <pathelement path="${envCLASSPATH}"/>
         <pathelement path="bin/"/>
+        <fileset dir="www/webapps/lib">
+            <include name="**/*.jar"/>
+        </fileset>
         <fileset dir="lib">
             <include name="**/*.jar"/>
         </fileset>
         <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="build"/>
     </target>
 
-    <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/**"/>
-        <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">
+    <target name="staging">
+        <property name="staging-flag" value="-Dstaging"/>
+        <property name="host" value="xwt-staging.org"/>
+        <antcall target="really-push"/>
+    </target>
+
+    <target name="production">
         <mkdir dir="www/html/javadoc/"/>
         <mkdir dir="www/html/javasrc/"/>
         <uptodate property="javadoc_ok" targetfile="www/html/javadoc/index.html">
         </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>
+        <property name="staging-flag" value=""/>
+<!--
+        <property name="host" value="gosset.megacz.com"/>
+-->
+        <property name="host" value="xwt.org"/>
+        <antcall target="really-push"/>
     </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 name="newbuild" depends="compile">
+        <taskdef name="build-id" classname="org.xwt.tasks.BuildIdTask">
+            <classpath path="bin/"/>
+        </taskdef>
+        <build-id/>
+        <bash> cvs commit -m "automatically updated build-id via org.xwt.tasks.BuildIdTask" build.properties </bash>
+        <property file="build.properties"/>
+        
+        <mkdir dir="www/html/dist/"/>
+
+        <!-- rebuild distributions -->
+        <property name="plat" value="Win32"/>
+        <ant dir="." antfile="src/org/xwt/plat/Win32.xml" target="build"/>
+        <ant dir="." antfile="src/org/xwt/plat/Win32.xml" target="dist"/>
+        <property name="plat" value="Java2"/>
+        <ant dir="." antfile="src/org/xwt/plat/Java12.xml" target="build"/>
+        <ant dir="." antfile="src/org/xwt/plat/Java12.xml" target="dist"/>
+<!--
+        <property name="plat" value="Linux"/>
+        <ant dir="." antfile="src/org/xwt/plat/Linux.xml" target="build"/>
+        <ant dir="." antfile="src/org/xwt/plat/Linux.xml" target="dist"/>
+-->
+        <!-- sign stuff -->
+        <bash> /home/megacz/bin/sign/sign ${build-id} </bash>
     </target>
 
-    <target name="push" depends="compile,compile-server">
-        <bash>
+    <!-- required packages: bind, apache, libapache-mod-ssl, libapache-mod-jk, sshd, rsync, j2sdk, tomcat, gnuchess -->
+    <target name="really-push" depends="compile">
 
-            find www/html -name \*~ | xargs rm -f
+        <!-- update demo xwars -->
+        <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"/>
+        <zip update="true" zipfile="www/html/k5.xwar" basedir="src" includes="xwt/**,org/xwt/themes/**,org/gimp/**,org/xwt/x5t/**"/>
+        <zip update="true" zipfile="www/html/k5.xwar" basedir="src/org/xwt/x5t/" includes="main.xwt"/>
 
-            # this is still pretty ugly...
-            cp lib/j2ee-javax.jar lib/xmlrpc.jar lib/imap.jar lib/pop3.jar lib/mail.jar lib/mailapi.jar www/webapps/lib/
+        <mkdir dir="www/webapps/classes/"/>
+        <copy todir="www/webapps/classes/">
+            <fileset dir="bin/" includes="org/xwt/server/**"/>
+        </copy>
 
+        <bash>
             # throw on the prefix/suffix where needed
-            rm -f /tmp/delete-$$
             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`
-               echo $A | sed s/_\$//g >> /tmp/delete-$$
             done
+        </bash>
 
-            # in theory, we should be able to slam a fully-functional
-            # copy of the xwt server onto any debian machine with the
-            # right packages preinstalled (roughly: bind, apache, libapache-mod-ssl
-            # apache-ssl, sshd, rsync, j2sdk, tomcat)
-
+        <bash host="root@${host}">
             # first, clone the currently running copy of xwt, so we can use rsync to save bandwidth
-            ssh root@xwt.org "rm -rf /xwt-new; mkdir -p /xwt; mkdir -p /xwt-new; cd /xwt; tar cf - . | tar xf - -C /xwt-new"
+            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
+            rm www/html/tmp.[0-9]
+            rsync -Pv --delete --exclude=html/dist/\* -rze ssh www/ root@${host}:/xwt-new/www/
+            rsync -u -Pv -rze ssh www/html/dist/ root@${host}:/xwt-new/www/html/dist/
+        </bash>
 
-            # now, rsync to process our changes
-            rsync -Pv --delete -rze ssh www/ root@xwt.org:/xwt-new/www/
+        <bash host="root@${host}">
 
-            # clean up generated html
-            cat /tmp/delete-$$ | xargs rm
-            rm -f /tmp/delete-$$
+            # stop services
+            /etc/init.d/xwt-cluster stop
+
+            rm -rf /xwt-`date +%d-%b-%H:%M`
+            mv /xwt /xwt-`date +%d-%b-%H:%M`
+            mv /xwt-new /xwt
+            find /xwt-* -prune -type d -mtime +10 | xargs rm -rf
+
+            mkdir /var/log/xwt &amp;>/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
+            ln -s /xwt/www/wiki    /xwt/www/wiki/ROOT
+            ln -s /xwt/www/wiki    /xwt/www/wiki/WEB-INF
             
-            # stop services, clean up, transfer control, and restart services
-            ssh root@xwt.org "chmod +x /xwt-new/www/bounce.sh; /xwt-new/www/bounce.sh"
+            test ${host} == "xwt-staging.org" &amp;&amp; echo -e "User-agent: *\nDisallow: /\n" > /xwt/www/html/robots.txt
+            echo ${staging-flag} > /xwt/staging-flag
+
+            /etc/init.d/xwt-cluster start
+
         </bash>
     </target>
 
+
 </project>