Development tools : Massive build UDTT project : Programmatic build for UDTT projects : BTTBuildTask class : Providing build result info to other tasks
  
Providing build result info to other tasks
BTTBuildTask class creates the following properties (via getProject().setProperty(...) API) in case there are warnings:
nbrOfWarnings: it contains the number of files with warning result from UDTT build.
hasWarnings: it is "true" if there are one or more files with warning result.
It also creates the following properties in case there are errors:
nbrOfErrors: it contains the number of files with error result.
hasErrors: it is "true" if there are one or more files with error result.
It is considered an error not just when a UDTT build is invoked and its result is an error, but also some other situations that do not allow to execute the UDTT build because there is an inconsistent situation such as: the project to be generated does not exist, the project to be generated does not have UDTT nature, the channel value is not correct, the file to be generated is in a non-UDTT project and so on.
Therefore, tasks executed after BTTBuildTask can get these properties values and act according to them. For example:
using if and unless Ant parameters (a task or target is executed based on the existence or not of a property). For example:
<BTTBuild project="[projName]" channel="[channel]" outputFile="[fileName]" validationOutputFile="[validationFileName]" validationLevel="">
<fail if="hasErrors">
Notice that when BTTBuildTask is invoked several times, the properties will exist after the first BTTBuildTask execution.
In case of creating a new Ant task, it can query the build status but retrieving the property value as follows: getProject().getProperty(propName).
As an example, refer to BuildInfoTask class in AntBuildTask plugin and to btt-infoBuild.xml file in AntBuildSample plugin:
<taskdef name="BTTBuild" classname="antbuildtask.BTTBuildTask"></taskdef>
  <taskdef name="BTTBuildInfo" classname="antbuildtask.BuildInfoTask"></taskdef>
  <target name="main">
    <BTTBuild projectName="projName" channel="dojo" outputFile="sampleFile" validationOutputFile="sampleValidationFile" validationLevel=""/>
    <BTTBuildInfo/>
  </target>
Go up to
BTTBuildTask class