At 11:38 AM 7/17/02 +0200, Stefan Bodewig wrote:
Also I may need a little help with selectors:
[...]
What I could use immediately would be a selector container that
supported if/unless in some way.

Hmm. That should be relatively trivial to add. If the "if" property does not exist or the "unless" property does exist, the selector will not select any file at all. We could even add that into BaseSelector, giving all core selectors the "if" and "unless" attributes. The only trouble might be that the build script could end up confusing to read, trying to work out how all these conditions play out between selectors.


The alternative would be to define if and unless just on the <selector> tag. That might be clearer since the if and unless attributes would be the only reason you would use the <selector> tag anywhere other than as a child of <project>.

So what do people think? Is this a better way to optionally select test classes and source code:

    <or>
        <filename name="Test*.class" if="include.tests"/>
        <and if="include.source">
            <filename name="*.java"/>
            <not>
                <filename name="*Test*.java" unless="include.tests"/>
            </not>
        </and>
    <or>

or is this:

    <or>
        <selector if="need.tests">
            <filename name="Test*.class"/>
        </selector>
        <selector if="include.source">
            <and>
                <filename name="*.java"/>
                <not>
                    <selector unless="need.tests">
                        <filename name="*Test*.java"/>
                    </selector>
                </not>
            </and>
        </selector>
    <or>

Personally I prefer the former.

I'm willing to make the change either way, since it would be easy for me to do. If someone has been looking for a chance to get more familiar with the selector code, though, this would be an easy introduction.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to