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