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 2010/08/16 18:49:25 UTC

DO NOT REPLY [Bug 49756] New: Copy doesn't support string resources

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

           Summary: Copy doesn't support string resources
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: info_issues.apache.org@nmhq.net


I tried to use

    <copy tofile="${dir}/somefile">
        <first>
            <sort>
                <exists/>
                <resources>
                    <fileset file="${dir}/somefile"/>
                    <string value="default contents"/>
                </resources>
            </sort>
        </first>
    </copy>

within a macrofed to conditionally generate somefile in ${dir} if it doesn't
exists already. This fails in the <string> case with the error message" Only
FileSystem resources are supported when concatenating files."

Strangely, when using <concat> instead of <copy>, the <string> case works. But
the <fileset> case then fails, because <concat> isn't capable of copying a file
onto itself ("Destination resource ... was specified as an input resource").

I can't use properties to control the condition because it's in a macrodef, and
the properties would persist between macro invocations.

-- 
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 49756] Copy doesn't support string resources

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

--- Comment #2 from Stefan Bodewig <bo...@apache.org> 2010-08-17 06:23:15 EDT ---
OK, this is not really a bug, it is expected behaviour.

When you use the tofile attribute, only file system resources are supported.
Not that I'd see any good reason why tofile couldn't work with arbitrary
resources, but it is the way it is - I'll change this to an enhancement request
later.

The documentation even says so if you are willing to read it that way (no, it
is
not clear and I'll change that as well):

> To use a resource collection, the todir attribute must be set.

In your case you want to do something like

<copy todir="${dir}">
  <mergemapper to="somefile"/>
  ...
</copy>

-- 
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 49756] Copy doesn't support string resources

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

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2010-08-17 05:57:57 EDT ---
Just some notes - regardless of whether there is a bug or not:

I think your usage of sort is wrong for what you are trying to do, in the case
where the file exists, both resources compare equal and I don't think Ant
makes any guarantee as to which one will come out first.

If the file doesn't exist, it is considered smaller than the string (according
to the manual, haven't checked the code) and thus would come before the string.

You probably want something like

    <copy tofile="${dir}/somefile">
        <first>
            <union>
                <restrict>
                    <exists/>
                    <fileset file="${dir}/somefile"/>
                </restrict>
                <string value="default contents"/>
            </union>
        </first>
    </copy>

Re: properties in macrodef - take a look at the local task.

-- 
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 49756] Copy doesn't support non-filesystem resources when the tofile attribute is used

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Copy doesn't support string |Copy doesn't support
                   |resources                   |non-filesystem resources
                   |                            |when the tofile attribute
                   |                            |is used
           Severity|normal                      |enhancement

--- Comment #3 from Stefan Bodewig <bo...@apache.org> 2010-08-17 06:28:43 EDT ---
documentation has been clarified with svn revision 986261

-- 
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 49756] Copy doesn't support non-filesystem resources when the tofile attribute is used

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

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

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

--- Comment #4 from Stefan Bodewig <bo...@apache.org> 2010-08-17 08:23:33 EDT ---
implemented with svn revision 986290

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