ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <anto...@antbuild.com>
Subject AW: Adding multiple views to p4label optional task
Date Sun, 21 Sep 2003 13:22:15 GMT
Hi Scott,
there is already in ant1.6alpha something in place to accept multiple views
separated by ; or :
In the current code, multiple views are assumed.
Cheers,
Antoine



-----Urspr√ľngliche Nachricht-----
Von: Decker, Scott [mailto:sdecker@edmunds.com]
Gesendet: Freitag, 19. September 2003 17:25
An: user@ant.apache.org
Betreff: Adding multiple views to p4label optional task


Hey there all,
  So, either I read through the source wrong, or perhaps I did something
wrong, but it doesn't seem like you can add multiple views to the p4label
task.
There is a snippet of code in the label task that says something like
"View: \n\t" + P4View;

However, there is still no good way to pass in the correct line breaks that
perforce requires.

I am submitting a few code snippets here that alleviates this problem. I am
not a source commiter, so please feel free to take a look and have at it.
It works well for me if I have only one view, or multiple ones.  I do use a
delimeter though, and I am not sure if that is the best route to go.

I propose:

Add the following variable and setter method

protected String multipleViews = null;

    /**
     * If you need to set multiple views, use this method
     * we use a semicolon as our delimeter
     * example:
     * multipleViews="//depot/dir/...;//depot/dir2/...;//depot/dir3/..."
     * or
     * multipleViews="//depot/dir/..."
     *
     *
     * @param multipleViews
     */
    public void setMultipleViews(String multipleViews) {
        this.multipleViews = multipleViews;
    }


In the execute method
Replace:
String newLabel =
                "Label: " + name + "\n" +
                "Description: " + desc + "\n" +
                "Options: unlocked\n" +
                "View: \n\t" + P4View;

With

String newLabel =
                "Label: " + name + "\n" +
                "Description: " + desc + "\n" +
                "Options: unlocked\n" +
                "View: ";
        if (multipleViews == null)
        {
            newLabel += P4View + "\n";
        }
        else
        {
            StringTokenizer tokenizer = new
StringTokenizer(multipleViews,";");
            while(tokenizer.hasMoreTokens()){
                String token = tokenizer.nextToken();
                newLabel += token + System.getProperty("line.separator");
                if (tokenizer.hasMoreTokens())
                    newLabel += "\t";
            }
        }

Scott Decker
Chief Squirrel and
Programming Lead
sdecker@edmunds.com
310-309-4916





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message