diff options
author | wisberg <wisberg> | 2005-06-17 04:29:39 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2005-06-17 04:29:39 +0000 |
commit | 8a21350b84db7feaca75f5ed825b120ddf180f88 (patch) | |
tree | 78b5b7ac705d8c8ed96681b26bbd45dcfcd4980a /build | |
parent | 9359ddc4f1d934cf6be1b201a9c761d7c460f868 (diff) | |
download | aspectj-8a21350b84db7feaca75f5ed825b120ddf180f88.tar.gz aspectj-8a21350b84db7feaca75f5ed825b120ddf180f88.zip |
now handling (init, clean, save) multiple results, better failure reporting, properties echo for build info
Diffstat (limited to 'build')
-rw-r--r-- | build/build-properties.xml | 227 |
1 files changed, 175 insertions, 52 deletions
diff --git a/build/build-properties.xml b/build/build-properties.xml index 81fa3f3cf..1353aec74 100644 --- a/build/build-properties.xml +++ b/build/build-properties.xml @@ -62,23 +62,33 @@ <!-- these names are known to BuildModule.java and common to all --> <property name="aj.build.dir" location="${aspectj.modules.dir}/aj-build"/> - <property name="aj.failure.file" - location="${aj.build.dir}/failures.txt"/> - <property name="aj.temp.dir" + <property name="aj.temp.dir" location="${aj.build.dir}/temp"/> <property name="aj.jar.dir" location="${aj.build.dir}/jars"/> <property name="aj.dist.dir" location="${aj.build.dir}/dist"/> - <property name="aj.junit.dir" - location="${aj.build.dir}/junit"/> <property name="aj.webDeploy.dir" location="${aj.build.dir}/webDeploy"/> <property name="aj.install.dir" location="${aj.build.dir}/install"/> - <property name="aj.logs.dir" - location="${aj.build.dir}/logs"/> - + + <property name="aj.build.allresults.dir" + location="${aj.build.dir}/allresults"/> + <property name="aj.build.allfailures.file" + location="${aj.build.allresults.dir}/allfailures.txt"/> + <property name="aj.build.results.dir" + location="${aj.build.dir}/results"/> + <property name="aj.failure.file" + location="${aj.build.results.dir}/failures.txt"/> + <property name="aj.build-id.file" + location="${aj.build.results.dir}/build-id.txt"/> + <property name="aj.junit.dir" + location="${aj.build.results.dir}/junit"/> + <property name="aj.logs.dir" + location="${aj.build.results.dir}/logs"/> + + <!-- aspectj... names are sources, not to be mutated --> <property name="aspectj.modules.lib.dir" location="${aspectj.modules.dir}/lib"/> @@ -116,14 +126,15 @@ value="tests"/> <property name="aspectj.other.modules" value="docs,eclipse.plugin"/> - + <jar-property name="junit.jar" location="${aspectj.modules.lib.dir}/junit/junit.jar"/> + <!-- TODO need version-specific JDK? --> <guarded-property name="jdk.tools.jar" location="${java.home}/../lib/tools.jar"/> <guarded-property name="jdk.tools.jar" location="${java.home}/lib/tools.jar"/> - <guarded-property name="aspectjrt.path" + <guarded-property name="lib.test.aspectjrt.jar" location="${aspectj.modules.lib.dir}/test/aspectjrt.jar"/> <property name="init-properties.done" value="true"/> </target> @@ -198,16 +209,13 @@ <property name="init-filters.done" value="done"/> </target> - <target name="clean-directories" - depends="init-directories" - unless="clean-directories.done" > - <property name="clean-directories.done" value="done"/> + <target name="clean-directories" depends="init-properties"> <delete quiet="on"> <fileset dir="${aj.build.dir}" includes="*,**/*"/> </delete> <antcall target="init-directories"/> - </target> - + </target> + <target name="clean-jars" depends="init-directories" unless="clean-jars.done" > @@ -216,6 +224,65 @@ </delete> <property name="clean-jars.done" value="done"/> </target> + + <target name="clean-keep-results" depends="init-properties"> + <delete> + <fileset dir="${aj.build.dir}"> + <exclude name="results/*"/> + <exclude name="results/**"/> + <exclude name="allresults/*"/> + <exclude name="allresults/**"/> + </fileset> + </delete> + </target> + + <target name="clean-default-results" depends="init-properties"> + <delete> + <fileset dir="${aj.build.results.dir}" includes="*,**/*"/> + </delete> + </target> + + <target name="clean-result" depends="init-properties"> + <delete quiet="on"> + <fileset dir="${aj.build.results.dir}" includes="*,**/*"/> + </delete> + </target> + + <macrodef name="save-build-id" + description="save ${id} to ${aj.build-id.file}"> + <attribute name="id"/> + <sequential> + <echo message="@{id}" file="${aj.build-id.file}"/> + </sequential> + </macrodef> + + <macrodef name="load-build-id"> + <attribute name="property"/> + <sequential> + <available property="aj.build-id.file.available" + file="${aj.build-id.file}"/> + <antcall target="ensure-build-id"/> + <loadfile srcfile="${aj.build-id.file}" property="@{property}"/> + </sequential> + </macrodef> + + <target name="ensure-build-id" unless="aj.build-id.file.available" + description="create datestamp build id in ${aj.build-id.file} if n/a"> + <tstamp> + <format property="build.id.name" + timezone="GMT+10" + pattern="yyyyMMdd-hhmmss" + /> + </tstamp> + <echo file="${aj.build-id.file}" message="${build.id.name}"/> + </target> + + <target name="save-result" depends="init-properties"> + <load-build-id property="build.id"/> + <copy todir="${aj.build.allresults.dir}/${build.id}"> + <fileset dir="${aj.build.results.dir}" /> + </copy> + </target> <target name="echo-properties" depends="init-properties"> <echo> @@ -230,22 +297,12 @@ aj.build.dir = ${aj.build.dir} ant.home = ${ant.home} java.home = ${java.home} + java11.home = ${java11.home} + java13.home = ${java13.home} + java14.home = ${java14.home} + java15.home = ${java15.home} </echo> </target> - - <macrodef name="jar-property"> - <attribute name="name"/> - <attribute name="location"/> - <sequential> - <property name="@{name}" - location="@{location}"/> - <available file="${@{name}}" - property="@{name}.available" - value="${@{name}}"/> - <fail unless="@{name}.available" - message="unable to find @{name}: ${@{name}}"/> - </sequential> - </macrodef> <macrodef name="guarded-property" description="set property {name} to {location} if unset and {location} exists"> <attribute name="name"/> @@ -276,6 +333,59 @@ </sequential> </macrodef> + <!-- + Reporting failures + + Failure-reports supports running multiple build targets in sequence for a + configuration, saving off those results, doing it over, etc., and then + checking the result (of the current builds or all builds), i.e., + + # first set of builds + - build, report-if-failed ... + - build, report-if-failed ... + ... + - {save-build-id} first-set + - save-result + - clean-keep-results + - clean-default-results + # second set of builds + - build, report-if-failed ... + ... + - save-result + + # fail build if anything in either set failed + - fail-if-allresults-allfailures + + Clients call + <report-if-failed property="failed" text="JUnit failed"/> + to signal failure. This goes into results/failures.txt, to be read later. + Many clients can call this, across many (current) build invocations, so + results just accumulate. Clients should never call <fail> directly; while + the cruise-control script can handle build failures, they won't be recorded + in a way that supports easy evaluation. + + To fail if the current builds fail, do + <antcall target="fail-if-results-failures"/> + + You can do a sequence of builds (e.g., in 1.3), save the results off, + and do it again (e.g., in 1.4), save the results, and then compare them. + Use save-result to store the current build results in ../allresults. + + Between such builds, you can do a clean-keep-results (to clear out jars + and such), followed by clean-default-results (to clear the current results). + (The normal clean also cleans out any results, so avoid that when saving + results from multiple builds.) + + Each build can be named using save-build-id. This name must be a valid + directory name. When the results are saved to ../allresults, the directory + name will use the most recent build-id. If none has been saved, then this + creates a name out of the date (down to the second). + + To fail if any of the saved builds has failed, do fail-if-allresults-allfailures. + This target ignores the current builds (if they are unsaved). + + --> + <macrodef name="report-if-failed"> <attribute name="property"/> <attribute name="text"/> @@ -293,41 +403,54 @@ </macrodef> <target name="do-report-fail" if="failed"> - <echo level="debug" message="do-report-fail - failed=${failed}"/> - <echo level="debug" message="do-report-fail - text=${text}"/> <echo append="true" file="${aj.failure.file}">${text} </echo> </target> - <target name="fail-if-failures" - description="fail if ${aj.failure.file} exists and is not empty"> + <target name="fail-if-results-failures" depends="init-properties"> + <fail-if-failures failureFile="${aj.failure.file}"/> + </target> + + <target name="fail-if-allresults-allfailures" depends="init-properties"> + <concat destfile="${aj.build.allfailures.file}"> + <fileset dir="${aj.build.allresults.dir}" + includes="*/failures.txt"/> + </concat> + <fail-if-failures failureFile="${aj.build.allfailures.file}"/> + </target> + + <macrodef name="fail-if-failures" + description="fail if ${failureFile} exists and is not empty"> + <attribute name="failureFile"/> + <sequential> <loadfile failonerror="false" property="failures" - srcfile="${aj.failure.file}"/> + srcfile="@{failureFile}"/> <fail> <condition> - <length file="${aj.failure.file}" + <length file="@{failureFile}" when="greater" length="0"/> </condition> +# @{failureFile} failures: ${failures} </fail> - <!-- - <loadfile - failonerror="false" - property="failures" - srcfile="${aj.failure.file}"/> - <condition property="failure"> - <equals arg1="${failures}" arg2="${failure}"/> - </condition> - <condition property="passed"> - <equals arg1="${failures}" arg2=""/> - </condition> - <fail unless="passed">${failures} -</fail> - --> - </target> - + </sequential> + </macrodef> + <macrodef name="jar-property"> + <attribute name="name"/> + <attribute name="location"/> + <sequential> + <property name="@{name}" + location="@{location}"/> + <available file="${@{name}}" + property="@{name}.available" + value="${@{name}}"/> + <fail unless="@{name}.available" + message="unable to find @{name}: ${@{name}}"/> + </sequential> + </macrodef> + <macrodef name="set-available" description="set property and property.available if path exists"> <attribute name="property"/> |