Ok this is what I'm going for -
I wrote a simple java applet framework. The applets need to be signed. So I
made an Ant file which handles signing the applet and combing all support
libraries for the end user. But I'd like a section at the top of my Ant
script where the user can list any additional jars they require, so I can
take that into account of my signing routine for them. So a comma delimited
string would be fine, something like:
// User gives me one string with paths to all jars they need.
<property extra_jars="C:/jarA.jar,C:/testing/jarB.jar,C:/help/jarC.jar">
// I have to tokenize it and sign each one for them:
for (extra_jars) {
sign(nextJar);
}
// I have to create an index.html file for them which houses the applet
// and points to each of those jars.
<filewrite="<applet archive="/>
for (extra_jars) {
<filewrite="${nextJar}"/>
}
// Now I'll copy each one into an export directory.
// ...
Yeah the above is all pseudo-code of course but it gives the idea of what I
want to do. Right now I've just hard-coded the jars being used. Everything
works, it's just that it'd be much nicer to let the user specify one comma
delimited string up top, I parse it and do the rest of the magic for them.
Thanks,
Mark
Vijay Aravamudhan wrote:
>
> What is it you are trying to achieve? I have used a comma-separated
> string property, split it and iterated over it (using ant-contrib).
> Would that work for you rather than writing a custom task?
>
> hth,
> Vijay
>
> markww wrote:
>> Hmm I just read through a custom Task tutorial, but I don't think they'll
>> help, because you can't specify a variable number of attributes, they
>> must
>> be known in advance. In the examples I've read, your custom Task class
>> has
>> to have getters and setters for all the attributes you want to use. But
>> if I
>> want to let my user specify an arbitrary number of attributes, I don't
>> think
>> that's possible... please correct me if I'm wrong!
>>
>> Thanks
>>
>>
>> mgainty wrote:
>>
>>> Hey Mark-
>>>
>>> no declaration of property array as far as I can see you can feel free
>>> to
>>> create your own as in this example
>>>
>>> public class MyTask extends Task {
>>> private List conditions = new ArrayList();
>>> public void add(Condition c) {
>>> conditions.add(c);
>>> }
>>> public void execute() {
>>> // iterator over the conditions
>>> }
>>> }
>>>
>>>
>>> One may define and use this class like this:
>>>
>>>
>>> <taskdef name="mytask" classname="MyTask" classpath="classes"/>
>>> <typedef name="condition.equals"
>>> classname="org.apache.tools.ant.taskdefs.conditions.Equals"/>
>>> <mytask>
>>> <condition.equals arg1="${debug}" arg2="true"/>
>>> </mytask>
>>>
>>> There are a number of hidden implementation details such as which
>>> constructors are created and used but the
>>> mechanics of creating the stub are here..more info available at
>>> http://ant.apache.org/manual/develop.html
>>>
>>> Maybe some of the committers can weigh in???
>>> Martin
>>>
>>> ______________________________________________
>>> Disclaimer and confidentiality note
>>> Everything in this e-mail and any attachments relates to the official
>>> business of Sender. This transmission is of a confidential nature and
>>> Sender does not endorse distribution to any party other than intended
>>> recipient. Sender does not necessarily endorse content contained within
>>> this transmission.
>>>
>>>
>>>
>>>> Date: Thu, 14 Aug 2008 13:14:33 -0700
>>>> From: [EMAIL PROTECTED]
>>>> To: [email protected]
>>>> Subject: Property array?
>>>>
>>>>
>>>> Hi,
>>>>
>>>> Is there any way to make an array property in Ant? I want to write some
>>>> stuff to a file based on an array property. Something like the user
>>>> enters
>>>> this:
>>>>
>>>> <property array name = "colors">
>>>> <val = "red">
>>>> <val = "green">
>>>> <val = "blue">
>>>> </property array>
>>>>
>>>> for (i = 0; i< ${colors}; i++) {
>>>> <echo file="myfile.txt" append="yes" message="${colors[i]}" />
>>>> }
>>>>
>>>> Yeah I'm just making the syntax up as I go along - anything like that?
>>>>
>>>> Thanks
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Property-array--tp18988851p18988851.html
>>>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>> _________________________________________________________________
>>> Reveal your inner athlete and share it with friends on Windows Live.
>>> http://revealyourinnerathlete.windowslive.com?locale=en-us&ocid=TXT_TAGLM_WLYIA_whichathlete_us
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Property-array--tp18988851p18994092.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]