tags:

views:

183

answers:

2

We have an ant build script which contains this bit:

<target name="test">
  <antcall target="iterate-projects">
    <param name="test-depends" value="false" /> 
    <param name="target" value="test" />
  </antcall>
</target>

I'd like to skip testing some of our projects, since they are very large and contain 3rd party tests. Something like

if (library.name().startsWith("lucene"))
  continue

How would I implement this in ant?

A: 

You can use such technique:

<target name="lucene" unless="skip_test">
...
</target>

To skip the target you have to define property

<target name="test">
  <property name="skip_test" value="true"/>
  <antcall target="iterate-projects">
    <param name="test-depends" value="false" /> 
    <param name="target" value="test" />
  </antcall>
</target>
FoxyBOA
I don't understand this solution (I know nothing about Ant). What goes inside the '...' ?I don't want to define a separate target for lucence, I want my main test target to just skip lucene projects.
ripper234
I expect that you have a "lucene" task. If you can modify it and add 'unless="skip_test"' part, that my example will work.
FoxyBOA
A: 

The Ant Contrib project contains useful but crude control flow tasks, including <if>. You could probably string that together with the other tasks in the library to achieve hat you need.

skaffman