view build.xml @ 36:dabd31807be6 default tip

Add TODO list.
author Mikhail Kryshen <mikhail@kryshen.net>
date Wed, 11 Nov 2009 02:41:59 +0300
parents 3e77076621a8
children
line wrap: on
line source

<?xml version="1.0"?>
<project name="tema" default="dist" basedir=".">
    
    <property name="version"  value="0.3"/>
    
    <property name="src"      value="src"/>
    <property name="build"    value="build"/>
    <property name="dist"     value="dist"/>
    <property name="res"      value="res"/>
    <property name="doc"      value="doc"/>
    <property name="lib"      value="${dist}/lib"/>
    <property name="jar_file" value="tema.jar"/>
    <property name="native_file" value="tema"/>
    <property name="main_class" value="kryshen.tema.Tema"/>
    <property name="task_class" value="kryshen.tema.ant.TemaTask"/>
    
    <property name="ant_jar" value="/usr/share/java/ant.jar"/>
    <property name="gcj" value="gcj"/>
    
    <path id="project.libs">
        <fileset id="project.libs.fileset" dir="${lib}">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    
    <target name="init">
        <tstamp/>
        <mkdir dir="${build}"/>
    </target>
    
    <target name="compile" depends="init">
        <javac srcdir="${src}" destdir="${build}"
               deprecation="on" optimize="on" debug="on"
               target="1.5">
            <compilerarg value="-Xlint:unchecked"/>
            <classpath refid="project.libs"/>
        </javac>
        
        <copy todir="${build}">
            <fileset dir="${res}"/>
        </copy>
    </target>

    <target name="dist" depends="compile">
        <jar jarfile="${dist}/${jar_file}" manifest="${src}/Manifest.mf">
            <fileset dir="${build}" includes="**/*.class"/>
            <fileset dir="${build}" includes="**/*.template"/>
        </jar>
    </target>

    <target name="dist.native" depends="compile">
        <property name="demo_template" value="kryshen/tema/demo/demo.template"/>

        <exec executable="${gcj}">
            <arg value="-c"/>
            <arg value="-o"/>
            <arg value="${build}/${demo_template}.o" />
            <arg value="--resource" />
            <arg value="${demo_template}" />
            <arg value="${build}/${demo_template}" />
        </exec>

        <apply executable="${gcj}" parallel="true">
            <fileset dir="${build}"
                     includes="**/*.class **/*.o"
                     excludes="kryshen/tema/ant/**"/>
            <fileset refid="project.libs.fileset"/>
            <arg value="--main=${main_class}"/>
            <arg value="-o"/>
            <arg value="${dist}/${native_file}"/>
        </apply>
    </target>

    <target name="run" depends="compile">
        <java classname="${main_class}" fork="true">
            <classpath>
                <pathelement location="${build}"/>
                <path refid="project.libs"/>
            </classpath>
        </java>
    </target>
    
    <target name="run.demo" depends="compile">
        <java classname="${main_class}" fork="true">
            <classpath>
                <pathelement location="${build}"/>
                <path refid="project.libs"/>
            </classpath>
            <arg value="-demo"/>
        </java>        
    </target>
    
    <target name="doc.manual" depends="dist">
        <taskdef name="tema"
                 classname="${task_class}"
                 classpath="${dist}/tema.jar"/>
                 
        <tema infile="${doc}/manual/manual.tema"
              outfile="${doc}/manual/manual.html"
              basedir="${doc}/manual"/>
    </target>

    <target name="doc.api" depends="init">
        <javadoc destdir="${doc}/api" sourcepath="${src}"
                 packagenames="kryshen.tema.*">
            <classpath> 
                <path refid="project.libs"/>
                <pathelement location="${ant_jar}"/>
            </classpath>
        </javadoc>
    </target>
    
    <target name="package.tar" depends="dist,doc.manual,doc.api">
        <tar destfile="${dist}/${ant.project.name}-${version}.tar.gz"
             compression="gzip">
            <tarfileset dir="${basedir}"
                        prefix="${ant.project.name}-${version}">
		<exclude name=".hg/**"/>
		<exclude name=".hg*"/>
                <exclude name="${build}/**"/>
                <exclude name="test/**"/>
                <exclude name="nbproject/**"/>
                <exclude name="${dist}/${ant.project.name}-*.tar.gz"/>
                <exclude name="${dist}/tema"/>
                <exclude name="${dist}/tema.sh"/>
            </tarfileset>
            <tarfileset dir="${basedir}"
                        prefix="${ant.project.name}-${version}"
                        mode="755">
                <include name="${dist}/tema.sh"/>
            </tarfileset>
        </tar>
    </target>
    
    <target name="clean" depends="init">
        <delete>
            <fileset dir="${build}" includes="**/*.class"/>
        </delete>
        <delete file="${dist}/${jar_file}"/>
        <delete dir="${doc}/api"/>
    </target>
    
</project>