Sleds/dtxml/build.xml

528 lines
20 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="dt">
<taskdef name="fmpp" classname="fmpp.tools.AntTask"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" onerror="report"/>
<!-- Properties that can be overridden in "deploy.properties" file -->
<property name="output.dir" value="target"/>
<property name="web.basedir" value="/"/>
<property name="home.page" value="${web.basedir}index.html"/>
<property name="catalina.home" value="/usr/local/tomcat"/>
<property name="struts.home" value="/usr/local/struts"/>
<property name="database.vendor" value="MYSQL"/>
<property name="single.js" value="false"/>
<tstamp>
<format property="build.date" pattern="MM/dd/yyyy hh:mm aa"/>
<format property="build.stamp" pattern="yyyyMMdd-hh"/>
<format property="js.arg" pattern="yyyyMMddhhmm" />
</tstamp>
<!-- jGrouse config -->
<!--
<property name="jGrouseHome" value="/usr/local/jGrouse"/>
<property name="inputDir" value="src/js"/>
<property name="projectName" value="Dovetail Javascript Framework - &#169; 2007 Dovetail Software, Inc. All Rights Reserved"/>
<property name="appVersion" value="Version::${build.stamp}"/>
<property name="projectDesc" value="Dovetail Framework ${appVersion}"/>
<property name="jsOutputDir" value="${output.dir}/jsdoc"/>
<property name="encoding" value="UTF-8"/>
<property name="projectFile" value="jgrouse.xml"/>
<taskdef name="jgdoc" classname="jgrouse.jgdoc.ant.JGTask" classpath="${jGrouseHome}/jgdoc.jar"></taskdef>
-->
<!-- Override above with local file -->
<property file="deploy.properties"/>
<path id="project.classpath">
<pathelement location="src/lib/logging-log4j-1.2.14/dist/lib/log4j-1.2.14.jar"/>
<pathelement location="src/lib/mail.jar"/>
<pathelement location="src/lib/jaxen/jaxen-1.1.1.jar"/>
<pathelement location="src/lib/xerces-2_9_0/xml-apis.jar"/>
<pathelement location="src/lib/xerces-2_9_0/xercesImpl.jar"/>
<pathelement location="src/lib/xerces-2_9_0/serializer.jar"/>
<pathelement location="src/lib/commons-collections.jar"/>
<pathelement location="src/lib/commons-pool-1.2.jar"/>
<pathelement location="src/lib/commons-cli-1.2.jar"/>
<pathelement location="src/lib/commons-dbcp-1.2.1.jar"/>
<pathelement location="src/lib/jfreechart-1.0.9/lib/jfreechart-1.0.9.jar"/>
<pathelement location="src/lib/jfreechart-1.0.9/lib/jcommon-1.0.12.jar"/>
<pathelement location="src/lib/js.jar"/>
<pathelement location="src/lib/spring.jar"/>
<pathelement location="src/lib/spring-ws-1.5.6-all.jar"/>
<pathelement location="${struts.home}/lib/struts.jar"/>
<pathelement location="${struts.home}/lib/commons-beanutils.jar"/>
<pathelement location="${struts.home}/lib/commons-fileupload.jar"/>
<pathelement location="${struts.home}/lib/commons-logging.jar"/>
<pathelement location="${struts.home}/lib/commons-digester.jar"/>
<pathelement location="${catalina.home}/common/lib/servlet-api.jar"/>
<pathelement location="${catalina.home}/common/lib/jsp-api.jar"/>
</path>
<!-- std token filters -->
<filterset id="build.token.filters">
<filter token="APP_ROOT" value="${context.root}"/>
</filterset>
<!-- these depend on MySQL vs. HSQLDB vs. some other DB; -->
<echo message="DATABASE is ${database.vendor}"/>
<if>
<equals arg1="${database.vendor}" arg2="MYSQL"/>
<then>
<filterset id="sql.token.filters" description="SQL Token Filters">
<filter token="MYSQL.TYPE.INNODB" value="Type=InnoDB"/>
<filter token="MYSQL.TYPE.MYISAM" value="Type=MyISAM"/>
<filter token="CHARSET.UTF8" value="character set utf8"/>
<filter token="COLLATION.BINARY" value="collate utf8_bin"/>
<filter token="AUTO_INCREMENT" value="auto_increment"/>
<filter token="TEXT" value="text"/>
<filter token="MEDIUMTEXT" value="mediumtext"/>
<filter token="BINARY" value="mediumblob"/>
<filter token="REQUIRE_HSQLDB" value="--"/>
<filter token="REQUIRE_MYSQL" value=""/>
<filter token="HSQLDB_ENCODE_BINARY" value=""/>
<filter token="DEFAULT_TIMESTAMP_NOW" value=""/>
</filterset>
</then>
<elseif>
<equals arg1="${database.vendor}" arg2="HSQLDB"/>
<then>
<filterset id="sql.token.filters" description="SQL Token Filters">
<filter token="MYSQL.TYPE.INNODB" value=""/>
<filter token="MYSQL.TYPE.MYISAM" value=""/>
<filter token="CHARSET.UTF8" value=""/>
<filter token="COLLATION.BINARY" value=""/>
<filter token="AUTO_INCREMENT" value="IDENTITY"/>
<filter token="TEXT" value="longvarchar"/>
<filter token="MEDIUMTEXT" value="longvarchar"/>
<filter token="BINARY" value="binary"/>
<filter token="REQUIRE_HSQLDB" value=""/>
<filter token="REQUIRE_MYSQL" value="--"/>
<filter token="HSQLDB_ENCODE_BINARY" value="ENCODE_BINARY"/>
<filter token="DEFAULT_TIMESTAMP_NOW" value="default NOW"/>
</filterset>
</then>
</elseif>
<else>
<echo message="Using undefined database.vendor; sql.token.filters requires either database.vendor=MYSQL; database.vendor=HSQLDB"/>
</else>
</if>
<!-- One time init for local setup: Execute this once if you want to use the flash target! -->
<target name="onetime">
<copy todir="${ant.home}/lib">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<!-- Standard init -->
<target name="init">
<echo message="init"/>
<mkdir dir="${output.dir}"/>
<mkdir dir="${output.dir}/fmpp"/>
<mkdir dir="${output.dir}/fmpp/sql"/>
<mkdir dir="${output.dir}/java"/>
<mkdir dir="${output.dir}/web"/>
<mkdir dir="${output.dir}/sql"/>
</target>
<!-- Clean your output dir -->
<target name="clean">
<delete dir="${output.dir}"/>
</target>
<!-- Deploy to webserver running on local OS -->
<target name="deployLocally" depends="build">
<copy todir="${catalina.home}/webapps">
<fileset dir="${output.dir}/webapps">
<include name="dt.war"/>
</fileset>
</copy>
</target>
<!-- Compile and pre-process files -->
<target name="build" depends="compile, jar, web, sql">
<echo message="${ant.project.name}: ${ant.file}"/>
<echo message="*********** BUILD COMPLETED **********"/>
</target>
<!-- =================================================================== -->
<!-- Web -->
<!-- =================================================================== -->
<target name="web" depends="init">
<echo message="Staging web files"/>
<!-- non-substituted files -->
<copy todir="${output.dir}/web/images">
<fileset dir="src/images">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
<copy todir="${output.dir}/web/cal">
<fileset dir="src/lib/jscalendar-1.0">
<include name="**/*.js"/>
<include name="**/*.css"/>
</fileset>
</copy>
<echo message="jscal"/>
<concat destfile="${output.dir}/web/cal/jscal.js" fixlastline="yes">
<filelist dir="src/lib/jscalendar-1.0" files="calendar_stripped.js,calendar-setup_stripped.js,lang/calendar-en.js"/>
</concat>
<!--
<copy todir="${output.dir}/web/rico">
<fileset dir="src/lib/rico/src">
<include name="*.js"/>
<include name="*.xsl"/>
<exclude name="prototype.js"/>
</fileset>
</copy>
-->
<copy todir="${output.dir}/web/en_US/images">
<fileset dir="src/en_US/images">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
<copy todir="${output.dir}/web/js">
<fileset dir="src/lib/jscalendar-1.0/lang">
<include name="calendar-en.js"/>
</fileset>
</copy>
<copy todir="${output.dir}/web/js">
<fileset dir="src/lib">
<include name="prototype.js"/>
<!-- include name="scw.js"-->
<include name="env.js"/>
</fileset>
<fileset dir="src/lib/lightbox2/js">
<include name="lightbox.js"/>
</fileset>
<fileset dir="src/lib/scriptaculous-js-1.8.2/src">
<include name="*.js"/>
</fileset>
<fileset dir="src/lib/scriptaculous-js-1.8.2/lib">
<include name="prototype-1.6.03.js"/> <!-- 1.6.03 overrides core dovetail prototype.js -->
</fileset>
<fileset dir="src/lib/lytebox_v3">
<include name="lytebox.js"/>
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
<param type="regexp" value="[^\s]"/>
</filterreader>
</filterchain>
</copy>
<copy todir="${output.dir}/web/js">
<fileset dir="src/lib/XPath">
<include name="XPath.js"/>
</fileset>
<!-- not very good (above
google is more horrid, though
<fileset dir="src/lib/ajaxslt">
<include name="xpath.js"/>
<include name="xmltoken.js"/>
<include name="util.js"/>
</fileset>
-->
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
<param type="regexp" value="[^\s]"/>
</filterreader>
</filterchain>
</copy>
<copy todir="${output.dir}/web/js">
<fileset dir="src/lib/sarissa-0.9.7.8/sarissa">
<include name="sarissa.js"/>
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
<param type="regexp" value="[^\s]"/>
</filterreader>
</filterchain>
</copy>
<copy todir="${output.dir}/web/css">
<fileset dir="src/lib/lightbox2/css">
<include name="lightbox.css"/>
</fileset>
<fileset dir="src/lib/lytebox_v3">
<include name="lytebox.css"/>
</fileset>
</copy>
<copy todir="${output.dir}/web/images">
<fileset dir="src/lib/lightbox2/images">
<include name="*.gif"/>
<include name="*.jpg"/>
</fileset>
<fileset dir="src/lib/lytebox_v3/images">
<include name="*.gif"/>
<include name="*.png"/>
</fileset>
</copy>
<!--
Notes:
1. fmpp_path_prefix is used at BUILD time to resolve relative paths.
This value gets substituted for every pre-processed file.
We make it "relative" so that files in the root directory usually
read as "./" and when down one level into a locale directory "../".
2. basedir is an absolute path used in CSS files and other links.
It should resolve to the top-level deployment directory. Developers
are using "/" and (TBD) deployment at "/html/".
-->
<!-- substituted via FMPP task -->
<echo message="FMPP src/html"/>
<fmpp sourceRoot="src/html" outputRoot="${output.dir}/fmpp" sourceEncoding="UTF-8">
<data expandProperties="yes">
basedir_relative: "./"
basedir: "${web.basedir}"
encoding: UTF-8
today: "${build.date}"
homepage: "${home.page}"
js_arg: "?x=${js.arg}"
single_js: "${single.js}"
locale: en_US
language: en
maps_key: "${maps.key}"
</data>
<include name="*.html" />
<!-- no: These are referenced but not actually copied <include name="html/inc/**" /> -->
</fmpp>
<echo message="FMPP src js/css"/>
<fmpp sourceRoot="src" outputRoot="${output.dir}/fmpp" sourceEncoding="UTF-8">
<data expandProperties="yes">
basedir_relative: "./"
basedir: "${web.basedir}"
encoding: UTF-8
today: "${build.date}"
homepage: "${home.page}"
js_arg: "?x=${js.arg}"
single_js: "${single.js}"
locale: en_US
language: en
maps_key: "${maps.key}"
</data>
<include name="js/*.js"/>
<include name="css/*.css"/>
</fmpp>
<echo message="FMPP src/sql"/>
<fmpp sourceRoot="src/sql" outputRoot="${output.dir}/fmpp/sql" sourceEncoding="UTF-8">
<data expandProperties="yes">
basedir_relative: "./"
basedir: "${web.basedir}"
encoding: UTF-8
today: "${build.date}"
homepage: "${home.page}"
js_arg: "?x=${js.arg}"
single_js: "${single.js}"
locale: en_US
language: en
maps_key: "${maps.key}"
</data>
<include name="*.sql" />
</fmpp>
<!-- en_US locale specific -->
<echo message="FMPP en_US"/>
<fmpp sourceRoot="src" outputRoot="${output.dir}/fmpp" sourceEncoding="UTF-8">
<data expandProperties="yes">
basedir_relative: "../"
basedir: "${web.basedir}"
encoding: UTF-8
locale: en_US
language: en
today: "${build.date}"
tdd(en_US/build-strings.tdd)
homepage: "${home.page}"
js_arg: "?x=${js.arg}"
single_js: "${single.js}"
dash: "true"
maps_key: "${maps.key}"
</data>
<include name="en_US/js/*.js"/>
<include name="en_US/css/*.css"/>
<include name="en_US/*.html" />
<include name="en_US/*.xsl" />
</fmpp>
<!-- create one single concatenated pred-all.js file (which is script included depending on build single.js arg -->
<concat destfile="${output.dir}/fmpp/js/dovetail.js" fixlastline="yes">
<!-- this needs to be done in this order! -->
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-core.js"/>
</fileset>
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-doc.js"/>
<include name="dt-ajax.js"/>
<include name="dt-err.js"/>
<include name="dt-locale.js"/>
<include name="dt-date.js"/>
<include name="dt-element.js"/>
<include name="dt-ui.js"/>
<include name="dt-io.js"/>
<include name="dt-tabs.js"/>
<include name="dt-table.js"/>
<include name="dt-effects.js"/>
<include name="dt-progress.js"/>
<include name="dt-drag.js"/>
<!-- include name="dt-popup.js" -->
<include name="dt-menu.js"/>
<include name="dt-calc.js"/>
<include name="dt-validator.js"/>
<include name="dt-input.js"/>
<include name="dt-combo.js"/>
<include name="dt-upload.js"/>
<include name="dt-grid.js"/>
<include name="dt-tour.js"/>
<include name="dt-geom.js"/>
<include name="dt-gantt.js"/>
</fileset>
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-darray.js"/>
</fileset>
</concat>
<!-- DGate -->
<concat destfile="${output.dir}/fmpp/js/dt-dgate.js" fixlastline="yes">
<!-- this needs to be done in this order! -->
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-core.js"/>
</fileset>
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-doc.js"/>
<include name="dt-ajax.js"/>
<include name="dt-err.js"/>
<include name="dt-locale.js"/>
<include name="dt-date.js"/>
<include name="dt-element.js"/>
<include name="dt-ui.js"/>
<include name="dt-io.js"/>
<include name="dt-tabs.js"/>
<include name="dt-table.js"/>
<include name="dt-effects.js"/>
<include name="dt-progress.js"/>
<include name="dt-drag.js"/>
<include name="dt-calc.js"/>
<include name="dt-validator.js"/>
<include name="dt-input.js"/>
<include name="dt-combo.js"/>
<include name="dt-upload.js"/>
<include name="dt-geom.js"/>
</fileset>
<fileset dir="${output.dir}/fmpp/js">
<include name="dt-darray.js"/>
</fileset>
</concat>
<!-- now copy and strip comments from fmpp output dir to web dir -->
<copy todir="${output.dir}/web">
<fileset dir="${output.dir}/fmpp">
<include name="**/*"/>
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.StripJavaComments"/>
<filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp">
<param type="regexp" value="[^\s]"/>
</filterreader>
</filterchain>
</copy>
</target>
<!-- =================================================================== -->
<!-- SQL -->
<!-- =================================================================== -->
<target name="sql" depends="web">
<echo message="Staging sql files"/>
<copy todir="${output.dir}/sql">
<filterset refid="build.token.filters"/>
<filterset refid="sql.token.filters"/>
<fileset dir="${output.dir}/fmpp/sql">
<include name="*.sql"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Compile -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<description>Compiles all the Java code for the project.</description>
<echo message="Compiling using source dir src/java"/>
<javac srcdir="src/java"
destdir="${output.dir}/java"
deprecation="yes"
debug="on" >
<classpath refid="project.classpath"/>
<include name="**/*.java"/>
</javac>
<echo message="Copying properties files from src/java to ${output.dir}/java/com" />
<copy overwrite="true" todir="${output.dir}/java/com">
<filterset refid="build.token.filters"/>
<fileset dir="src/java"
includes="**/*.properties"
excludes="**/*.java"
/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Jar -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<description>Create dt.jar</description>
<echo message="Creating dt.jar"/>
<jar compress="true" basedir="${output.dir}/java" jarfile="${output.dir}/java/dt.jar" includes="com/dt/**/*, org/json/**/*"/>
</target>
<!-- =================================================================== -->
<!-- Javadoc -->
<!-- =================================================================== -->
<target name="javadoc" depends="init" description="Generate javadoc to staging/doc/javadoc">
<echo>"Writing javadoc to ${output.dir}/javadoc "</echo>
<javadoc sourcepath="src/java" packagenames="*" destdir="${output.dir}/javadoc"
access="private" author="true" version="true" classpathref="project.classpath">
</javadoc>
</target>
<target name="jsdoc" depends="init, makeProjectFile, antgen, antrun, cleanupTempFiles" description="Generate Javascript javadoc to staging/jsdoc">
</target>
<target name="makeProjectFile" description="Extract comments from source code">
<mkdir dir="${jsOutputDir}"/>
<jgdoc output="${jsOutputDir}/${projectFile}" encoding="${encoding}">
<fileset dir="${inputDir}" includes="**/*.js">
</fileset>
</jgdoc>
</target>
<target name="antgen">
<delete file="${jsOutputDir}/antgen.xml"/>
<xslt style="${jGrouseHome}/xslt/antgen.xslt" in="${jsOutputDir}/${projectFile}" out="${jsOutputDir}/antgen.xml">
<param name="jGrouseHome" expression="${jGrouseHome}"/>
<param name="projectName" expression="${projectName}"/>
<param name="projectDesc" expression="${projectDesc}"/>
<param name="projectFile" expression="${projectFile}"/>
<param name="outDir" expression="${jsOutputDir}"/>
<param name="version" expression="${appVersion}"/>
</xslt>
</target>
<target name="antrun">
<ant antfile="${jsOutputDir}/antgen.xml"></ant>
</target>
<target name="cleanupTempFiles">
<delete file="${jsOutputDir}/antgen.xml"/>
<delete file="${jsOutputDir}/${projectFile}"/>
</target>
</project>