]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added build.xml
authorJani Laakso <jani.laakso@itmill.com>
Tue, 16 Oct 2007 07:35:08 +0000 (07:35 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Tue, 16 Oct 2007 07:35:08 +0000 (07:35 +0000)
svn changeset:2519/svn branch:trunk

build/build.xml [new file with mode: 0644]

diff --git a/build/build.xml b/build/build.xml
new file mode 100644 (file)
index 0000000..8b8a285
--- /dev/null
@@ -0,0 +1,414 @@
+<?xml version="1.0"?>
+
+<project name="IT Mill Toolkit" basedir="../" default="package">
+
+       <!-- Package creation - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+       <target name="package" depends="clean-all, root, demo, docs" description="Build public release">
+               <zip zipfile="build/result/${package-file-name}">
+                       <fileset dir="build/result">
+                               <patternset>
+                                       <include name="${product-file}-${version}/**" />
+                               </patternset>
+                       </fileset>
+               </zip>
+       </target>
+
+       <!-- Initialization - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+       <target name="init">
+
+               <!-- Create result dir unless already exists -->
+               <mkdir dir="build/result" />
+
+               <property file="build/VERSION" />
+               <property name="product-file" value="itmill-toolkit" />
+               <property name="product-name" value="IT Mill Toolkit" />
+               <property name="toolkit-package" value="com/itmill/toolkit" />
+
+               <property file="build/html-style.properties" />
+               
+               <!-- Destination files -->
+               <property name="package-file-name" value="${product-file}-${version}.zip" />
+               <property name="lib-bin-jar-name" value="${product-file}-${version}.jar" />
+               <property name="lib-dev-jar-name" value="${product-file}-dev-${version}.jar" />
+               <property name="demo-lib-jar-name" value="${product-file}-demo-${version}.jar" />
+               <property name="lib-src-jar-name" value="${product-file}-src-${version}.jar" />
+               <property name="demo-war-name" value="${product-file}-demo-${version}.war" />
+
+               <echo message="Prepared to build ${product-file} version ${version} packages" />
+
+               <!-- Output directory -->
+               <property name="output-dir" value="build/result/${product-file}-${version}" />
+               <mkdir dir="${output-dir}" />
+
+               <!-- Create Output Directory Hierarchy -->
+               <mkdir dir="${output-dir}/doc/manual" />
+               <mkdir dir="${output-dir}/doc/api" />
+               <mkdir dir="${output-dir}/lib" />
+               <mkdir dir="${output-dir}/demo" />
+               <mkdir dir="${output-dir}/WebContent" />
+               <mkdir dir="${output-dir}/WebContent/WEB-INF" />
+               <mkdir dir="${output-dir}/WebContent/WEB-INF/classes" />
+               <mkdir dir="${output-dir}/WebServer" />
+               <mkdir dir="${output-dir}/WebServer/classes" />
+               
+       </target>
+       
+       
+       
+       
+               <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+  Add and filter root files
+   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+       <target name="root" depends="init">
+               <!-- TODO: add license directory and files -->
+               <copy todir="${output-dir}">
+                       <filterchain>
+                               <expandproperties />
+                               <replacetokens begintoken="&lt;" endtoken=">">
+                                       <token key="version" value="${version}" />
+                                       <token key="/version" value="" />
+                               </replacetokens>
+                       </filterchain>
+                       <fileset dir="">
+                               <filename name="release-notes.html" />
+                       </fileset>
+               </copy>
+               <copy todir="${output-dir}">
+                       <filterchain>
+                               <expandproperties />
+                               <replacetokens begintoken="&lt;" endtoken=">">
+                                       <token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
+                                       <token key="/body" value="${html.body.end}${html.body.endtag}" />
+                                       <token key="version" value="${version}" />
+                                       <token key="/version" value="" />
+                               </replacetokens>
+                       </filterchain>
+                       <fileset dir="">
+                               <exclude name="**/.svn" />
+                               <exclude name="release-notes.html" />
+                               <include name="*.html" />
+                               <include name="*.txt" />
+                               <include name="*.bat" />
+                               <include name="*.sh" />
+                       </fileset>
+               </copy>
+               <chmod file="${output-dir}/start-demo.sh" perm="ugo+x" />
+       </target>
+
+
+       <!-- Copy and preprocess sources for packaging 
+       NOTE: Replaces <version></version> tags with build version tag for some "textual" files
+       -->
+       <target name="preprocess-src" depends="init">
+               <mkdir dir="build/result/src" />
+               <echo>Copying src directory and processing copied files.</echo>
+               <echo>Replacing &lt;version&gt; tag with build version for java/html/css/xml files.</echo>
+               <copy todir="build/result/src">
+                       <filterset>
+                               <filter token="VERSION" value="${version}" />
+                       </filterset>
+                       <fileset dir="src">
+                               <patternset>
+                                       <include name="**/*.java" />
+                                       <include name="**/*.html" />
+                                       <include name="**/*.css" />
+                                       <include name="**/*.xml" />
+                               </patternset>
+                       </fileset>
+               </copy>
+
+               <!-- Unify mix usage of OSX/Linux/Win characters -->
+               <echo>Unifying mix usage of OSX/Linux/Win linefeeds for java/html/css/xml files.</echo>
+               <fixcrlf srcdir="build/result/src" eol="crlf" tablength="4" tab="asis" includes="**/*.java **/*.html **/*.css **/*.xml" />
+
+               <!-- Add other files such as images, these are not filtered or processed by fixcrlf task -->
+               <echo>Copying non java/html/css/xml files such as images.</echo>
+               <copy todir="build/result/src">
+                       <fileset dir="src">
+                               <patternset>
+                                       <exclude name="**/.svn" />
+                                       <exclude name="**/*.java" />
+                                       <exclude name="**/*.html" />
+                                       <exclude name="**/*.css" />
+                                       <exclude name="**/*.xml" />
+                               </patternset>
+                       </fileset>
+               </copy>
+               
+               <echo>Creating demo source html files</echo>
+               <java2html srcdir="build/result/src/${toolkit-package}/demo" destdir="build/result/src/${toolkit-package}/demo" includes="**/*.java" style="eclipse" showLineNumbers="false" showFileName="true" showTableBorder="false" />
+               
+       </target>
+       
+       <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+  WebContent
+   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+       <target name="webcontent" depends="preprocess-src">
+               <!-- 
+    Copy Eclipse workspace related hidden files (.classpath, .project)
+    Allows project import from Eclipse
+     -->
+       <echo>Adding Eclipse workspace files, replacing &lt;version&gt; tag with build version</echo>
+               <copy todir="${output-dir}">
+                       <filterchain>
+                               <expandproperties />
+                               <replacetokens begintoken="&lt;" endtoken=">">
+                                       <token key="version" value="${version}" />
+                                       <token key="/version" value="" />
+                               </replacetokens>
+                       </filterchain>
+                       <fileset dir="build/workspace-eclipse">
+                               <exclude name="**/.svn" />
+                       </fileset>
+               </copy>
+
+               <!-- Add WebServer -->
+               <echo>Adding WebServer</echo>
+               <copy todir="${output-dir}/WebServer">
+                       <fileset dir="WebServer">
+                               <exclude name="**/.svn" />
+                       </fileset>
+               </copy>
+               
+               <!-- Add demo sources -->
+               <echo>Adding demo sources to WebContent/src</echo>
+               <copy todir="${output-dir}/WebContent/src">
+                       <fileset dir="build/result/src">
+                               <include name="${toolkit-package}/demo/**/*" />
+                       </fileset>
+               </copy>
+               
+
+               <!-- Compile WebServer classes -->
+               <echo>Compiling WebServer</echo>
+               <javac source="1.4" target="1.4" srcdir="WebServer/src" destdir="${output-dir}/WebServer/classes" classpath="WebServer/winstone-0.9.9.jar" debug="true" />
+
+               <!-- Add WebContent -->
+               <echo>Adding WebContent files, excluding ITMILL/widgetsets and few internal development libraries.</echo>
+               <copy todir="${output-dir}/WebContent">
+                       <fileset dir="WebContent">
+                               <exclude name="**/.svn" />
+                               <exclude name="openajax/**" />
+                               <exclude name="ITMILL/widgetsets" />
+                               <exclude name="WEB-INF/classes/**" />
+                               <exclude name="WEB-INF/lib/commons-fileupload-1.2-javadoc.jar" />
+                               <exclude name="WEB-INF/lib/commons-fileupload-1.2-sources.jar" />
+                               <exclude name="WEB-INF/lib/jakarta/**" />
+                       </fileset>
+               </copy>
+
+       </target>
+
+       <target name="compile-java" depends="webcontent">
+               <echo>Compiling src (server-side)</echo>
+               <!-- Compile -->
+               <mkdir dir="build/result/classes" />
+               <javac 
+               source="1.4" 
+               target="1.4" 
+               srcdir="build/result/src" 
+               destdir="build/result/classes" 
+               includes="${toolkit-package}/**" 
+               debug="true">
+                 <classpath>
+                       <pathelement path="build/gwt/gwt/gwt-user.jar" />
+                       <pathelement path="WebContent/WEB-INF/lib/commons-fileupload-1.2.jar" />
+                       <pathelement path="lib/reservr/googlemaps_gwt.jar" />
+                 </classpath>
+               </javac>
+       </target>
+
+       <target name="libs" depends="compile-java">
+               <echo>Creating libs (server-side)</echo>
+               <copy todir="${output-dir}/lib/demo">
+                       <fileset dir="lib">
+                               <include name="reservr/**/*" />
+                       </fileset>
+               </copy>
+               <!-- Create Toolkit deployment / server-side only development JAR -->
+               <jar 
+               jarfile="${output-dir}/lib/${lib-bin-jar-name}" 
+               compress="true">
+               <fileset dir="build/result/classes">
+                               <patternset>
+                                       <exclude name="${toolkit-package}/demo/**" />
+                                       <exclude name="${toolkit-package}/tests/**" />
+                               </patternset>
+                       </fileset>
+               </jar>
+               <!-- Create Toolkit source JAR -->
+               <jar jarfile="${output-dir}/lib/${lib-src-jar-name}" compress="true">
+                       <fileset dir="build/result/src">
+                               <patternset>
+                                       <exclude name="${toolkit-package}/demo/**" />
+                                       <exclude name="${toolkit-package}/tests/**" />
+                               </patternset>
+                       </fileset>
+               </jar>
+               <!-- Add GWT binaries, required on client-side development -->
+               <echo>Adding GWT binaries</echo> 
+               <copy todir="${output-dir}/gwt">
+                       <fileset dir="build/gwt/gwt">
+                               <patternset>
+                                       <include name="**/*" />
+                               </patternset>
+                       </fileset>
+               </copy>
+       </target>
+               
+       <target name="compile-client-side" depends="libs">
+         <echo>Compiling src (client-side)</echo>
+         <echo>com.itmill.toolkit.terminal.gwt.DefaultWidgetSet</echo>
+         <java classname="com.google.gwt.dev.GWTCompiler" failonerror="yes" fork="yes" maxmemory="512m">
+         <arg value="-out" />
+         <arg value="${output-dir}/WebContent/ITMILL/widgetsets" />
+         <arg value="com.itmill.toolkit.terminal.gwt.DefaultWidgetSet" />
+         <classpath>
+           <pathelement location="${output-dir}/gwt/gwt-user.jar" />
+           <pathelement location="${output-dir}/gwt/gwt-dev-mac.jar" />
+           <pathelement location="${output-dir}/lib/itmill-toolkit-src-5.0.0-alpha.jar"/>
+         </classpath>
+       </java>
+
+       <echo>com.itmill.toolkit.demo.reservation.gwt.WidgetSet</echo>
+                 <java classname="com.google.gwt.dev.GWTCompiler" failonerror="yes" fork="yes" maxmemory="512m">
+         <arg value="-out" />
+         <arg value="${output-dir}/WebContent/ITMILL/widgetsets" />
+         <arg value="com.itmill.toolkit.demo.reservation.gwt.WidgetSet" />
+         <classpath>
+           <pathelement location="${output-dir}/gwt/gwt-user.jar" />
+           <pathelement location="${output-dir}/gwt/gwt-dev-mac.jar" />
+           <pathelement location="${output-dir}/lib/itmill-toolkit-src-5.0.0-alpha.jar"/>
+           <!-- demo jars -->
+           <pathelement location="${output-dir}/lib/demo/reservr/googlemaps_gwt.jar" />
+           <!-- demo widgetset sources -->
+           <pathelement path="${output-dir}/WebContent/src" />
+         </classpath>
+       </java>
+       
+       <echo>com.itmill.toolkit.demo.colorpicker.gwt.WidgetSet</echo>
+                 <java classname="com.google.gwt.dev.GWTCompiler" failonerror="yes" fork="yes" maxmemory="512m">
+         <arg value="-out" />
+         <arg value="${output-dir}/WebContent/ITMILL/widgetsets" />
+         <arg value="com.itmill.toolkit.demo.colorpicker.gwt.WidgetSet" />
+         <classpath>
+           <pathelement location="${output-dir}/gwt/gwt-user.jar" />
+           <pathelement location="${output-dir}/gwt/gwt-dev-mac.jar" />
+           <pathelement location="${output-dir}/lib/itmill-toolkit-src-5.0.0-alpha.jar"/>
+           <!-- demo widgetset sources -->
+           <pathelement path="${output-dir}/WebContent/src" />
+         </classpath>
+       </java>
+       </target>
+       
+       <!-- Demo  - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+       <target name="demo" depends="root, libs, compile-java, compile-client-side, javadoc">
+               <echo>Building demo</echo>
+               <echo>Adding demo class files.</echo>
+               <copy todir="${output-dir}/WebContent/WEB-INF/classes">
+                       <fileset dir="build/result/classes">
+                               <include name="${toolkit-package}/demo/**/*" />
+                       </fileset>
+               </copy>
+               <echo>Adding (duplicating) Toolkit JAR to WebContent/WEB-INF/lib</echo>
+               <copy todir="${output-dir}/WebContent/WEB-INF/lib">
+                       <fileset dir="${output-dir}/lib">
+                               <include name="${lib-bin-jar-name}" />
+                       </fileset>
+               </copy>
+               
+               <echo>Building WAR</echo>
+               <war warfile="${output-dir}/lib/${product-file}.war" webxml="WebContent/WEB-INF/web.xml">
+                       <fileset dir="${output-dir}/WebContent">
+                               <exclude name="WEB-INF/web.xml" />
+                               <include name="**/*" />
+                       </fileset>
+                       <lib dir="${output-dir}/lib">
+                               <include name="${lib-bin-jar-name}" />
+                       </lib>
+                       <!-- All javadoc (demos link to these)-->
+                       <fileset dir="${output-dir}">
+                               <include name="doc/api/**/*" />
+                       </fileset>
+               </war>
+       </target>
+
+       <!-- Documentation- - - - - - - - - - - - - - - - - - - - - - - - - -->
+       <target name="docs" depends="javadoc,package-docs">
+       </target>
+
+       <target name="package-docs" depends="init">
+               <copy todir="${output-dir}">
+                       <filterchain>
+                               <expandproperties />
+                               <replacetokens begintoken="&lt;" endtoken=">">
+                                       <token key="body" value="${html.body.tag}${html.body.start1}${product-name}${html.body.start2}" />
+                                       <token key="/body" value="${html.body.end}${html.body.endtag}" />
+                               </replacetokens>
+                       </filterchain>
+                       <fileset dir="">
+                               <exclude name="**/.svn" />
+                               <exclude name="ReleaseNotes.html" />
+                               <include name="*.html" />
+                               <include name="*.txt" />
+                       </fileset>
+               </copy>
+               <copy todir="${output-dir}">
+                       <fileset dir="">
+                               <filename name="*.pdf" />
+                       </fileset>
+               </copy>
+               <copy todir="${output-dir}">
+                       <fileset dir="">
+                               <filename name="ReleaseNotes.html" />
+                       </fileset>
+               </copy>
+               <copy todir="${output-dir}/doc/manual/html-style">
+                       <fileset dir="doc/manual/html-style">
+                               <exclude name="**/.svn" />
+                               <exclude name="**/test.html" />
+                       </fileset>
+               </copy>
+               <copy todir="${output-dir}/doc">
+                       <fileset dir="doc">
+                               <exclude name="**/.svn" />
+                               <include name="dtd/**/*.dtd" />
+                       </fileset>
+               </copy>
+       </target>
+
+       <target name="javadoc" depends="preprocess-src">
+               <javadoc destdir="${output-dir}/doc/api" author="true" version="true" use="true" windowtitle="${product-name}" classpath="build/lib/servlet-api.jar">
+                       <packageset dir="build/result/src">
+                               <include name="${toolkit-package}/**" />
+                               <exclude name="${toolkit-package}/demo/**" />
+                       </packageset>
+                       <doctitle>${javadoc.doctitle}</doctitle>
+                       <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
+                       <bottom>${javadoc.bottom}</bottom>
+                       <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="build/javadoc/j2se-1.5.0" />
+                       <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
+               </javadoc>
+       </target>
+
+       <!-- Clean results - - - - - - - - - - - - - - - - - - - - - - - - - -->
+       <target name="clean-all" depends="">
+               <delete includeemptydirs="true" defaultexcludes="false">
+                       <fileset dir="build/result" includes="**/*" />
+               </delete>
+       </target>
+
+       <!-- ant contrib required for flow control (for loop) -->
+       <taskdef resource="net/sf/antcontrib/antlib.xml">
+               <classpath>
+                       <pathelement location="build/lib/ant-contrib-1.0b3.jar" />
+               </classpath>
+       </taskdef>
+
+       <!-- java2html converter -->
+       <taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask" classpath="build/lib/java2html.jar" />
+
+
+</project>