[sqlworkbench] / trunk / sqlworkbench / scripts / build.xml Repository:
mgm logo

View of /trunk/sqlworkbench/scripts/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 258 - (download) (as text) (annotate)
Thu May 13 18:03:47 2004 UTC (15 years, 10 months ago) by thomas
File size: 17066 byte(s)
*** empty log message ***
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="make-jar" name="Workbench">

  <property name="root" value=".."/>
  <property name="doc" value="../doc"/>
  <property name="src" value="../src"/>
  <property name="csrc" value="../launcher"/>
  <property name="scriptsrc" value="."/>
  <property name="libdir" value="../libs"/>
  <property name="build" value="../build"/>
  <property name="classes" value="../classes"/>
  <property name="distdir" value="../dist"/>
  <property name="version" value="0.1"/>
  <property name="jarfile" value="Workbench.jar"/>
  <property name="javadocdir" value="../javadoc"/>
  <property name="srczipname" value="WorkbenchSrc.zip"/>
  <property name="srczip" value="${root}/${srczipname}"/>
  <property name="packagezip" value="${root}/release/workbench.zip"/>
  <property name="doczip" value="${root}/release/html-manual.zip"/>
  
  <!-- location of the docbook installation and the FOP installation -->
  <property name="docbook.root" value="${doc}/docbook"/>
  <property name="fop.root" value="c:/etc/fop"/>  

  <target name="init">
    <tstamp>
      <format pattern="yyyy-MM-dd HH:mm" property="build_date"/>
    </tstamp>
    <tstamp>
    <format pattern="dd.MM.yyyy" property="formatted_build_date"/>
    </tstamp>
  </target>

  <path id="docbook.extensions.path">
    <pathelement location="c:/etc/xalan/bin/xalan.jar"/>
    <pathelement location="c:/etc/xalan/bin/xercesImpl.jar"/>
    <pathelement location="${docbook.root}/extensions/xalan2.jar"/>
    <pathelement path="${classpath}"/>
  </path>  
  
  <path id="fop.path">
    <fileset dir="${fop.root}/lib">
      <include name="**/*.jar"/>
    </fileset>
    <pathelement location="${fop.root}/build/fop.jar"/>
  </path>
  
  <target name="set-build-number" depends="init">
    <buildnumber file="build.number"/>
    <echo message="Build number is ${build.number}"/>
  </target>
  
  <target name="set-dev-build" depends="init">
    <property name="build.number" value="[Dev]"/>
    <echo message="Build number is ${build.number}"/>
  </target>

  <target name="clean">
    <delete dir="${build}/workbench" failonerror="false"/>
    <delete file="${scriptsrc}/history.new" failonerror="false" />
    <mkdir dir="${build}"/>
    <mkdir dir="${distdir}"/>
  </target>

  <target name="prepare" depends="init">
    <copy todir="${build}">
      <fileset dir="${src}">
        <include name="**/*.gif"/>
        <include name="**/*.ico"/>
        <include name="**/*.png"/>
        <include name="**/*.xml"/>
        <include name="**/*.html"/>
      </fileset>
    </copy>
    <copy todir="${build}">
      <fileset dir="${src}">
        <include name="**/*.properties"/>
      </fileset>
      <filterset begintoken="@" endtoken="@">
        <filter token="BUILD_DATE" value="${build_date}"/>
        <filter token="BUILD_NUMBER" value="${build.number}"/>
      </filterset>
    </copy>
    
    <copy todir="${build}">
      <fileset dir="${src}">
        <include name="**/BaseValueObject.java"/>
        <include name="**/BaseTablePersistence.java"/>
      </fileset>
    </copy>
  </target>

  <target name="compile" depends="prepare">
    <javac debug="off" debuglevel="source,lines" destdir="${build}" optimize="on" srcdir="${src}" >
        <exclude name="workbench/test/**"/>
    </javac>
  </target>


  <!-- Manual related tasks -->
  
  <!-- Create the FO file which will in turn be transformed 
       into the PDF manual by the target "pdf"
  -->
  <target name="fop" depends="init">
    <copy overwrite="true" todir="${doc}/pdf">
      <fileset dir="${doc}/xml">
        <include name="*.xml"/>
      </fileset>
      
      <filterset begintoken="@" endtoken="@">
        <filter token="BUILD_DATE" value="${build_date}"/>
        <filter token="BUILD_NUMBER" value="${build.number}"/>
        <filter token="IMAGE_DIR" value="${src}/workbench/resource/images"/>
      </filterset>
    </copy>
    
    <xslt in="${doc}/pdf/Manual.xml" out="${doc}/pdf/manual.fo" style="${doc}/xsl/workbench-pdf.xsl">
      <param name="paper.type" expression="A4"/>
      <param name="page.orientation" expression="portrait"/>
      <param name="margin.bottom" expression="1.5cm"/>
      <param name="margin.top" expression="1.5cm"/>
      <param name="margin.left" expression="2cm"/>
      <param name="margin.right" expression="2cm"/>
    </xslt>
    <delete>
      <fileset dir="${doc}/pdf">
        <include name="*.xml"/>
      </fileset>
    </delete>
  </target>
  
  <!-- Create the pdf version of the manual -->
  <target name="pdf" depends="fop">
    <java classname="org.apache.fop.apps.Fop" classpathref="fop.path">
      <arg value="${doc}/pdf/manual.fo"/>
      <arg value="${doc}/pdf/SQLWorkbench-Manual.pdf"/>
    </java>
    <delete file="${doc}/pdf/manual.fo"/>
  </target>

  <!-- Create the html help files for putting them into the 
       distribution jar 
  -->
 
  <target name="build-help" depends="prepare">
    <delete dir="${build}/help" failonerror="false"/>
    <mkdir dir="${build}/help"/>
    <echo message="Generating HTML Help"/>
    <!-- copy overwrite="true" todir="${build}/help" file="${doc}/xml/docbookx.dtd"/ -->
    <copy overwrite="true" todir="${build}/help">
      <fileset dir="${doc}/xml">
        <include name="*.xml"/>
      </fileset>
      
      <filterset begintoken="@" endtoken="@">
        <filter token="BUILD_DATE" value="${build_date}"/>
        <filter token="BUILD_NUMBER" value="${build.number}"/>
        <filter token="IMAGE_DIR" value="../workbench/resource/images"/>
      </filterset>
    </copy>
    
    <xslt basedir="${build}/help" includes="Manual.xml" style="${doc}/docbook/html/chunk.xsl" destdir="${build}/help">
      <xmlcatalog>
        <dtd publicId="-//OASIS//DTD DocBook XML V4.2//EN"
             location="${doc}/dtd/docbookx.dtd"/>
      </xmlcatalog>
    
      <param name="root.filename" expression="index"/>
      <param name="html.stylesheet" expression="html-internal.css"/>
      <param name="admon.graphics.path" expression="../workbench/resource/images/"/>
      <param name="admon.graphics.extension" expression=".gif"/>
      <param name="admon.graphics" expression="1"/>
      <param name="admon.textlabel" expression="0"/>
      <param name="chunk.first.sections" expression="1"/>      
      <param name="chunker.output.indent" expression="yes"/>
      <param name="chunk.quietly" expression="1"/>
      <param name="chunk.fast" expression="1"/>
      <param name="use.id.as.filename" expression="1"/>
      <param name="section.autolabel" expression="1"/>
      <param name="table.borders.with.css" expression="0"/>
      <param name="table.cell.border.style" expression="solid"/>
      <param name="table.cell.border.thickness" expression="1px"/>
      <param name="table.frame.border.style" expression="solid"/>
      <param name="table.frame.border.thickness" expression="1px"/>
      <param name="make.valid.html" expression="1"/>
      <param name="html.cleanup" expression="1"/>
      <param name="navig.showtitles" expression="1"/>
      <param name="css.decoration" expression="1"/>
    </xslt>
    <!-- delete file="${build}/help/docbookx.dtd"/ -->
    <delete file="${build}/help/Manual.html"/>
    <delete>
      <fileset dir="${build}/help">
        <include name="*.xml"/>
      </fileset>
    </delete>
    
    <copy overwrite="true" todir="${build}/help" file="${doc}/css/html-internal.css"/>
  </target>
  
  <target name="init-help">
    <property name="html-stylesheet" value="html-internal.css"/>
    <property name="html-outdir" value="${build}/help"/>
    <property name="html-resource-dir" value="../workbench/resource/images"/>
    <property name="index-file-name" value="index"/>
    <property name="html-css-tables" value="0"/>
  </target>

  <!-- Create the HTML files suitable for publishing on the website -->
  <target name="publish" depends="init-publish,build-html"/>
  
  <target name="init-publish">
    <property name="html-stylesheet" value="html-publish.css"/>
    <property name="html-outdir" value="${distdir}/manual"/>
    <property name="html-resource-dir" value="./images"/>
    <property name="index-file-name" value="workbench-manual"/>
    <property name="html-css-tables" value="1"/>
    
    <delete dir="${html-outdir}" failonerror="false"/>
    <mkdir dir="${html-outdir}"/>
    <mkdir dir="${html-outdir}/images"/>
    
    <copy todir="${html-outdir}/${html-resource-dir}" flatten="true">
      <fileset dir="${src}/workbench/resource/images">
        <include name="New16.gif"/>
        <include name="Delete16.gif"/>
        <include name="ExecuteSel16.gif"/>
        <include name="note.gif"/>
      </fileset>
    </copy>
  </target>

  <target name="build-html" depends="prepare">
  
    <echo message="Generating HTML in ${html-outdir}"/>
    <!-- copy overwrite="true" todir="${html-outdir}" file="${doc}/xml/docbookx.dtd"/ -->
    
    <copy overwrite="true" todir="${html-outdir}">
      <fileset dir="${doc}/xml">
        <include name="*.xml"/>
      </fileset>
      
      <filterset begintoken="@" endtoken="@">
        <filter token="BUILD_DATE" value="${build_date}"/>
        <filter token="BUILD_NUMBER" value="${build.number}"/>
        <filter token="IMAGE_DIR" value="${html-resource-dir}"/>
      </filterset>
    </copy>
    
    <copy overwrite="true" tofile="${html-outdir}/history.txt" file="${scriptsrc}/history.new"/>
    
    <xslt basedir="${html-outdir}" includes="Manual.xml" style="${doc}/docbook/html/chunk.xsl" 
          processor="trax" 
          destdir="${html-outdir}" classpathref="docbook.extensions.path">
      <xmlcatalog>
        <dtd publicId="-//OASIS//DTD DocBook XML V4.2//EN"
             location="${doc}/dtd/docbookx.dtd"/>
      </xmlcatalog>
      <param name="use.extensions" expression="0"/>
      <param name="textinsert.extension" expression="1"/>     
      <param name="root.filename" expression="${index-file-name}"/>
      <param name="html.stylesheet" expression="${html-stylesheet}"/>
      <param name="admon.graphics.path" expression="${html-resource-dir}/"/>
      <param name="admon.graphics.extension" expression=".gif"/>
      <param name="admon.graphics" expression="1"/>
      <param name="admon.textlabel" expression="0"/>
      <param name="chunk.first.sections" expression="1"/>      
      <param name="chunker.output.indent" expression="yes"/>
      <param name="chunk.quietly" expression="1"/>
      <param name="chunk.fast" expression="1"/>
      <param name="use.id.as.filename" expression="1"/>
      <param name="section.autolabel" expression="1"/>
      <param name="table.borders.with.css" expression="${html-css-tables}"/>
      <param name="table.cell.border.style" expression="solid"/>
      <param name="table.cell.border.thickness" expression="1px"/>
      <param name="table.frame.border.style" expression="solid"/>
      <param name="table.frame.border.thickness" expression="1px"/>
      <param name="make.valid.html" expression="1"/>
      <param name="html.cleanup" expression="1"/>
      <param name="navig.showtitles" expression="1"/>
      <param name="css.decoration" expression="1"/>
    </xslt>
    <!-- delete file="${html-outdir}/docbookx.dtd"/ -->
    <delete file="${html-outdir}/Manual.html"/>
    <delete>
      <fileset dir="${html-outdir}">
        <include name="*.xml"/>
      </fileset>
    </delete>
    
    <delete file="${html-outdir}/Manual.xml"/>
    <copy overwrite="true" todir="${html-outdir}" file="${doc}/css/${html-stylesheet}"/>
  </target>
  
  <!-- End Manual related tasks -->
  
  <target name="make-jar" depends="prepare">
    <copy failonerror="false" overwrite="true" file="${scriptsrc}/history.new" tofile="${build}/help/history.txt" />
    <copy failonerror="false" overwrite="true" file="${scriptsrc}/history.new" tofile="${distdir}/history.txt" />
    
    <jar compress="true" jarfile="${distdir}/${jarfile}">
      <manifest>
        <attribute name="Main-Class" value="workbench.WbStarter"/>
        <attribute name="Created-By" value="workbench@kellerer.org"/>
        <attribute name="WbBuild-Number" value="${build.number}"/>
        <attribute name="WbBuild-Date" value="${build_date}"/>
      </manifest>
      <fileset dir="${build}">
      </fileset>
    </jar>
    
  </target>

  <target name="publish-dev" depends="set-dev-build, copy-history, publish, clean-history"/>

  <target  name="dev-release" depends="set-dev-build, clean, copy-history, prepare, compile, build-help, make-jar, clean-history"/>
  
  <target name="make-dev-jar" depends="set-dev-build, clean, copy-history, prepare, compile, make-jar, clean-history"/>
  
  <target name="make-src-zip">
    <delete file="${srczip}"/>

    <zip zipfile="${srczip}">
      <zipfileset dir="${src}" prefix="src">
        <include name="**/*.*"/>
        <include name="**/*.class"/>
        <exclude name="**/workbench.settings"/>
        <exclude name="**/CVS/*"/>
        <exclude name="**/.cvsignore"/>
        <exclude name="**/.nb*"/>
        <exclude name="**/*.dfPackage"/>
        <exclude name="**/tags"/>
        <exclude name="help/*.*"/>
        <exclude name="**/TestTrigger.java"/>
        <exclude name="**/*.tws"/>
      </zipfileset>
      
      <zipfileset dir="${scriptsrc}" prefix="scripts">
        <exclude name="**/.nb*"/>
        <exclude name="**/.new"/>
      </zipfileset>
      
      <zipfileset dir="${doc}" prefix="doc">
        <include name="**/*.*"/>
        <exclude name="**/.nb*"/>
        <exclude name="html/**/*.*"/>
        <exclude name="openoffice/**/*.*"/>
        <exclude name="documentation.project"/>
        <exclude name="docbook/**/*.*"/>
        <exclude name="manual/**/*.*"/>
        <exclude name="jhelp/**/*.*"/>
        <exclude name="pdf/**/*.*"/>
      </zipfileset>
    </zip>
  </target>

  <!-- build a full relase with documentation and source distribution -->  
  <target name="release" 
      depends="clean, set-build-number, copy-history, build-help, compile, make-jar, pdf, publish, release-package, restart-history, clean-history"
  />

  <target name="copy-history">
    <copy file="${scriptsrc}/history.txt" overwrite="true" tofile="${scriptsrc}/history.new">
      <filterset begintoken="@" endtoken="@">
        <filter token="BUILD_DATE" value="${formatted_build_date}"/>
        <filter token="BUILD_NUMBER" value="${build.number}"/>
      </filterset>
    </copy>
  </target>

  <target name="restart-history">
    <concat destfile="${scriptsrc}/history.txt">
      <filelist dir="${scriptsrc}" files="history.header,history.new"/>    
    </concat>
  </target>
  <target name="clean-history">
    <delete file="${scriptsrc}/history.new" failonerror="false"/>
  </target>
    
  <target name="release-package" depends="init">
  
    <copy file="${distdir}/${jarfile}" overwrite="true" todir="${root}/release"/>
    <copy file="${scriptsrc}/history.new" overwrite="true" tofile="${root}/release/history.txt"/>
    
    <copy file="${doc}/pdf/SQLWorkbench-Manual.pdf" overwrite="true" todir="${root}/release"/>
    <copy file="${distdir}/JWorkbench.exe" overwrite="true" todir="${root}/release"/>
    
    <delete dir="${root}/release/manual"/>
    <copy todir="${root}/release/manual">
        <fileset dir="${html-outdir}"/>
    </copy>
    <delete file="${packagezip}"/>
    <zip zipfile="${packagezip}">
      <zipfileset dir="${root}/release">
        <include name="Workbench.jar"/>
        <include name="history.txt"/>
      </zipfileset>
      <zipfileset dir="${distdir}">
        <include name="JWorkbench.exe"/>
      </zipfileset>
      <zipfileset dir="${html-outdir}" prefix="manual">
        <include name="**/*.*"/>
      </zipfileset>
    </zip>
    
    <delete>
      <fileset dir="${root}/release">
        <include name="WorkbenchSrc*.zip"/>
      </fileset>
    </delete>

    <zip zipfile="${root}/release/WorkbenchSrc-Build${build.number}.zip">
      <zipfileset dir="${src}" prefix="src">
        <include name="**/*.*"/>
        <exclude name="**/workbench.settings"/>
        <exclude name="**/CVS/*"/>
        <exclude name="**/.cvsignore"/>
        <exclude name="**/.nb*"/>
        <exclude name="**/*.dfPackage"/>
        <exclude name="**/tags"/>
        <exclude name="help/*.*"/>
        <exclude name="**/*.tws"/>
      </zipfileset>
      
      <zipfileset dir="${scriptsrc}" prefix="scripts">
        <include name="build.xml"/>
      </zipfileset>
      
      <zipfileset dir="${doc}" prefix="doc">
        <include name="css/*.*"/>
        <include name="xml/*.*"/>
        <include name="xsl/*.*"/>
        <exclude name="**/CVS/*"/>
        <exclude name="**/.cvsignore"/>
        <exclude name="**/.nb*"/>
        <exclude name="**/tags"/>
        <exclude name="help/*.*"/>
        <exclude name="**/*.tws"/>
      </zipfileset>
      <zipfileset dir="${root}/release" prefix="doc">
        <include name="history.txt"/>
      </zipfileset>
    </zip>
    
  </target>

  <target  name="src" depends="make-src-zip"/>
  <target name="dj" depends="make-dev-jar" />
  
</project>

admin of the day
back to SQLWorkbench homepage
Powered by ViewVC and mgm technology partners GmbH