1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
| <?xml version="1.0" encoding="UTF-8" ?>
<project name="jdv" default="execute" basedir=".">
<!-- ================================================
-->
<!-- The project description
-->
<!-- ================================================
-->
<description>Ant Makefile for ${ant.project.name}</description>
<!-- ================================================
-->
<!-- Some variable definition
-->
<!-- ================================================
-->
<property environment="env" />
<property file="build.properties" />
<property name="src" value="${basedir}/src" />
<property name="bin" value="${basedir}/bin" />
<property name="build" value="${basedir}/build" />
<property name="tests" value="${basedir}/check" />
<property name="doc" value="${basedir}/doc" />
<property name="binary" value="${basedir}/jdv.jar" />
<property name="proj_fullname" value="${login}-${proj}" />
<property name="tarball" value="${basedir}/${proj_fullname}.${extension}" />
<property name="classpath" value="${basedir}/.classpath" />
<!-- ================================================
-->
<!-- Condition
-->
<!-- ================================================
-->
<available file="${basedir}/AUTHORS" property="authors.exists" />
<available file="${basedir}/TODO" property="todo.exists" />
<available file="${basedir}/README" property="readme.exists" />
<condition property="isUnix">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<condition property="isWin">
<os family="windows" />
</condition>
<condition property="isMac">
<os family="mac" />
</condition>
<!-- ================================================
-->
<!-- Custom classpath definition
-->
<!-- ================================================
-->
<path id="custom.classpath">
<pathelement location="${src}" />
<pathelement location="${build}" />
<pathelement location="${java.class.path}" />
</path>
<!-- ================================================
-->
<!-- Custom properties
-->
<!-- ================================================
-->
<target name="initMac" description="Initialize Mac system" if="isMac">
<property name="shell" value="sh" />
<property name="exec-option" value="-c" />
<!-- <property name="argNeededForMAC" value="-XstartOnFirstThread" />
-->
<property name="jar" value="jar" />
</target>
<target name="initWindows" description="Initialize Windows system" if="isWin">
<property name="shell" value="cmd.exe" />
<property name="exec-option" value="/c" />
<property name="argNeededForMAC" value="" />
<property name="jar" value="jar" />
</target>
<target name="initUnix" description="Initialize Unix system" if="isUnix">
<property name="shell" value="sh" />
<property name="exec-option" value="-c" />
<property name="jar" value="/usr/local/linux-sun-jdk1.6.0/bin/jar" />
<property name="argNeededForMAC" value="" />
</target>
<target name="checkAUTHORS" description="Check if AUTHORS is present" unless="authors.exists">
<fail message="You must have an AUTHORS file !" />
</target>
<target name="checkTODO" description="Check if TODO is present" unless="todo.exists">
<fail message="You must have a TODO file !" />
</target>
<target name="checkREADME" description="Check if README is present" unless="readme.exists">
<fail message="You must have a README file !" />
</target>
<!-- ================================================
-->
<!-- Initialization: create needed directories
-->
<!-- ================================================
-->
<target name="init" depends="clean, initMac, initWindows, initUnix" description="Construct needed directories">
<echo message="=== Initialization ===" />
<mkdir dir="${build}" />
<mkdir dir="${doc}" />
<echo file="${basedir}/AUTHORS" append="false" message="* ${login}${line.separator}" />
<echo message="Successfully created all needed directories !" />
</target>
<!-- ================================================
-->
<!-- Compile our project
-->
<!-- ================================================
-->
<target name="compile" depends="init" description="Compile sources">
<echo message="=== Compilation of ${src} ===" />
<javac srcdir="${src}" destdir="${build}" debug="on" deprecation="on" optimize="off" fork="yes" verbose="yes">
<classpath>
<path refid="custom.classpath" />
</classpath>
<include name="${main.class}.java" />
<include name="**/*.java" />
</javac>
<echo message="Successfully compiled in ${build} !" />
</target>
<!-- ================================================
-->
<!-- Create the jarfile
-->
<!-- ================================================
-->
<target name="jar" depends="compile" description="Create the tarball">
<delete file="${binary}" />
<echo message="=== Creating the jar file ===" />
<jar jarfile="${binary}" basedir="${build}">
<fileset dir="${build}" includes="*/**" />
<manifest>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Built-By" value="${login}" />
<attribute name="Specification-Title" value="${proj}" />
</manifest>
</jar>
<echo message="Successfully created the ${binary} jarfile !" />
</target>
<!-- ================================================
-->
<!-- Execute the project
-->
<!-- ================================================
-->
<target name="execute" description="Execute the project">
<echo message="=== Execution ===" />
<java jar="${binary}" fork="true" />
<echo message="Execution terminated !" />
</target>
<!-- ================================================
-->
<!-- Clean the main folder
-->
<!-- ================================================
-->
<target name="cleanMain" description="Clean the main directory">
<echo message="=== Cleaning main directory ===" />
<delete dir="${build}" failonerror="false" />
<echo message="Main directory successfully cleaned !" />
</target>
<!-- ================================================
-->
<!-- Clean the project
-->
<!-- ================================================
-->
<target name="clean" depends="cleanMain" description="Clean all generated directory">
<echo message="=== Cleaning project ===" />
<delete>
<fileset dir="${basedir}" includes="**/*~" />
<fileset dir="${basedir}" includes="**/*.class" />
<fileset dir="${basedir}" includes="**/*.tmp" />
<fileset dir="${basedir}" includes="**/*.log" />
</delete>
<echo message="Project successfully cleaned !" />
</target>
<!-- ================================================
-->
<!-- Clean the project and delete executable
-->
<!-- ================================================
-->
<target name="distclean" depends="clean" description="Clean binary and directory">
<echo message="=== Distcleaning project ===" />
<delete file="${binary}" failonerror="false" />
<delete dir="${doc}" failonerror="false" />
<delete dir="${bin}" failonerror="false" />
<delete dir="${build}" failonerror="false" />
<delete dir="${plugin}" failonerror="false" />
<delete>
<fileset dir="${basedir}" includes="**/*.tar" />
<fileset dir="${basedir}" includes="**/*.gz" />
<fileset dir="${basedir}" includes="**/*.tgz" />
<fileset dir="${basedir}" includes="**/*.bz2" />
<fileset dir="${basedir}" includes="**/*.zip" />
<fileset dir="${basedir}" includes="**/*.rar" />
</delete>
<echo message="Project successfully distcleaned !" />
</target>
<!-- ================================================
-->
<!-- Generate the JavaDoc documentation
-->
<!-- ================================================
-->
<target name="doc" description="Generate documentation">
<echo message="=== Creating javadoc documentation ===" />
<javadoc sourcepath="${src}" destdir="${doc}">
<fileset dir="${src}" defaultexcludes="yes">
<include name="**" />
</fileset>
</javadoc>
<echo message="Javadoc documentation created in ${doc} !" />
</target>
<!-- ================================================
-->
<!-- Create the tarball
-->
<!-- ================================================
-->
<target name="dist" depends="distclean" description="Create the tarball">
<tar longfile="gnu" destfile="${tarball}" compression="${compression.mode}">
<tarfileset dir="${basedir}" mode="700" username="${login}" prefix="${proj_fullname}/">
<include name="**/*" />
<exclude name=".*" />
<exclude name="**/.svn" />
<exclude name="**/*.gz" />
<exclude name="**/*.bz2" />
<exclude name="**/*.tgz" />
<exclude name="**/*.tar" />
<exclude name="**/*.zip" />
<exclude name="**/*.rar" />
</tarfileset>
</tar>
</target>
<!-- ================================================
-->
<!-- Create the tarball (alias of dist)
-->
<!-- ================================================
-->
<target name="tar" depends="dist" description="Create the tarball" />
<!-- ================================================
-->
<!-- Custom classpath definition
-->
<!-- ================================================
-->
<path id="custom.classpath">
<pathelement location="${src}" />
<pathelement location="${build}" />
<pathelement location="${java.class.path}" />
</path>
<!-- ================================================
-->
<!-- Create dir check and compile tests
-->
<!-- ================================================
-->
<target name="compile-test">
<mkdir dir="classes.dir" />
<javac srcdir="${tests}" destdir="classes.dir" />
</target>
</project> |
Partager