You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Salter <ma...@talktalk.net> on 2008/10/14 23:16:23 UTC

Ant 1.7.1 - concat function no longer returns an 'empty' file if no source resources are found...

Hi there.

I would like to understand the expected result of a concat step that
'finds' no source files.

I believe that prior to version 1.7.1 the resultant file could include
header and footer even if the no other files went in.

With 1.7.1, class :-

   src/main/org/apache/tools/ant/taskdefs/Concat.java

checks for zero source and returns.

I would like to have a file produced if I specify a header or footer,
but I can see this might cause other people problems if they are
expecting no file at all to be produced in this situation, although this
was the result with 1.7.0.

Should I be checking that a file is produced out of concat, instead of
assuming there will be one (my next step is a copy which fails if the
cancat target is not created)?

The following patch would make it work for me, but is this a reasonable
change to suggest?

Index: src/main/org/apache/tools/ant/taskdefs/Concat.java
===================================================================
--- src/main/org/apache/tools/ant/taskdefs/Concat.java	(revision 704405)
+++ src/main/org/apache/tools/ant/taskdefs/Concat.java	(working copy)
@@ -733,7 +733,7 @@
             log(destinationFile + " is up-to-date.", Project.MSG_VERBOSE);
             return;
         }
-        if (c.size() == 0) {
+        if (c.size() == 0 && header == null && footer == null) {
             return;
         }
         OutputStream out;

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.7.1 - concat function no longer returns an 'empty' file if no source resources are found...

Posted by Mark Salter <ma...@talktalk.net>.
Stefan Bodewig wrote:
> I forgot to add: please file a bugzilla issue for it.

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

-- 
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.7.1 - concat function no longer returns an 'empty' file if no source resources are found...

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 15 Oct 2008, Stefan Bodewig <bo...@apache.org> wrote:

On Tue, 14 Oct 2008, Mark Salter <ma...@talktalk.net> wrote:

>> The following patch would make it work for me, but is this a
>> reasonable change to suggest?
> 
> I'd add a new attribute that controls what to do if there are no
> files to concatenate.

I forgot to add: please file a bugzilla issue for it.

Thanks

        Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.7.1 - concat function no longer returns an 'empty' file if no source resources are found...

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 14 Oct 2008, Mark Salter <ma...@talktalk.net> wrote:

> I would like to understand the expected result of a concat step that
> 'finds' no source files.
> 
> I believe that prior to version 1.7.1 the resultant file could
> include header and footer even if the no other files went in.
> 
> With 1.7.1, class :-
> 
>    src/main/org/apache/tools/ant/taskdefs/Concat.java
> 
> checks for zero source and returns.

sounds like a regression, but if we "fixed" it, we'd break
compatibility with 1.7.1.

> The following patch would make it work for me, but is this a
> reasonable change to suggest?

I'd add a new attribute that controls what to do if there are no files
to concatenate.  The default value is up for debate, but I'd opt for
1.7.1's behavior myself.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org