Folks,
When building our Android app in Ant (in Jenkins), we're running into a property scoping problem. This breaks our emma unit test coverage.
We use a global build.xml file, containing these lines:
<target name="clean">
<ant antfile="build.xml" dir="MyProject" target="clean"/>
<ant antfile="build.xml" dir="MyTestProject" target="clean"/>
</target>
<target name="test">
<ant antfile="build.xml" dir="MyTestProject" target="debug"/>
<ant antfile="build.xml" dir="MyTestProject" target="installt"/>
<ant antfile="build.xml" dir="MyTestProject" target="test"/>
</target>
<target name="emma">
<ant antfile="build.xml" dir="MyTestProject" target="emma"/>
</target>
As you can see, it starts targets in the individual projects. We build using clean emma test.
During the build, I print the value of emma.enabled, which is set to true by the emma target. However, by the time Ant reaches the debug target, emma.enabled is not set anymore. This causes our tests to be run without emma coverage enabled. According to the Ant Property task documentation, properties should retain their value:
By default, all of the properties of the current project will be available in the new project.
However, they clearly do not. I've been at this for some time now, hope you guys can help me out. Thanks!