You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/06/13 07:38:20 UTC

DO NOT REPLY [Bug 47365] New: Allow prefix for command line arguments

https://issues.apache.org/bugzilla/show_bug.cgi?id=47365

           Summary: Allow prefix for command line arguments
           Product: Ant
           Version: 1.7.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: Martin.vGagern@gmx.net


Command line arguments for many applications consist of an option, which is a
fixed string, immediately followed by a file name or path, which should follow
platform conventions.

Examples:
'-I/my/include/dir' for gcc
'--exclude-from=/path/to/excl.lst' for rsync
'--filter=.- /path/to/excl.lst' for rsync is still a single option

It is tedious to formulate this kind of command line arguments for e.g. exec,
as one has to use pathconvert together with properties in order to ensure
proper syntax for the file name and still include the prefix.

I suggest the introduction of an attribute called prefix for the <arg> nested
element, i.e. for the Commandline.Argument class. I guess there should also be
a postfix attribute for consistency, though I believe it would be used much
less often than the prefix. The above arguments could then be written as
<arg prefix="-I" file="include/dir"/>
<arg prefix="--exclude-from" file="excl.lst"/>
<arg prefix="--filter=.- " file="excl.lst"/>

I would suggest the prefix to be placed in front of every part of an argument,
if it is specified using the line parameter and thus broken into parts. This
might be useful e.g. to turn line="EL r" into the arguments '-Wl,EL' '-Wl,r'
for gcc, while some other prefix would be appropriate for a different compiler.
<arg prefix="${linker.option.prefix}" line="${linker.options.list}"/>

I will write a patch and attach it here shortly.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365





--- Comment #3 from Martin von Gagern <Ma...@gmx.net>  2009-06-13 07:43:44 PST ---
(In reply to comment #2)
> In your example, you sometimes omit the =, and sometimes not, to yield a single
> =, so I suspect you meant to write suffix="--exclude-from=", no?

You are right, that was my intention. Thanks for noticing.

> Regarding prefix="--filter=.- ", note that by default the space is preserved,
> because there's no Ant official DTD, but if somehow one does run with a DTD,
> and the attribute is not of declared type CDATA, then white-space normalization
> [...] would remove the trailing space.

Sounds like a rather obscure scenario. The only non-CDATA type I can fathom
would make any sense in this respect would be an Enumeration, in which case all
valid values must be Nmtokens in any case, so it cannot possibly end in a
space.

> Otherwise I like this feature. I've wished for it myself in the past, without
> actually implementing it (partly because I used Ant-Contrib's CppTask). --DD

Happy to hear that. Let's hope this makes it into ant soon. Care to vote? :-D

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365





--- Comment #2 from Dominique Devienne <dd...@gmail.com>  2009-06-13 06:42:09 PST ---
In your example, you sometimes omit the =, and sometimes not, to yield a single
=, so I suspect you meant to write suffix="--exclude-from=", no?

Regarding prefix="--filter=.- ", note that by default the space is preserved,
because there's no Ant official DTD, but if somehow one does run with a DTD,
and the attribute is not of declared type CDATA, then white-space normalization
from http://www.w3.org/TR/2008/REC-xml-20081126/#AVNormalize would remove the
trailing space. Note of general concern, but I'm mentioning it nonetheless.

Otherwise I like this feature. I've wished for it myself in the past, without
actually implementing it (partly because I used Ant-Contrib's CppTask). --DD

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.0




--- Comment #4 from Stefan Bodewig <bo...@apache.org>  2009-06-26 05:42:06 PST ---
slightly modified patch included in svn revision 788677 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=788677 )

I've added two trivial tests but more tests would (as always) be welcome.

Thanks!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365





--- Comment #6 from Stefan Bodewig <bo...@apache.org>  2009-07-06 00:51:10 PST ---
committed as svn revision 791400 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=791400 )

Thanks

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365





--- Comment #5 from Martin von Gagern <Ma...@gmx.net>  2009-07-05 07:49:06 PST ---
Created an attachment (id=23924)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23924)
testPrefixSuffixLine testcase

(In reply to comment #4)
> slightly modified patch included in svn revision 788677 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=788677 )

Thanks, both for comitting it as well as for fixing my documentation errors.

> I've added two trivial tests but more tests would (as always) be welcome.

Here is one more, using setLine to test the behaviour in the presence of
multiple arguments. It also tests for space in the prefix, ensuring that
arguments don't get broken again. I assume this case should ward against the
most likely future regression. Haven't run the tests locally yet.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47365] Allow prefix for command line arguments

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47365





--- Comment #1 from Martin von Gagern <Ma...@gmx.net>  2009-06-12 23:18:19 PST ---
Created an attachment (id=23808)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23808)
Implement and document prefix and suffix attributes

If my English is correct, one attribute should be called "suffix", not
"postfix" as I originally proposed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.