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
|
# directories
build.dir=${basedir}/build
dist.dir=${basedir}/build/dist
class.dir=${build.dir}/classes
src.dir=${basedir}/src
conf.dir=${src.dir}/conf
java.dir=${src.dir}/java
xsd.dir=${src.dir}/xsd
gen.dir=${build.dir}/generated
# targets
target.name=${ant.project.name}
target.type=jar
target.jar.main=net.easyvox.generik.server.WebCall
target.java.version=javac1.1
javac.classic.executable.path=C:/Program Files/Java/jrockit-R27.4.0-jdk1.5.0_12/bin/javac
<project name="bandeau" basedir=".." default="usage">
<property environment="env" />
<property file="${basedir}/bin/build.properties" />
<!-- sets the condition target.prehistoric if the target JVM is 1.1 -->
<condition property="target.prehistoric" value="true" else="false">
<equals arg1="${target.java.version}" arg2="javac1.1" />
</condition>
<!-- sets the source directory to gen.dir if prehistoric -->
<condition property="source.dir" value="${gen.dir}" else="${java.dir}">
<equals arg1="${target.prehistoric}" arg2="true" />
</condition>
<!--
sets the javac path to the classic compiler if prehistoric,
the default one (JAVA_HOME) otherwise
-->
<condition property="javac.to.use" value="${javac.classic.executable.path}" else="${env.JAVA_HOME}/bin/javac">
<equals arg1="${target.prehistoric}" arg2="true" />
</condition>
<!-- prints out usage -->
<target name="usage">
<echo message="* Webcall build tasks *" />
<echo message="> usage : shows this message" />
<echo message="> build.jar : compiles classes and builds the target jar" />
<echo message="> build.all : sequences all build tasks above" />
</target>
<!-- main tasks -->
<target name="build.all">
<echo message="* BUILDING BANDEAU JAR" />
<echo message="* prehistoric build mode : ${target.prehistoric}"/>
<echo message="* using compiler : ${javac.to.use}" />
<antcall target="check" />
<antcall target="init" />
<antcall target="build.flatten" />
<antcall target="build.jar" />
</target>
<target name="init">
<delete dir="${dist.dir}" />
<delete dir="${build.dir}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${class.dir}" />
<mkdir dir="${gen.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!--
checks conditions
-->
<target name="check">
<fail message="system property JAVA_HOME is not set or invalid !!!">
<condition>
<and>
<equals arg1="${target.prehistoric}" arg2="false" />
<available file="${env.JAVA_HOME}" type="file" />
</and>
</condition>
</fail>
<fail message="the property javac.classic.executable.path must be set (and valid :-) in the ${basedir}/bin/build.properties property file if using the prehistoric build">
<condition>
<and>
<equals arg1="${target.prehistoric}" arg2="true" />
<available file="${javac.classic.executable.path}" type="file" />
</and>
</condition>
</fail>
</target>
<!--
removes packages and flattens code
for use with ie and jdk1.1.4 (sic!)
-->
<target name="build.flatten" if="target.prehistoric">
<!--
copy source files in the ${gen.dir},
flattening dir structure
-->
<copy todir="${gen.dir}">
<flattenmapper />
<fileset dir="${java.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<!--
comments out all package declaration
and all internal imports
-->
<replace dir="${gen.dir}"
token="import com.bandeau."
value="// import com.bandeau.">
<include name="**/*.java" />
</replace>
<replace dir="${gen.dir}"
token="package com.bandeau."
value="// package com.bandeau.">
<include name="**/*.java" />
</replace>
</target>
<target name="build.jar">
<!-- java build classpath -->
<path id="java.classpath">
</path>
<!-- compile classes -->
<javac classpathref="java.classpath"
srcdir="${source.dir}"
destdir="${class.dir}"
compiler="${target.java.version}"
target="1.1"
debug="true"
includes="**/*.java"
excludes="**/CVS/*,**/tests/*"
fork="true"
executable="${javac.to.use}" />
<!-- build jar -->
<jar destfile="${dist.dir}/${target.name}.${target.type}" compress="false">
<!-- includes classes -->
<fileset dir="${class.dir}">
<include name="**/*.class" />
</fileset>
<!-- includes conf files -->
<fileset dir="${conf.dir}">
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
<!-- includes images -->
<fileset dir="${src.dir}">
<include name="images/*.*" />
</fileset>
<!-- manifest file -->
<manifest>
<attribute name="Built-By" value="${user.name}" />
</manifest>
</jar>
</target>
</project> |
Partager