Scot P. Floess schrieb:
I am enclosing my macrodef to compute a branch:
<macrodef
name = "compute-branch"
description = "Compute the branch based upon a root dir,
@{root}, and full path, @{full-path}. The branch represents the full
path minus the root dir. Please note: if @{root} does not exist in
@{full-path}, @{property} will be set with an empty value."
uri = "http://keros.sourceforge.net">
<attribute name = "root" description = "The root of the
path defined in @{full-path}."/>
<attribute name = "full-path" description = "The absolute
path for which @{root} is the root of the path and the branch computed
is this path minus the root."/>
<attribute name = "property" description = "The property to
set with the branch."/>
<attribute name = "description" default = "" description =
"Information about this macro call."/>
<sequential>
<!--
Grab data past @{root} in @{full-path}.
-->
<ant-contrib:propertyregex property =
"keros.compute-branch.COMPUTE_BRANCH" override = "true" input =
"@{full-path}" regexp = "@{root}(.*)" select = "\1" description =
"Parse out the branch from the value contained in @{root}"/>
<!--
Remove the leading file separator (if it is there). If
it is not there,
simply use the value as is.
-->
<ant-contrib:propertyregex property = "@{property}"
override = "true" input = "${keros.compute-branch.COMPUTE_BRANCH}"
regexp = "^[${file.separator}](.*)" replace = "\1" defaultValue =
"${keros.compute-branch.COMPUTE_BRANCH}" description = "Remove the
leading file separator if its there"/>
</sequential>
</macrodef>
Hi, thanks for your answer.
Uhhh, I am an absolute ant newbie.
I do not believe it. All this is needed just to remove a prefix prom a
string?!
> Let me know if you have any questions...
Ant proper really is not capable to perform things that look in C like
>> char * prefix;
>> char * path;
>> char * suffix = path + strlen (prefix);
or like
>> String prefix;
>> String path;
>> String suffix = path.substring (prefix.length());
in Java?
I am trying to *simplify* Makefiles by using ant. And not to make things
even more complex and harder to understand and to maintain.
If ant cannot do it, it is not what I am looking for...
All I could find is a strlen:
>> <length property="prefix.length" string="${prefix}" />
So what is missing is something like substring or an analogon to
basename that can remove a prefix instead of a suffix.
I am using Ant Contrib's propertyregex task to do this... Adjust URI's,
etc for your needs :)
The URI in your macrodef?
To that value must it be set? To kerberos zip?
Or to one of the jars in it?
Please be kind, I am just trying ant to look if it can make things simpler.
Regards, Georg-Johann
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org