Mega Code Archive

 
Categories / Java / Ant
 

SmartGWT ant script

<project name="SmartGWT" default="build" basedir=".">   <property name="smartgwt.root" location="." />   <property name="project.tail" value="" />   <import file="${smartgwt.root}/common.ant.xml" />   <!-- "build" is the default when subprojects are directly targetted -->   <property name="target" value="build" />   <target name="dist" depends="main, doc, samples" description="Run the distributions">     <gwt.ant dir="distro-source" />   </target>      <target name="doc" depends="buildtools, main" description="Build doc">     <gwt.ant dir="doc" />   </target>     <target name="main"  description="Run SmartGWT">     <gwt.ant dir="main" />   </target>   <target name="samples" depends="main" description="Build samples">     <gwt.ant dir="samples" />   </target>   <target name="buildtools" description="Build the build tools">     <gwt.ant dir="build-tools" />   </target>     <target name="-do" depends="dist" description="Run all subprojects" />   <target name="build" description="Builds GWT">     <antcall target="-do">       <param name="target" value="build" />     </antcall>   </target>   <target name="checkstyle" description="Static analysis of GWT source">     <antcall target="-do">       <param name="target" value="checkstyle" />     </antcall>   </target>   <target name="test" depends="build" description="Test GWT">     <antcall target="-do">       <param name="target" value="test" />     </antcall>   </target>   <target name="clean" description="Cleans the entire GWT build">     <delete dir="${smartgwt.build}" />   </target>     <target name="smartclient-jar" depends="setup-smartclient-jar" description="make smartclient.jar">         <property environment="env"/>         <property name="SC_HOME" value="${env.SC_HOME}"/>         <property name="SC_VER" value="${env.SC_VER}"/>         <fail unless="SC_HOME" message="You must pass the SC_HOME environment variable"/>         <fail unless="SC_VER" message="You must pass the SC_VER environment variable"/>         <available file="${SC_HOME}/smartclientSDK" type="dir" property="smartclient.sdk.exists"/>         <fail unless="smartclient.sdk.exists"               message="Cannot find '${SC_HOME}/smartclientSDK' SDK directory; perhaps you should verify the SC_HOME environment variable"/>         <mkdir dir="${smartgwt.tools.lib}/sc/${SC_VER}"/>              <replace dir="${SC_HOME}/smartclientSDK/isomorphic/skins" includes="**/load_skin.js" token="showShadow:true" value="showShadow:false"/>              <zip destfile="${smartgwt.tools.lib}/sc/${SC_VER}/smartclient.jar">             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/modules" includes="*.js"                         prefix="com/smartclient/public/sc/modules"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/development"                        includes="ISC_DBConsole.js,ISC_DeveloperConsole.js,ISC_DocViewer.js,ISC_FileViewer.js,ISC_FileLoader.js,ISC_SyntaxHiliter.js,ISC_Tools.js,ISC_Core.js,ISC_Foundation.js,ISC_Containers.js,ISC_Grids.js,ISC_Forms.js,ISC_DataBinding.js"                         prefix="com/smartclient/tools/public/sc/system/development"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/helpers" includes="printFrame.*,empty.html,*.css,*.svg"                         prefix="com/smartclient/debug/public/sc/system/helpers"/>         <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/helpers" includes="printFrame.*,empty.html,*.css,*.svg"                   prefix="com/smartclient/public/sc/system/helpers"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/modules" includes="*.js"                         prefix="com/smartclient/debug/public/sc/modules-debug"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/schema" includes="*.xml"                         prefix="com/smartclient/public/sc/schema"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/schema" includes="*.xsl,*.wsdl"                         prefix="com/smartclient/debug/public/sc/system/schema"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/system/schema" includes="*.xsl,*.wsdl"                         prefix="com/smartclient/public/sc/system/schema"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/application" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/application"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/browser" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/browser"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/communications" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/communications"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/debug" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/debug"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/event" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/event"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/language" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/language"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/standalone" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/standalone"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/tools" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/tools"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/widgets" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/widgets"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/source/client/widgets/form" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/widgets/form"/>             <zipfileset dir="${smartgwt.build.out}/temp/schema" includes="*.js"                         prefix="com/smartclient/debug/public/sc/client/schema"/>             <zipfileset dir="${smartgwt.build.out}/temp" includes="initsc.js"                         prefix="com/smartclient/public/sc"/>             <zipfileset dir="${smartgwt.build.out}/temp" includes="Log.html"                         prefix="com/smartclient/tools/public/sc/system/helpers"/>             <zipfileset dirmode="755" filemode="644" src="${smartgwt.tools.lib}/sc/smartclient_tpl.jar"/>                    <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/Enterprise" includes="**/*.*" excludes="*.gz,*.psd"                                   prefix="com/smartclient/theme/enterprise/public/sc/skins/Enterprise"/>                           <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/EnterpriseBlue" includes="**/*.*" excludes="*.gz,*.psd"                                   prefix="com/smartclient/theme/enterpriseblue/public/sc/skins/EnterpriseBlue"/>         </zip>          <zip destfile="${smartgwt.tools.lib}/sc/${SC_VER}/smartgwt-skins.jar">       <zipfileset dirmode="755" filemode="644" src="${smartgwt.tools.lib}/sc/skins_tpl.jar"/>              <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/BlackOps" includes="**/*.*" excludes="*.gz"                         prefix="com/smartclient/theme/blackops/public/sc/skins/BlackOps"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/SilverWave" includes="**/*.*" excludes="*.gz"                         prefix="com/smartclient/theme/silverwave/public/sc/skins/SilverWave"/>             <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/TreeFrog" includes="**/*.*" excludes="*.gz"                         prefix="com/smartclient/theme/treefrog/public/sc/skins/TreeFrog"/>              <zipfileset dir="${SC_HOME}/smartclientSDK/isomorphic/skins/fleet" includes="**/*.*" excludes="*.gz"                         prefix="com/smartclient/theme/fleet/public/sc/skins/fleet"/>                  </zip>     <delete dir="${smartgwt.root}/main/src/com/smartclient"/>       <unjar dest="${smartgwt.root}/main/src" src="${smartgwt.tools.lib}/sc/${SC_VER}/smartclient.jar"/>     <move file="${smartgwt.root}/fmpp/data/referenceDocs.xml" tofile="${smartgwt.root}/fmpp/data/referenceDocs-bak.xml"/>     <copy file="${SC_HOME}/smartclientSDK/isomorphic/system/reference/referenceDocs.xml" tofile="${smartgwt.root}/fmpp/data/referenceDocs.xml"/>          </target>     <target name="setup-smartclient-jar">         <delete dir="${smartgwt.build.out}/target"/>         <delete dir="${smartgwt.build.out}/temp/schema"/>         <copy todir="${smartgwt.build.out}/temp/schema">             <fileset dir="${SC_HOME}/smartclientSDK/source/client/schema" includes="*.xml"/>             <globmapper from="*.xml" to="*.xml.js"/>         </copy>         <echo file="${smartgwt.build.out}/temp/initsc.js">if(!isomorphicDir){var isomorphicDir = "sc/";}</echo>     </target>       <target name="diff-report" depends="main">     <get src="http://www.smartclient.com/smartgwt/builds/release-${smartgwt.previous_version}/smartgwt.jar"          dest="${smartgwt.build.out}/smartgwt-${smartgwt.previous_version}.jar"          verbose="false"         usetimestamp="true"/>          <property name="dependencyfinder.home" location="${smartgwt.tools.lib}/dependency-finder/1.2.1" />     <taskdef name="jarjardiff" classname="com.jeantessier.dependencyfinder.ant.JarJarDiff">       <classpath>         <pathelement location="${dependencyfinder.home}/DependencyFinder.jar" />         <pathelement location="${dependencyfinder.home}/jakarta-oro.jar" />         <pathelement location="${dependencyfinder.home}/log4j.jar" />       </classpath>     </taskdef>              <property name="PREVIOUS_JAR" value="${smartgwt.build.out}/smartgwt-${smartgwt.previous_version}.jar"/>         <available file="${PREVIOUS_JAR}" type="file" property="oldjar.exists"/>         <fail unless="oldjar.exists"               message="Cannot find file '${PREVIOUS_JAR}' "/>       <jarjardiff destfile="${smartgwt.build.out}/diff.xml"                   name="SmartGWT"                   oldlabel="${smartgwt.previous_version}"                   newlabel="${smartgwt.version}">           <old>               <pathelement location="${PREVIOUS_JAR}"/>           </old>           <new>               <pathelement location="${project.lib}"/>           </new>       </jarjardiff>       <xslt style="${dependencyfinder.home}/etc/DiffToHTML.xsl"             in="${smartgwt.build.out}/diff.xml"             out="${smartgwt.root}/distro-source/core/src/api-changes.html"/>          </target>    </project> File: common.ant.xml <project name="common">         <!-- gwt.build.iscasesensitivefs is true if the filesystem of the           build machine is case-sensitive, false otherwise.  Update with           new lines for any supported platforms with case-insensitive           filesystems         -->         <condition property="gwt.build.iscasesensitivefs" else="false">           <not>             <or>               <os family="windows"/>             </or>           </not>         </condition>   <property name="test.ant.file" location="${smartgwt.root}/${project.tail}/build.xml" />     <echo  message="${test.ant.file}"/>     <condition property="project.valid">     <equals arg1="${ant.file}" arg2="${test.ant.file}"                   casesensitive="${gwt.build.iscasesensitivefs}"/>   </condition>     <fail unless="project.valid" message="This build file is in an inconsistent state." />   <!-- Global Properties -->   <property environment="env" />      <property name="smartgwt.version" value="2.0" />   <property name="smartgwt.version.major" value="2" />   <property name="smartgwt.version.minor" value="0" />   <property name="smartgwt.previous_version" value="1.3" />     <condition property="smartgwt.tools.check" value="${env.SMARTGWT_TOOLS}" else="${smartgwt.root}/../tools">     <isset property="env.SMARTGWT_TOOLS" />   </condition>     <property name="smartclient.version" value="7.0-2.0" />   <property name="smartgwt.tools" location="${smartgwt.tools.check}" />   <property name="smartgwt.tools.lib" location="${smartgwt.tools}/lib" />   <property name="smartgwt.tools.antlib" location="${smartgwt.tools}/antlib" />   <property name="smartgwt.tools.redist" location="${smartgwt.tools}/redist" />   <property name="smartgwt.build" location="${smartgwt.root}/build" />   <property name="smartgwt.build.out" location="${smartgwt.build}/out" />   <property name="smartgwt.build.lib" location="${smartgwt.build}/lib" />   <property name="smartgwt.build.staging" location="${smartgwt.build}/staging" />   <property name="smartgwt.build.dist" location="${smartgwt.build}/dist" />   <property name="project.build" location="${smartgwt.build.out}/${project.tail}" />   <property name="project.lib" location="${smartgwt.build.lib}/${ant.project.name}.jar" />   <property name="javac.out" location="${project.build}/bin" />   <property name="javac.junit.out" location="${project.build}/bin-test" />   <property name="javac.debug" value="true" />   <property name="javac.debuglevel" value="lines,vars,source" />   <property name="javac.encoding" value="utf-8" />   <property name="javac.source" value="1.5" />   <property name="javac.nowarn" value="true" />   <property name="junit.out" location="${project.build}/test" />     <property name="gwt.doctool.jar" location="${smartgwt.tools.lib}/gwt-build-tools/gwt-doctool.jar" />     <!-- Sanity check -->   <available file="${smartgwt.tools}" type="dir" property="gwt.tools.exists" />   <fail unless="gwt.tools.exists" message="Cannot find '${smartgwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />   <!-- Platform identification -->   <condition property="build.host.islinux">     <and>       <os family="unix" />       <not>         <contains string="${os.name}" substring="mac" casesensitive="false" />       </not>     </and>   </condition>   <condition property="build.host.platform" value="linux">     <isset property="build.host.islinux" />   </condition>   <condition property="build.host.ismac">     <and>       <os family="unix" />       <contains string="${os.name}" substring="mac" casesensitive="false" />     </and>   </condition>   <condition property="build.host.platform" value="mac">     <isset property="build.host.ismac" />   </condition>   <condition property="build.host.iswindows">     <os family="windows" />   </condition>   <condition property="build.host.platform" value="windows">     <isset property="build.host.iswindows" />   </condition>   <fail unless="build.host.platform" message="Building on ${os.name} is not supported" />   <condition property="junit.platform.args" value="-XstartOnFirstThread" else="">     <equals arg1="${build.host.platform}" arg2="mac" casesensitive="false" />   </condition>                <!--GWT jars location-->     <property name="gwt.version" value="2.0" />   <condition property="gwt_home" value="${env.GWT_HOME}" else="${smartgwt.tools.lib}/gwt/${gwt.version}/${build.host.platform}">     <isset property="env.GWT_HOME" />   </condition>      <echo>Using GWT from : ${gwt_home}</echo>         <property name="gwt.user.jar" location="${gwt_home}/gwt-user.jar" />   <property name="gwt.dev.jar" location="${gwt_home}/gwt-dev-${build.host.platform}.jar" />   <property name="gwt.dev2.jar" location="${gwt_home}/gwt-dev.jar" />     <!-- JUnit support -->   <property name="smartgwt.dev.staging.jar" location="${smartgwt.build.staging}/smartgwt-${smartgwt.version}/smartgwt.jar" />   <property name="smartgwt.junit.port" value="8889" />   <property name="smartgwt.junit.testcase.includes" value="**/*Test.class"/>      <!--     Comma delimited list of host and path components on which to run remote browser testing.   -->   <property name="smartgwt.remote.browsers" value="" />   <!-- Pulls in tasks defined in ant-contrib, i.e. foreach -->   <taskdef resource="net/sf/antcontrib/antlib.xml">     <classpath>       <pathelement location="${smartgwt.tools.antlib}/ant-contrib-1.0b3.jar" />     </classpath>   </taskdef>   <!-- Global Custom Tasks -->   <presetdef name="gwt.ant">     <ant inheritall="false" target="${target}">       <propertyset>         <propertyref name="smartgwt.version" />         <propertyref name="smartgwt.junit.port" />         <propertyref name="smartgwt.remote.browsers" />       </propertyset>     </ant>   </presetdef>   <presetdef name="gwt.javac">     <javac srcdir="src" destdir="${javac.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" encoding="${javac.encoding}" target="1.5"/>   </presetdef>   <presetdef name="gwt.jar">     <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />   </presetdef>   <macrodef name="gwt.junit">     <!-- TODO: make this more generic / refactor so it can be used from dev/core -->     <attribute name="test.args" default="" />     <attribute name="test.out" default="" />     <attribute name="test.reports" default="@{test.out}/reports" />     <attribute name="test.cases" default="" />     <sequential>       <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">         <classpath>           <pathelement location="${smartgwt.tools.lib}/junit/junit-3.8.1.jar" />           <pathelement location="${smartgwt.tools.antlib}/ant-junit-1.6.5.jar" />         </classpath>       </taskdef>       <echo message="Writing test results to @{test.reports} for @{test.cases}" />       <mkdir dir="@{test.reports}" />       <echo message="${javac.out} ${javac.junit.out}" />       <junit dir="@{test.out}" fork="yes" printsummary="yes" haltonfailure="false">         <jvmarg line="${junit.platform.args}" />         <sysproperty key="gwt.args" value="@{test.args}" />                 <!--the hosted mode library is searched based on the path of this library-->                 <sysproperty key="gwt.devjar" value="${gwt.dev.jar}" />         <sysproperty key="java.awt.headless" value="true" />           <classpath>           <pathelement location="${smartgwt.root}/${project.tail}/src" />           <pathelement location="${smartgwt.root}/${project.tail}/test" />           <pathelement location="${javac.junit.out}" />           <pathelement location="${javac.out}" />           <pathelement location="${smartgwt.dev.staging.jar}" />           <pathelement location="${gwt.user.jar}" />           <pathelement location="${gwt.dev.jar}" />           <pathelement location="${smartgwt.tools.lib}/junit/junit-3.8.1.jar" />         </classpath>         <formatter type="plain" />         <formatter type="xml" />         <batchtest todir="@{test.reports}">           <fileset refid="@{test.cases}" />         </batchtest>       </junit>     </sequential>   </macrodef>   <macrodef name="gwt.tgz.cat">     <attribute name="destfile" />     <element name="tar.elements" implicit="true" optional="true" />     <sequential>       <taskdef name="tar.cat" classname="com.google.gwt.ant.taskdefs.TarCat" classpath="${smartgwt.build.lib}/ant-gwt.jar" />       <tar.cat destfile="${project.dist}" compression="gzip" longfile="gnu">         <tar.elements />       </tar.cat>     </sequential>   </macrodef>   <macrodef name="gwt.checkstyle">     <element name="sourcepath" implicit="yes" optional="true" />     <sequential>       <taskdef resource="checkstyletask.properties" classpath="${smartgwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" />       <checkstyle config="${smartgwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxWarnings="0">         <property key="checkstyle.header.file" file="${smartgwt.root}/eclipse/settings/code-style/google.header" />         <sourcepath />       </checkstyle>     </sequential>   </macrodef>   <macrodef name="property.ensure">     <attribute name="name" />     <attribute name="location" />     <attribute name="message" default="Cannot find dependency ${@{name}}" />     <attribute name="unless" default="__nonexistent_property__" />     <sequential>       <property name="@{name}" location="@{location}" />       <condition property="@{name}.exists">         <or>           <available file="${@{name}}" />           <isset property="@{unless}" />         </or>       </condition>       <fail unless="@{name}.exists" message="@{message}" />     </sequential>   </macrodef>   <!-- Default implementations of the required targets; projects should   override the ones that matter -->   <target name="all" depends="verify" />   <target name="verify" depends="checkstyle, test" description="Verify this project" />   <target name="checkstyle" description="Static analysis of source" />   <target name="test" depends="build" description="Test this project" />   <target name="build" description="Build and (maybe) package this project" />   <target name="clean" description="Cleans this project's intermediate and output files">     <delete dir="${project.build}" />   </target> </project> File: platform.ant.xml <project name="platforms">   <import file="${smartgwt.root}/common.ant.xml" />   <!-- "build" is the default when subprojects are directly targetted -->   <property name="target" value="build" />   <available file="core/build.xml" type="file" property="core.exists" />   <target name="core" description="Run core" if="core.exists">     <gwt.ant dir="core" />   </target>   <target name="linux" depends="core" description="Run linux">     <gwt.ant dir="linux" />   </target>   <target name="windows" depends="core" description="Run windows">     <gwt.ant dir="windows" />   </target>   <target name="mac" depends="core" description="Run mac">     <gwt.ant dir="mac" />   </target>     <!--only windows build required for now-->     <target name="-do" depends="windows" description="Run all platforms" />   <target name="build" description="Build each platforms">     <antcall target="-do">       <param name="target" value="build" />     </antcall>   </target>   <target name="checkstyle" description="Static analysis of source for each platform">     <antcall target="-do">       <param name="target" value="checkstyle" />     </antcall>   </target>   <target name="test" depends="build" description="Test each platform">     <antcall target="-do">       <param name="target" value="test" />     </antcall>   </target> </project>