ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan doklovic <>
Subject Wildcards in depends?
Date Tue, 01 Jul 2008 16:35:46 GMT

I was wondering if anyone else thought being able to specify wildcards 
in the depends attribute of the target would be helpful.
Where I work, we use a lot of build fragments that get imported, and we 
would like the ability to allow the developer to add/remove build 
funtionality easilt without disrupting the basic workflow.

essentially something like:

build.xml imports base-java.xml and java-checkstyle.xml

<target name="pre-compile" depends="java-pre-plugin*,compile" />

<target name="java-pre-plugin-checkstyle"> ... run checkstyle ... </target>

This way a developer can add/remove something like checkstyle simply by 
adding/removing the import.
This would also allow the developer to use a different syntax checker 
simply by the import.

I think the most reasonable way to do this would be to modify the 
addDependency method in Something like this:
public void addDependency(final String dependency) {
    if (dependencies == null) {
        dependencies = new ArrayList(2);

    if (dependency.endsWith("*")) {
        String key;
        final String prefix = dependency.substring(0, 
(dependency.indexOf("*") - 1));
        final Enumeration<String> e = getProject().getTargets().keys();
        while (e.hasMoreElements()) {
        key = e.nextElement();
        if (key.startsWith(prefix)) {
    } else {

any thoughts?

- Jonathan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message