blob: 0c98e245d10f1e6ba9a9f1bab5988ace8273498c [file] [log] [blame]
<?xml version="1.0"?>
<!-- ============= [build file for ANT v1.5.x] ====================== -->
<!DOCTYPE project
[
<!ENTITY dependencies SYSTEM "dependencies.xml" >
]>
<project name="emma" default="build" basedir="." >
<!-- $Id: build.xml,v 1.2.2.3 2005/06/13 00:20:55 vlad_r Exp $ -->
<property name="app.short.name" value="${ant.project.name}" />
<property name="app.project.start.date" value="2001/02/01" />
<!-- TODO: build log -->
<!-- ============================================================== -->
<!-- pull in the OS environment variables; an OS env variable VAR can be used as ${env.VAR}: -->
<property environment="env" />
<!-- ============================================================== -->
<!-- build branch properties and local customization overrides: -->
<!-- first, load the official build settings file: -->
<property file="build.properties" />
<!-- next, load the CVS-versioned release/branch properties file: -->
<property file="release.properties" />
<!-- next, load an optional global properties file: -->
<property file="${env.ANT_BLDENV}/ant.properties" />
<!-- ============================================================== -->
<!-- global compiler settings: -->
<property name="build.debug" value="on" /> <!-- default for a release build is "on" -->
<property name="build.deprecation" value="off" />
<property name="build.compiler" value="modern" />
<property name="build.sysclasspath" value="ignore" />
<property name="build.target" value="1.2" /> <!-- all .class files are stamped as compatible with 1.2 JVMs: -->
<!-- ============================================================== -->
<!-- main/default build target: -->
<target name="build" depends="dist"
description="-> full build [without 'clean']"
/>
<!-- helper build subtargets: -->
<target name="build.core.compile" depends="core.compile"
description="-> re-compiles updated core sources [no 'clean']"
/>
<target name="build.core.package" depends="core.package"
description="-> re-packages core classes [no 'clean']"
/>
<!-- build modifier targets: -->
<target name="official"
description="-> switches 'build' into official, CVS-aware mode" >
<property name="build.is.official" value="yes" />
</target>
<target name="release"
description="-> [RELEASE]" >
<property name="build.is.on.a.branch" value="yes" />
<property name="app.build.release.tag" value="" /> <!-- no tag means official release -->
<property name="file.release.prefix" value="" />
<property name="cvs.ready.label.prefix" value="RELEASE" />
</target>
<target name="stable"
description="-> [STABLE]" >
<property name="app.build.release.tag" value=" (stable)" />
<property name="file.release.prefix" value="-stable" />
<property name="cvs.ready.label.prefix" value="STABLE" />
</target>
<!-- ============================================================== -->
<!-- init targets: -->
<!-- ============================================================== -->
<!-- static (checked-in) build structure: -->
<property file="module.dirs.properties" />
<!-- work (created by the build) build structure: -->
<property file="work.dirs.properties" />
<target name="init.work.dirs" >
<mkdir dir="${out.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${release.dir}" />
<mkdir dir="${temp.dir}" />
<mkdir dir="${tools.classes.out.dir}" />
<mkdir dir="${core.classes.out.dir}" />
<mkdir dir="${core.srcgen.out.dir}" />
<mkdir dir="${core.res.out.dir}" />
<mkdir dir="${ant.classes.out.dir}" />
</target>
<target name="init" depends="init.work.dirs">
<!-- NOTE: the official build machine sets these explicitly,
these unofficial defaults are provided for private builds only: -->
<property name="build.target.j2se.14.home" value="${java.home}" />
<property name="build.target.j2se.12.home" value="${build.target.j2se.14.home}" />
<property name="build.target.j2se.13.home" value="${build.target.j2se.14.home}" />
<property name="build.target.ant.15.home" value="${env.ANT_HOME}" />
<property name="build.target.ant.14.home" value="${build.target.ant.15.home}" />
<!-- verify that we have J2SE 1.4+: -->
<available property="j2se.is.14+" classname="java.lang.CharSequence" />
<fail unless="j2se.is.14+">location [${build.target.j2se.14.home}] does not specify J2SE 1.4+</fail>
<available file="${temp.dir}/.ready.build.stamp" type="file" property="build.is.dirty" value="yes" />
<!-- include dependencies.xml (a dynamic include by design): -->
&dependencies;
<echo message="ANT version: ${ant.version}" />
<echo message="JDK version: ${ant.java.version}" />
<echo message="build debug flag: ${build.debug}" />
</target>
<!-- ============================================================== -->
<!-- support targets: -->
<!-- ============================================================== -->
<target name="clean" depends="clean.out, clean.dist" description="-> complete clean (output + distribution)" />
<target name="clean.out" description="-> output clean" >
<delete dir="${out.dir}" />
</target>
<target name="clean.dist" description="-> distribution clean" >
<delete dir="${dist.dir}"/>
<delete dir="${release.dir}"/>
</target>
<target name="timestamp" depends="init, -timestamp.1, -timestamp.2, -timestamp.3, -timestamp.4, -timestamp.5">
</target>
<target name="-timestamp.1" depends="init" unless="build.is.dirty" >
<java classname="com.vladium.util.version.VersionStampTool"
classpathref="lib.internal.classpath"
output="${temp.dir}/.ready.build.stamp"
append="no"
>
<arg value="-start" />
<arg value="${app.project.start.date}" />
<arg value="-format" />
<arg value="~F~" />
</java>
<java classname="com.vladium.util.version.VersionStampTool"
classpathref="lib.internal.classpath"
output="${temp.dir}/timestamp.properties"
append="no"
>
<arg value="-start" />
<arg value="${app.project.start.date}" />
<arg value="-fend" />
<arg value="${temp.dir}/.ready.build.stamp" />
<arg value="-format" />
<arg value="app.build.id=${app.build.id.format}\napp.build.date=${app.build.date.format}" />
</java>
<!-- TODO: this is ugly and breaks private builds (constant appending is bad any way): -->
<!-- <echo message="file.release.prefix=${file.release.prefix}" file="${temp.dir}/timestamp.properties" append="yes" /> -->
</target>
<target name="-timestamp.2" depends="init" >
<property file="${temp.dir}/timestamp.properties" />
<!-- private/Eclipse build defaults: -->
<property name="app.build.release.tag" value=" (unsupported private build)" />
<property name="app.bug.report.link" value="this private build is unsupported" />
<property name="file.release.prefix" value="-private" />
<property name="file.release.label" value="${app.major.version}.${app.minor.version}.${app.build.id}" />
<echo message="build id: ${file.release.label}${app.build.release.tag}" />
</target>
<target name="-timestamp.2a" depends="init" if="build.is.on.a.branch" >
<property name="cvs.branch.label" value="BRANCH_${app.major.version}_${app.minor.version}" />
</target>
<target name="-timestamp.3" depends="init, -timestamp.2a" if="build.is.official" >
<property name="cvs.ready.label" value="${cvs.ready.label.prefix}_${app.major.version}_${app.minor.version}_${app.build.id}" />
<property name="cvs.branch.label" value="HEAD" /> <!-- default to a trunk/stable build -->
<echo message="CVS branch label: ${cvs.branch.label}" />
<echo message="release version (CVS ready label): ${cvs.ready.label}" />
</target>
<target name="-timestamp.4" depends="init, build.cvs.ready" if="build.is.official" >
</target>
<target name="-timestamp.5" depends="init" unless="build.is.dirty" >
<copy overwrite="yes" todir="${core.srcgen.out.dir}" >
<fileset dir="${core.data.dir}" includes="**/*.java" />
<filterset>
<filter token="APP_MAJOR_VERSION" value='*/ ${app.major.version}; // ' />
<filter token="APP_MINOR_VERSION" value='*/ ${app.minor.version}; // ' />
<filter token="APP_BUILD_ID" value='*/ ${app.build.id}; // ' />
<filter token="APP_BUILD_RELEASE_TAG" value='*/ "${app.build.release.tag}"; // ' />
<filter token="APP_BUILD_DATE" value='*/ "${app.build.date}"; // ' />
<filter token="APP_BUG_REPORT_LINK" value='*/ "${app.bug.report.link}"; // ' />
<filter token="APP_HOME_SITE_LINK" value='*/ "${app.home.site.link}"; // ' />
</filterset>
</copy>
<copy overwrite="yes" file="${core.data.dir}/MANIFEST.MF" todir="${temp.dir}" >
<filterset>
<filter token="JDK_ID" value="JDK_${ant.java.version}" />
<filter token="BUILD_USER_NAME" value="${user.name} on ${os.name}:${os.version}:${os.arch}" />
<filter token="APP_NAME" value="${app.short.name}" />
<filter token="APP_MAJOR_VERSION" value="${app.major.version}" />
<filter token="APP_MINOR_VERSION" value="${app.minor.version}" />
<filter token="APP_BUILD_ID" value="${app.build.id}" />
<filter token="APP_BUILD_RELEASE_TAG" value="${app.build.release.tag}" />
<filter token="APP_BUILD_DATE" value="${app.build.date}" />
<filter token="APP_BUG_REPORT_LINK" value="${app.bug.report.link}" />
<filter token="APP_HOME_SITE_LINK" value="${app.home.site.link}" />
</filterset>
</copy>
</target>
<target name="-pre-compile" depends="init, timestamp" >
</target>
<!-- ============================================================== -->
<!-- compilation targets: -->
<!-- ============================================================== -->
<target name="compile" depends="init, core.compile, ant.compile, tools.compile" />
<!-- ========================== -->
<!-- core module: -->
<target name="core.bootstrap.compile" depends="init, -pre-compile" >
<javac destdir="${core.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.12.classpath"
extdirs="${ext.j2se.12.classpath}"
classpathref="core.classpath"
>
<!-- include IAppVersion.java: -->
<src path="${core.srcgen.out.dir}" />
<!-- classes used by core.src.java12.dir sources: -->
<src path="${core.src.java12.dir}" />
<include name="**/util/Property.java" />
<include name="**/IAppConstants.java" />
</javac>
</target>
<target name="core.java14.compile" depends="init, core.bootstrap.compile" >
<javac destdir="${core.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.14.classpath"
extdirs="${ext.j2se.14.classpath}"
classpathref="core.classpath"
>
<src path="${core.src.java14.dir}" />
</javac>
</target>
<target name="core.java13.compile" depends="init, core.java14.compile" >
<javac destdir="${core.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.13.classpath"
extdirs="${ext.j2se.13.classpath}"
classpathref="core.classpath"
>
<src path="${core.src.java13.dir}" />
</javac>
</target>
<!-- the bulk of core compilation: -->
<target name="core.compile" depends="init, core.java13.compile" >
<javac destdir="${core.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.12.classpath"
extdirs="${ext.j2se.12.classpath}"
classpathref="core.classpath"
>
<src path="${core.src.java12.dir}" />
<exclude name="**/util/Property.java" />
<exclude name="**/IAppConstants.java" />
</javac>
</target>
<!-- ========================== -->
<!-- tools module: -->
<target name="tools.compile" depends="init, core.compile" >
<javac destdir="${tools.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.14.classpath"
extdirs="${ext.j2se.14.classpath}"
classpathref="tools.classpath"
>
<src path="${tools.src.dir}" />
</javac>
</target>
<!-- ========================== -->
<!-- ant module: -->
<target name="ant.15.compile" depends="init, core.compile" >
<javac destdir="${ant.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.12.classpath"
extdirs="${ext.j2se.12.classpath}"
classpathref="ant.15.classpath"
>
<src path="${ant.src.ant15.dir}" />
</javac>
</target>
<!-- the bulk of ant compilation: -->
<target name="ant.compile" depends="init, core.compile, ant.15.compile" >
<javac destdir="${ant.classes.out.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
target="${build.target}"
bootclasspathref="boot.j2se.12.classpath"
extdirs="${ext.j2se.12.classpath}"
classpathref="ant.14.classpath"
>
<src path="${ant.src.ant14.dir}" />
</javac>
</target>
<!-- ============================================================== -->
<!-- packaging targets: -->
<!-- ============================================================== -->
<target name="package" depends="init, core.package, ant.package" />
<!-- ========================== -->
<!-- run tools: -->
<target name="rtclosure.gen" depends="init, compile" >
<property name="rtclosure.resource" value="com/vladium/emma/rt/RTExitHook.closure" />
<property name="rtclosure.classpath" refid="core.classpath" />
<java classname="com.vladium.tools.ClassDep"
classpathref="tools.classpath"
>
<arg value="${rtclosure.classpath}" />
<arg value="${core.res.out.dir}/${rtclosure.resource}" />
<arg value="com.vladium.emma.rt.RTExitHook" />
<arg value="com.vladium.emma.data.CoverageData" />
</java>
</target>
<!-- ========================== -->
<!-- core module: -->
<target name="core.package" depends="init, core.compile, rtclosure.gen" >
<jar jarfile="${out.dir}/${app.short.name}.jar"
manifest="${temp.dir}/MANIFEST.MF"
compress="true"
index="false"
>
<!-- classes: -->
<fileset dir="${core.classes.out.dir}" includes="**/*.class" />
<!-- classloader resources: -->
<fileset dir="${core.res.dir}" excludes="**/*.exclude" />
<fileset dir="${core.res.out.dir}" excludes="**/*.exclude" />
<manifest>
<attribute name="Main-Class" value="${app.short.name}run" />
</manifest>
</jar>
</target>
<!-- ========================== -->
<!-- ant module: -->
<target name="ant.package" depends="init, ant.compile" >
<jar jarfile="${out.dir}/${app.short.name}_ant.jar"
manifest="${temp.dir}/MANIFEST.MF"
compress="true"
index="false"
>
<!-- classes: -->
<fileset dir="${ant.classes.out.dir}" includes="**/*.class" />
<!-- classloader resources: -->
<fileset dir="${ant.res.dir}" excludes="**/*.exclude" />
<manifest>
<attribute name="Main-Class" value="com.vladium.${app.short.name}.ANTMain" />
</manifest>
</jar>
</target>
<!-- ============================================================== -->
<!-- distribution targets: -->
<!-- ============================================================== -->
<target name="dist" depends="init, core.dist, ant.dist" />
<!-- ========================== -->
<!-- core module: -->
<target name="core.dist" depends="init, core.package" >
<copy file="${out.dir}/${app.short.name}.jar" todir="${dist.dir}" />
</target>
<!-- ========================== -->
<!-- ant module: -->
<target name="ant.dist" depends="init, ant.package" >
<copy file="${out.dir}/${app.short.name}_ant.jar" todir="${dist.dir}" />
</target>
<!-- ============================================================== -->
<!-- file release targets: -->
<!-- ============================================================== -->
<target name="publish.release" depends="init, release, publish.property.check, release.lib, release.full, release.src" >
</target>
<target name="publish.stable" depends="init, stable, publish.property.check, release.lib" >
<fail unless="file.release.label">need ${file.release.label}</fail>
</target>
<target name="publish.property.check" depends="init" >
<fail unless="file.release.label">property ${file.release.label} must be set</fail>
<fail unless="docs.dist.dir">property ${docs.dist.dir} must be set</fail>
<property name="publish.ok" value="true" />
</target>
<target name="release.lib" depends="init" if="publish.ok" >
<!-- lib distribution: -->
<zip destfile="${release.dir}/${app.short.name}${file.release.prefix}-${file.release.label}-lib.zip"
basedir="${dist.dir}"
includes="*.jar"
/>
</target>
<target name="release.src" depends="init" if="publish.ok" >
<!-- source files: -->
<zip destfile="${release.dir}/${app.short.name}-${file.release.label}-src.zip" >
<zipfileset prefix="${app.short.name}-${file.release.label}"
dir="${basedir}"
includes="${tools}/**, ${core}/**, ${ant}/**, ${lib}/**"
excludes="*/CVS/*"
/>
<!-- license, build script and instructions, etc: -->
<zipfileset prefix="${app.short.name}-${file.release.label}"
dir="${basedir}"
includes="*.txt, *.xml, *.html, *.properties"
excludes="build.properties"
/>
</zip>
</target>
<target name="release.full" depends="init" if="publish.ok" >
<zip destfile="${release.dir}/${app.short.name}-${file.release.label}.zip" >
<!-- license: -->
<zipfileset prefix="${app.short.name}-${file.release.label}"
dir="${basedir}/"
includes="cpl*.html"
/>
<!-- examples and related instructions: -->
<zipfileset prefix="${app.short.name}-${file.release.label}"
dir="${basedir}/install/data"
/>
<!-- lib distribution: -->
<zipfileset prefix="${app.short.name}-${file.release.label}/lib"
dir="${dist.dir}"
includes="*.jar"
/>
<!-- doc distribution: -->
<zipfileset prefix="${app.short.name}-${file.release.label}/docs"
dir="${docs.dist.dir}/docs"
/>
</zip>
</target>
<!-- ============================================================== -->
<!-- CVS targets: -->
<!-- ============================================================== -->
<target name="build.cvs.ready" if="cvs.ready.label">
<cvs failonerror="yes" output="${out.dir}/cvs.txt" error="${out.dir}/cvs.error.txt"
command="-t rtag -r ${cvs.branch.label} -F -a ${cvs.ready.label} ${app.short.name}" />
</target>
<target name="build.cvs.unready" if="cvs.ready.label">
<cvs failonerror="yes" output="${out.dir}/cvs.txt" error="${out.dir}/cvs.error.txt"
command="-t rtag -r ${cvs.branch.label} -d -a ${cvs.ready.label} ${app.short.name}" />
</target>
</project>
<!-- ========= END OF FILE ========================================== -->