<?xml version="1.0"?>
<project name='Colorer-take5' default="all" basedir=".">
<description>
This is the top-level buildfile, used by ANT tool (http://jakarta.apache.org/ant/)
It contains tasks, used to build and distribute different versions of
Colorer-take5 library packages.
</description>
<property file='build.properties'/>
<property name='build-dir' value='distr'/>
<property name='distr-version' value='.beta2'/>
<property name='hrcupdate-dir' value='${build-dir}/hrc-update'/>
<property name='library-name' value='Colorer-take5${distr-version}'/>
<property name='library-dir' value='${build-dir}/${library-name}'/>
<property name='library-zip' value='${build-dir}/${library-name}.zip'/>
<property name='farplugin-name' value='FarColorer-take5${distr-version}'/>
<property name='farplugin-dir' value='${build-dir}/${farplugin-name}'/>
<property name='farplugin-zip' value='${build-dir}/${farplugin-name}.zip'/>
<property name='eclipseplugin-version' value='_0.5.0'/>
<property name='eclipseplugin-name' value='EclipseColorer-take5${eclipseplugin-version}'/>
<property name='eclipsedir-name' value='net.sf.colorer${eclipseplugin-version}'/>
<property name='eclipseplugin-dir' value='${build-dir}/${eclipseplugin-name}/${eclipsedir-name}'/>
<property name='eclipseplugin-zip' value='${build-dir}/${eclipseplugin-name}.zip'/>
<xmlcatalog id="DTDs">
<dtd publicid="-//Cail Lomecb//DTD Colorer HRC take5//EN"
location="doc/2003/hrc.dtd"/>
<dtd publicid="-//Cail Lomecb//DTD Colorer HRD take5//EN"
location="doc/2003/hrd.dtd"/>
<dtd publicid="-//Cail Lomecb//DTD Colorer CATALOG take5//EN"
location="doc/2003/catalog.dtd"/>
</xmlcatalog>
<target name="init">
<condition property='make' value='${vc.make}'><equals arg1='${platform}' arg2='vc'/></condition>
<condition property='makefile' value='${vc.makefile}'><equals arg1='${platform}' arg2='vc'/></condition>
<condition property='make' value='${bcc.make}'><equals arg1='${platform}' arg2='bcc'/></condition>
<condition property='makefile' value='${bcc.makefile}'><equals arg1='${platform}' arg2='bcc'/></condition>
<condition property='make' value='${cygwin.make}'><equals arg1='${platform}' arg2='cygwin'/></condition>
<condition property='makefile' value='${cygwin.makefile}'><equals arg1='${platform}' arg2='cygwin'/></condition>
<condition property='make' value='${gcc.make}'><equals arg1='${platform}' arg2='gcc'/></condition>
<condition property='makefile' value='${gcc.makefile}'><equals arg1='${platform}' arg2='gcc'/></condition>
<condition property='make' value='${macos.make}'><equals arg1='${platform}' arg2='macos'/></condition>
<condition property='makefile' value='${macos.makefile}'><equals arg1='${platform}' arg2='macos'/></condition>
<fail unless='make'>
No 'platform' property was specified. Use
ant -Dplatform=[vc|bcc|cygwin|gcc|macos]
</fail>
<property name='add.excludes' value='**/*.ilc, **/*.ild,
**/*.ilf, **/*.ils, **/*.tds,, **/*.map
**/colorer/colorer.exe, **/colorer/colorer
'/>
<uptodate property="doc.javadoc.required" targetfile="doc/java/package-list">
<srcfiles dir= "src/net.sf.colorer/src" includes="**/*.java, **/*.html"/>
</uptodate>
<uptodate property="doc.doxygen.required" targetfile="doc/api/index.html">
<srcfiles dir= "src" includes="**/*.h, **/*.cpp, **/colorer.doxygen.cfg, **/*.html"/>
</uptodate>
</target>
<target name="all" depends='init' description='Builds all available packages: library, farplugin and eclipseplugin'>
<splash/>
<antcall target='library'/>
<antcall target='farplugin'/>
<antcall target='eclipseplugin'/>
</target>
<target name="clean" depends='library.clean, farplugin.clean, eclipseplugin.clean, hrcupdate.clean, doc.clean'
description='Cleans all the temporary files'>
<delete dir='${build-dir}'/>
</target>
<target name="make.clean">
<exec dir='${make.dir}' executable='${make}'>
<arg line='${makefile}'/>
<arg line='clear'/>
<env key='Path' path='${native-path}:${java.library.path}'/>
</exec>
</target>
<target name='install' depends='init' description='Installs Colorer-take5 Library'>
</target>
<target name="doc.clean">
<delete file='src\shared\colorer_doc\warn_out'/>
<ant dir='doc/hrc-ref' antfile='build.xml' target='clean'/>
<delete dir='doc/api'/>
<delete dir='doc/java'/>
</target>
<target name="doc.hrc-ref" depends='init'>
<ant dir='doc/hrc-ref' antfile='build.xml' target='all'/>
</target>
<target name="doc" depends='init, doc.javadoc, doc.doxygen, doc.hrc-ref' description='Builds all the documentation files'>
</target>
<target name="doc.javadoc" depends='init' description='Generates Java classes documentation' unless='doc.javadoc.required'>
<ant dir='src/net.sf.colorer' antfile='javadoc.xml' target='javadoc'>
<property name='doc-dir' value='../../doc/java'/>
</ant>
</target>
<target name="doc.doxygen" depends='init' description='Generates C++ classes documentation' unless='doc.doxygen.required'>
<exec dir='src/shared/colorer_doc' executable='${doxygen}'>
<arg value='colorer.doxygen.cfg'/>
</exec>
</target>
<target name="xsd2hrc.distr" depends='init' description='Generates all required HRC files from their XML Schemas'>
<ant dir='bin/xsd2hrc' antfile='build.xml' target='distr'/>
</target>
<target name="hrc.jar" depends='xsd2hrc.distr'>
<mkdir dir='${target-dir}/hrc/auto/types'/>
<zip destfile='${target-dir}/hrc/common.jar'>
<fileset dir='hrc' includes='**/*' excludes='changes.txt, colorer.hrc, auto, auto/**/*'/>
</zip>
<copy file='hrc/colorer.hrc' tofile='${target-dir}/hrc/colorer.hrc'>
<filterset begintoken='l' endtoken='"'>
<filter token='ink=' value='link="jar:common.jar!'/>
</filterset>
</copy>
<zip destfile='${target-dir}/hrc/auto/types/auto.jar'>
<fileset dir='hrc/auto' includes='gen/**/*, qrm/**/*, types/**/*'/>
</zip>
<copy todir='${target-dir}/hrc/auto'>
<fileset dir='hrc/auto' includes='*.hrc'/>
<filterset begintoken='l' endtoken='"'>
<filter token='ink=' value='link="jar:types/auto.jar!'/>
</filterset>
</copy>
</target>
<target name="hrcupdate.clean">
<delete><fileset dir='${build-dir}/..' includes='hrc-update*'/></delete>
<delete dir='${hrcupdate-dir}'/>
</target>
<target name="hrcupdate" depends='init' description='Builds a package of the current HRC base'>
<tstamp><format property="TODAY" pattern="yyyy-MM-dd"/></tstamp>
<property name='hrcupdate-zip' value='${build-dir}/hrc-update.${TODAY}.zip'/>
<mkdir dir='${hrcupdate-dir}/hrc'/>
<antcall target='hrc.jar'>
<param name='target-dir' value='${hrcupdate-dir}'/>
</antcall>
<copy file='hrc/changes.txt' todir='${hrcupdate-dir}'/>
<zip destfile='${hrcupdate-zip}'>
<fileset dir='${hrcupdate-dir}'/>
</zip>
</target>
<target name="library.clean">
<delete dir='${library-dir}'/>
<delete file='${library-zip}'/>
<antcall target='make.clean'>
<param name='make.dir' value='src/colorer'/>
</antcall>
</target>
<target name="library" depends='init, doc, xsd2hrc.distr' description='Builds Colorer-take5 Library source distribution package'>
<mkdir dir='${library-dir}'/>
<exec dir='src/colorer' executable='${make}' failonerror='true'>
<arg line='${makefile}'/>
<env key='Path' path='${native-path}:${java.library.path}'/>
<env key='LIB' path='${native-libs}'/>
</exec>
<condition property="lib">
<or>
<available filepath="src/colorer" file="colorer.exe"/>
<available filepath="src/colorer" file="colorer"/>
</or>
</condition>
<fail unless='lib' message='Native executable library was not compiled'/>
<copy todir="${library-dir}/bin">
<fileset dir="src/colorer" includes="colorer.exe,colorer"/>
<fileset dir="bin" includes="**"/>
</copy>
<copy todir="${library-dir}">
<fileset dir="." includes="hrc/**, hrd/**, src/**" excludes='**/*.obj, **/*.lib, **/*.map, **/*.log, ${add.excludes}'/>
<fileset dir="." includes="doc/**" excludes='**/*.log'/>
</copy>
<copy todir='${library-dir}' includeemptydirs='false'>
<fileset dir='.' includes='*' excludes='*.log'/>
</copy>
<zip destfile='${library-zip}'>
<fileset dir='${build-dir}' includes='${library-name}/**'/>
</zip>
</target>
<target name="eclipseplugin.clean">
<delete dir='${eclipseplugin-dir}'/>
<delete file='${eclipseplugin-zip}'/>
<ant dir='src/net.sf.colorer' antfile='build.xml' target='clean'>
<property name='temp.folder' value='../../${build-dir}/${eclipseplugin-name}'/>
</ant>
<antcall target='make.clean'>
<param name='make.dir' value='src/net.sf.colorer/libnative'/>
</antcall>
</target>
<target name="eclipseplugin" depends='init' description='Eclipse plugin package'>
<mkdir dir='${eclipseplugin-dir}'/>
<exec dir='src/net.sf.colorer/libnative' executable='${make}' failonerror='true'>
<arg line='${makefile}'/>
<env key='Path' path='${native-path}:${java.library.path}'/>
</exec>
<ant dir='src/net.sf.colorer' antfile='build.xml' target='gather'>
<property name='temp.folder' value='../../${build-dir}/${eclipseplugin-name}'/>
</ant>
<condition property="lib">
<or>
<available filepath="src/net.sf.colorer/libnative" file="net_sf_colorer.dll"/>
<available filepath="src/net.sf.colorer/libnative" file="libnet_sf_colorer.so"/>
<available filepath="src/net.sf.colorer/libnative" file="libnet_sf_colorer.jnilib"/>
</or>
</condition>
<fail unless='lib' message='Native library was not compiled'/>
<mkdir dir="${eclipseplugin-dir}/os/win32/x86"/>
<mkdir dir="${eclipseplugin-dir}/os/linux/x86"/>
<mkdir dir="${eclipseplugin-dir}/os/macosx/ppc"/>
<copy todir="${eclipseplugin-dir}/os/win32/x86">
<fileset dir="src/net.sf.colorer/libnative" includes="net_sf_colorer.dll"/>
</copy>
<copy todir="${eclipseplugin-dir}/os/linux/x86">
<fileset dir="src/net.sf.colorer/libnative" includes="libnet_sf_colorer.so"/>
</copy>
<copy todir="${eclipseplugin-dir}/os/macosx/ppc">
<fileset dir="src/net.sf.colorer/libnative" includes="libnet_sf_colorer.jnilib"/>
</copy>
<mkdir dir='${eclipseplugin-dir}/colorer'/>
<antcall target='hrc.jar'>
<param name='target-dir' value='${eclipseplugin-dir}/colorer'/>
</antcall>
<mkdir dir='${eclipseplugin-dir}/colorer/hrd/rgb'/>
<copy todir='${eclipseplugin-dir}/colorer/hrd/rgb'>
<fileset dir='hrd/rgb' includes='**'/>
</copy>
<copy todir='${eclipseplugin-dir}/colorer'>
<fileset dir='.' includes='README,catalog-eclipse.xml'/>
</copy>
<move file='${eclipseplugin-dir}/colorer/catalog-eclipse.xml' tofile='${eclipseplugin-dir}/colorer/catalog.xml'/>
<copy todir='${eclipseplugin-dir}'>
<fileset dir='.' includes='LICENSE'/>
</copy>
<zip destfile='${eclipseplugin-zip}'>
<fileset dir='${build-dir}/${eclipseplugin-name}'/>
</zip>
</target>
<target name="farplugin.clean">
<delete dir='${farplugin-dir}'/>
<delete file='${farplugin-zip}'/>
<antcall target='make.clean'>
<param name='make.dir' value='src/pcolorer'/>
</antcall>
</target>
<target name="farplugin" depends='init' description='Builds FarColorer distribution package'>
<condition property="system">
<os family='windows'/>
</condition>
<fail unless='system' message='FarColorer plugin is available only on Windows system'/>
<mkdir dir='${farplugin-dir}/bin'/>
<exec dir='src/pcolorer' executable='${make}' failonerror='true'>
<arg line='${makefile}'/>
<env key='Path' path='${native-path}:${java.library.path}'/>
</exec>
<available property='lib' file='src/pcolorer/colorer.dll'/>
<fail unless='lib' message='FarColorer plugin was not compiled'/>
<copy todir='${farplugin-dir}/bin'>
<fileset dir='bin/farplugin' includes='coloree.hlf,coloree.lng,colorer.hlf,colorer.lng,shortcuts.reg'/>
<fileset dir='src/pcolorer' includes='colorer.dll'/><!-- colorer.map -->
</copy>
<mkdir dir='${farplugin-dir}/hrd/console'/>
<copy todir='${farplugin-dir}/hrd/console'>
<fileset dir='hrd/console' includes='**'/>
</copy>
<copy todir='${farplugin-dir}'>
<fileset dir='.' includes='LICENSE,README,catalog-far.xml'/>
</copy>
<move file='${farplugin-dir}/catalog-far.xml' tofile='${farplugin-dir}/catalog.xml'/>
<antcall target='hrc.jar'>
<param name='target-dir' value='${farplugin-dir}'/>
</antcall>
<zip destfile='${farplugin-zip}'>
<fileset dir='${farplugin-dir}'/>
</zip>
</target>
</project>