build.xml
author cli
Sun, 29 Aug 2010 17:28:58 +0200
changeset 35 ed84c8bdd87b
parent 32 3af4237e4a15
child 36 c404a87db5b7
permissions -rw-r--r--
Moving source files into src/-subdir.
bei@32
     1
<?xml version="1.0" encoding="UTF-8"?>
bei@32
     2
<project name="sonews" default="main" basedir=".">
bei@32
     3
bei@32
     4
    <property name="prj" value="."/>
bei@32
     5
    <property name="out" value="build"/>
bei@32
     6
    <property name="build.dir" value="${out}"/>
bei@32
     7
    <property name="inst.dir" value="/opt/sonews/sonews-1.1"/>
bei@32
     8
    <property name="build.class" value="${build.dir}/class"/>
bei@32
     9
bei@32
    10
    <!-- define how to handle CLASSPATH environment -->
bei@32
    11
    <property name="build.sysclasspath" value="ignore"/>
bei@32
    12
bei@32
    13
    <!-- set "modern" java compiler -->
bei@32
    14
    <property name="build.compiler" value="modern"/>
bei@32
    15
bei@32
    16
    <!-- set wether we want to compile with debug information -->
bei@32
    17
    <property name="debug" value="on"/>
bei@32
    18
bei@32
    19
    <!-- set wether we want to compile with optimisation -->
bei@32
    20
    <property name="optimize" value="off"/>
bei@32
    21
bei@32
    22
    <!-- set wether we want to compile with or without deprecation -->
bei@32
    23
    <property name="deprecation" value="on"/>
bei@32
    24
bei@32
    25
bei@32
    26
    <!-- classpath settings for compile and javadoc tasks -->
bei@32
    27
    <path id="classpath">
bei@32
    28
        <pathelement location="${build.class}"/>
bei@32
    29
        <pathelement location="lib/glassfish-mail.jar"/>
bei@32
    30
        <pathelement location="lib/mysql-connector-java.jar"/>
bei@32
    31
        <pathelement location="lib/junit-4.8.2.jar"/>
bei@32
    32
    </path>
bei@32
    33
bei@32
    34
bei@32
    35
bei@32
    36
    <!-- the main target, called in recursive builds -->
bei@32
    37
    <target name="main" depends="prepare,compile,jar"/>
bei@32
    38
bei@32
    39
    <!-- prepare output directories - -->
bei@32
    40
    <target name="prepare">
bei@32
    41
        <mkdir dir="${build.dir}"/>
bei@32
    42
        <mkdir dir="${build.class}"/>
bei@32
    43
    </target>
bei@32
    44
bei@32
    45
bei@32
    46
    <target name="compile" depends="prepare">
bei@32
    47
	<javac destdir="${build.class}"
bei@32
    48
               debug="${debug}"
bei@32
    49
               deprecation="${deprecation}"
bei@32
    50
               optimize="${optimize}"
bei@32
    51
               classpathref="classpath">
bei@32
    52
            <src path="."/>
bei@32
    53
                <include name="org/sonews/**/*.java"/>
bei@32
    54
	</javac>
bei@32
    55
	<javac destdir="${build.class}"
bei@32
    56
               debug="${debug}"
bei@32
    57
               deprecation="${deprecation}"
bei@32
    58
               optimize="${optimize}"
bei@32
    59
               classpathref="classpath">
bei@32
    60
            <src path="."/>
bei@32
    61
                <include name="test/**/*java"/>
bei@32
    62
	</javac>
bei@32
    63
    </target>
bei@32
    64
	
bei@32
    65
    <!-- create jar file -->
bei@32
    66
    <target name="jar" depends="prepare,compile"> 
bei@32
    67
        <jar jarfile="${build.dir}/sonews.jar"
bei@32
    68
             basedir="${build.class}">
bei@32
    69
            <include name="org/sonews/**/*.class"/>
bei@32
    70
        </jar>
bei@32
    71
        <jar jarfile="${build.dir}/test.jar"
bei@32
    72
             basedir="${build.class}">
bei@32
    73
            <include name="test/**/*.class"/>
bei@32
    74
        </jar>
bei@32
    75
        <jar jarfile="${build.dir}/sonews-helpers.jar"
bei@32
    76
             basedir=".">
bei@32
    77
            <include name="helpers/**/*"/>
bei@32
    78
        </jar>
bei@32
    79
    </target>
bei@32
    80
bei@32
    81
    <target name="install" depends="jar">
bei@32
    82
        <mkdir dir="${inst.dir}/lib"/>
bei@32
    83
        <mkdir dir="${inst.dir}/bin"/>
bei@32
    84
        <mkdir dir="${inst.dir}/helpers"/>
bei@32
    85
        <copy todir="${inst.dir}/lib">
bei@32
    86
             <fileset dir="lib">
bei@32
    87
		<include name="*.jar"/>	
bei@32
    88
             </fileset>
bei@32
    89
             <fileset dir="${build.dir}">
bei@32
    90
		<include name="*.jar"/>	
bei@32
    91
             </fileset>
bei@32
    92
        </copy>
bei@32
    93
        <copy todir="${inst.dir}/bin">
bei@32
    94
             <fileset dir="bin">
bei@32
    95
		<include name="*.sh"/>	
bei@32
    96
             </fileset>
bei@32
    97
        </copy>
bei@32
    98
        <chmod perm="755">
bei@32
    99
             <fileset dir="${inst.dir}/bin">
bei@32
   100
		<include name="*.sh"/>	
bei@32
   101
             </fileset>
bei@32
   102
        </chmod>
bei@32
   103
        <copy todir="${inst.dir}/helpers">
bei@32
   104
             <fileset dir="helpers">
bei@32
   105
		<include name="*"/>	
bei@32
   106
             </fileset>
bei@32
   107
        </copy>
bei@32
   108
    </target>
bei@32
   109
bei@32
   110
    <!-- clean up -->
bei@32
   111
    <target name="clean" depends="prepare">
bei@32
   112
        <delete includeEmptyDirs="true">
bei@32
   113
            <fileset dir="${build.class}">
bei@32
   114
                <patternset>
bei@32
   115
                    <include name="**/*.class"/>
bei@32
   116
                    <include name="**/*.properties"/>
bei@32
   117
                </patternset>
bei@32
   118
            </fileset>
bei@32
   119
            <fileset dir="${build.dir}">
bei@32
   120
                <patternset>
bei@32
   121
                    <include name="**/*.jar"/>
bei@32
   122
                </patternset>
bei@32
   123
            </fileset>
bei@32
   124
	</delete>
bei@32
   125
    </target>
bei@32
   126
</project>