With Ant 1.6 I would write a scriptdef doing the upper-/lowercase. Jan
<project> <scriptdef name="upcase" language="javascript"> <attribute name="input"/> <attribute name="property"/> <element name="fileset" type="fileset"/> <![CDATA[ name = attributes.get("property"); input = attributes.get("input"); value = input.toUpperCase(); project.setNewProperty(name, value); ]]> </scriptdef> <scriptdef name="lowercase" language="javascript"> <attribute name="input"/> <attribute name="property"/> <element name="fileset" type="fileset"/> <![CDATA[ name = attributes.get("property"); input = attributes.get("input"); value = input.toLowerCase(); project.setNewProperty(name, value); ]]> </scriptdef> <scriptdef name="first-upcase" language="javascript"> <attribute name="input"/> <attribute name="property"/> <element name="fileset" type="fileset"/> <![CDATA[ name = attributes.get("property"); input = attributes.get("input"); value = input.substring(0,1).toUpperCase()+input.substring(1); project.setNewProperty(name, value); ]]> </scriptdef> <scriptdef name="first-lowercase" language="javascript"> <attribute name="input"/> <attribute name="property"/> <element name="fileset" type="fileset"/> <![CDATA[ name = attributes.get("property"); input = attributes.get("input"); value = input.substring(0,1).toLowerCase()+input.substring(1); project.setNewProperty(name, value); ]]> </scriptdef> <first-upcase property="new.up1st" input="input has only lower characters"/> <upcase property="new.upAll" input="input has only lower characters"/> <first-lowercase property="new.lo1St" input="INPUT has mixed Characters"/> <lowercase property="new.loAll" input="INPUT has mixed Characters"/> <echoproperties prefix="new."/> </project> > -----Ursprüngliche Nachricht----- > Von: michael sorens [mailto:[EMAIL PROTECTED] > Gesendet am: Donnerstag, 27. Januar 2005 16:36 > An: Ant Users List > Betreff: Re: Last element of current directory name. > > I tried your JavaScript example; after adding bsf.jar and > js.jar to my ant/lib directory, I still had this runtime error: > > java.lang.NoSuchMethodError: > org.mozilla.javascript.Context.getDebuggableEngine()Lorg/mozil > la/javascript/debug/DebuggableEngine; > > This was the piece of JavaScript in question: > <script language="javascript"> <![CDATA[ > var data = myProject.getProperty("try_it"); > var result = data; > myProject.setProperty("try_it",result); > ]]> </script> > > Is there another library I am missing...? > > > On Thu, 27 Jan 2005 07:52:51 +0100, > <[EMAIL PROTECTED]> wrote: > > > oh, you can use other languages as well, python, groovy, bsh, ... > > it has to be supported by then BeanScriptingFramework. > > > > Jan > > > >> -----Ursprüngliche Nachricht----- > >> Von: Nat Gross [mailto:[EMAIL PROTECTED] > >> Gesendet am: Mittwoch, 26. Januar 2005 16:44 > >> An: Ant Users List > >> Betreff: Re: AW: Last element of current directory name. > >> > >> Hey! I didn't know you can use Javascript in Ant, (not that I know > >> Javascript well, but still..) it's cool. > >> Thanks > >> -nat > >> ps. oh, thats what Matt meant by 'using a script'. > >> > >> [EMAIL PROTECTED] wrote: > >> > >> >The upcase part can be done with <script>. > >> >See http://marc.theaimsgroup.com/?l=ant-user&m=104486168926737&w=2 > >> > > >> >Jan > >> > > >> > > >> > > >> >>-----Ursprüngliche Nachricht----- > >> >>Von: Nat Gross [mailto:[EMAIL PROTECTED] > >> >>Gesendet am: Dienstag, 25. Januar 2005 23:20 > >> >>An: Ant Users List > >> >>Betreff: Re: Last element of current directory name. > >> >> > >> >>Matt Benson wrote: > >> >> > >> >> > >> >> > >> >>>--- Nat Gross <[EMAIL PROTECTED]> > >> >>>wrote: > >> >>> > >> >>> > >> >>> > >> >>> > >> >>> > >> >>>>How do I get just the last element of the current > >> >>>>directory. > >> >>>>Suppose basedir = dira/dirb/dirc. (Or any path for > >> >>>>that matter.) > >> >>>> > >> >>>> > >> >>>> > >> >>>> > >> >>>Whatever is "the current directory"--${user.dir}? > >> >>>${basedir}?... You can use the basename task to get > >> >>>the last element of a path. > >> >>> > >> >>> > >> >>> > >> >>> > >> >>I have used basename for filenames without realizing that it > >> >>also works > >> >>for directory names. > >> >>Thanks. > >> >> > >> >> > >> >> > >> >>>>I need a property to = "Dirc". (1st character > >> >>>>uppercased, if possible.) > >> >>>> > >> >>>> > >> >>>> > >> >>>> > >> >>>> > >> >>>Changing case is more problematical. I would either > >> >>>try ant-contrib's propertyregex (though I'm not good > >> >>>with changing case in regular expressions either), > >> >>>write something in Java, or deal with the case as-is. > >> >>>Others might use a script. > >> >>> > >> >>> > >> >>> > >> >>> > >> >>Thanks. I need to explore regex, I guess. > >> >> > >> >> > >> >> > >> >>>>For the pros out there it should be 123, but for > >> >>>>me... forget it! > >> >>>> > >> >>>> > >> >>>> > >> >>>> > >> >>>HTH, > >> >>>Matt > >> >>> > >> >>> > >> >>> > >> >>> > >> >>>>Thanks > >> >>>>-nat > >> >>>> > >> >>>> > >> >>>> > >> > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >