The change as suggested by Philip is to put the following element top
level (i.e. outside any target)
<taskdef name="hacky-build"
classname="org.hackystat.sensor.ant.BuildSensorInstallationAntTask" >
<classpath>
<pathelement location="${basedir}/sensor.ant.jar"/>
</classpath>
</taskdef>
<hacky-build .../>
1. It means we need to put both "sensor.ant.jar" and "sensorshell.jar"
in hackyCore_Build.
2. After removing the old "installAntSensor" and made the changes above,
I encountered weird ant behavior: the ant sensor is loaded twice, and
two instances of the sensor works at the same time.
If I get rid of "classpath" in "taskdef" (which implies putting
"sensor.ant.jar" in ant lib), then everything is normal.
In the ant sensor code, I have code that specifically checks whether the
user is trying to install the ant sensor more than once (recall the
sensor is implemented as an Ant listener), and prevents subsequent
installation of the sensor. The above weird behavior seems to suggest
that ANT has somehow created two contexts. I am not sure whether it's a
ANT bug, but I'll try to do some googling tomorrow.
3. The changes to the build script are NOT committed.
Cheers,
Cedric
dency target is not right:
The build sensor is loaded when you use freshStart, quickStart,
all.junit, all.compile,
etc. But when I am developing software, most of the time, I only care
my own module and
use ant command like "ant hackyApp_BuildAnalysis.junit" or "ant
hackyApp_BuildAnalysis.checkstyle". In those cases, the build sensor
will not be
loaded, because those taskes are not dependent on "checkProperties".
I went over our entire build script, it seems there is no target
which all other
targets depend on.
Hmm. The only solution I can see right now is to do the taskdef and
invocation of the build sensor at top-level, outside of any target.
That should solve your problem, but it introduces another: the
requirement that the build sensor be made available in all
distributions of Hackystat. I suppose that isn't the end of the
world. Try this approach out and see if it seems reasonable.
(Probably want to use the "classpath" attribute in the taskdef so that
the user doesn't need to add the sensor to ant/lib.)