You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nan Null <nu...@gmail.com> on 2008/09/19 16:29:48 UTC

Using property file to store a list

Hi, I need to provide a fileset in ANT that is customizable by the
developers.  To do that, I am thinking of a customized property file
for each developer to put in the list of files for the fileset.  My
question is how do I have this in the property file?  I am thinking of
a comma separated property.  Then how do I turn this single value with
comma separated into a fileset inside ANT?  Is there another method?
If not, please give me a hint on write some custom code to make this a
fileset.  I am not asking on how to split a string here.  I mean to
ask for how to extends ANT so I can have a customized fileset like
this.  Thanks.

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


Re: Using property file to store a list

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Right, more-or-less what I was trying to say :)

On Fri, 19 Sep 2008, Nan Null wrote:

> I found the closest match so far with this:
>
> http://marc.info/?l=ant-user&m=108315917624682&w=2
>
>>    <scripttypedef name="myfileset" language="beanshell">
>>    import org.apache.tools.ant.types.FileSet;
>>    public class MyFileSet extends FileSet {
>>    }
>>    </scripttypedef>
>>    <myfileset id="x" dir="." includes="*.xml"/>
>>    <concat>
>>      <fileset refid="x"/>
>>    </concat>
>
>
> On Fri, Sep 19, 2008 at 10:42 AM, Scot P. Floess <fl...@mindspring.com> wrote:
>>
>> How about a macrodef with an optional element?  Or something like that?
>>
>> On Fri, 19 Sep 2008, Nan Null wrote:
>>
>>> Hi, I need to provide a fileset in ANT that is customizable by the
>>> developers.  To do that, I am thinking of a customized property file
>>> for each developer to put in the list of files for the fileset.  My
>>> question is how do I have this in the property file?  I am thinking of
>>> a comma separated property.  Then how do I turn this single value with
>>> comma separated into a fileset inside ANT?  Is there another method?
>>> If not, please give me a hint on write some custom code to make this a
>>> fileset.  I am not asking on how to split a string here.  I mean to
>>> ask for how to extends ANT so I can have a customized fileset like
>>> this.  Thanks.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>
>> Scot P. Floess
>> 27 Lake Royale
>> Louisburg, NC  27549
>>
>> 252-478-8087 (Home)
>> 919-754-4592 (Work)
>>
>> Chief Architect JPlate   http://sourceforge.net/projects/jplate
>> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>>
>> Architect Keros          http://sourceforge.net/projects/keros
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


Re: Using property file to store a list

Posted by Nan Null <nu...@gmail.com>.
I found the closest match so far with this:

http://marc.info/?l=ant-user&m=108315917624682&w=2

>    <scripttypedef name="myfileset" language="beanshell">
>    import org.apache.tools.ant.types.FileSet;
>    public class MyFileSet extends FileSet {
>    }
>    </scripttypedef>
>    <myfileset id="x" dir="." includes="*.xml"/>
>    <concat>
>      <fileset refid="x"/>
>    </concat>


On Fri, Sep 19, 2008 at 10:42 AM, Scot P. Floess <fl...@mindspring.com> wrote:
>
> How about a macrodef with an optional element?  Or something like that?
>
> On Fri, 19 Sep 2008, Nan Null wrote:
>
>> Hi, I need to provide a fileset in ANT that is customizable by the
>> developers.  To do that, I am thinking of a customized property file
>> for each developer to put in the list of files for the fileset.  My
>> question is how do I have this in the property file?  I am thinking of
>> a comma separated property.  Then how do I turn this single value with
>> comma separated into a fileset inside ANT?  Is there another method?
>> If not, please give me a hint on write some custom code to make this a
>> fileset.  I am not asking on how to split a string here.  I mean to
>> ask for how to extends ANT so I can have a customized fileset like
>> this.  Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC  27549
>
> 252-478-8087 (Home)
> 919-754-4592 (Work)
>
> Chief Architect JPlate   http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM  http://sourceforge.net/projects/javapim
>
> Architect Keros          http://sourceforge.net/projects/keros
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Using property file to store a list

Posted by "Scot P. Floess" <fl...@mindspring.com>.
How about a macrodef with an optional element?  Or something like that?

On Fri, 19 Sep 2008, Nan Null wrote:

> Hi, I need to provide a fileset in ANT that is customizable by the
> developers.  To do that, I am thinking of a customized property file
> for each developer to put in the list of files for the fileset.  My
> question is how do I have this in the property file?  I am thinking of
> a comma separated property.  Then how do I turn this single value with
> comma separated into a fileset inside ANT?  Is there another method?
> If not, please give me a hint on write some custom code to make this a
> fileset.  I am not asking on how to split a string here.  I mean to
> ask for how to extends ANT so I can have a customized fileset like
> this.  Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

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


is broken with Jython in 1.7.1

Posted by ex...@nokia.com.
Hi,

I am getting this with error with 1.7.1 and not with 1.7.0. Calling just
self.xxx doesn't cause problems. There was a similar issue, I've
included below.

SyntaxError: ('invalid syntax', ('<string>', 2, 13, "errorsTotal =
project.getPr
operty('build.errors.total')"))

        <condition property="compile.result">
            <scriptcondition language="jython">
errorsTotal = project.getProperty('build.errors.total')
self.setValue(True)
            </scriptcondition>
        </condition>
Thanks

List:       ant-dev
Subject:    <scriptcondition> is broken with Jython in the recent trunk
builds
From:       "Alexey N. Solofnenko" <A.Solofnenko () mdl ! com>
Date:       2007-07-30 23:08:30
Message-ID: 46AE6F6E.3000700 () mdl ! com
[Download message RAW]

Recent trunk ANT fails in my builds because <scriptcondition> does 
something with the script that Jython cannot digest (new lines?).  
<script> with the same code works fine. This is a test script:

<project>
  <script language="jython"><![CDATA[ # test
self.log("test")
]]>
  </script>
  <condition property="test">
    <scriptcondition language="jython"><![CDATA[ # test
self.log("test")
]]>
    </scriptcondition>
  </condition>
</project>

and the output is:

Buildfile: test.xml
   [script] test

BUILD FAILED
C:\tmp\test.xml:6: Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('<string>', 1, 8, ' # test'))


Total time: 0 seconds

- Alexey.

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


is broken with Jython in 1.7.1

Posted by ex...@nokia.com.
Hi,

I am getting this with error with 1.7.1 and not with 1.7.0. Calling just
self.xxx doesn't cause problems. There was a similar issue, I've
included below.

SyntaxError: ('invalid syntax', ('<string>', 2, 13, "errorsTotal =
project.getPr
operty('build.errors.total')"))

        <condition property="compile.result">
            <scriptcondition language="jython">
errorsTotal = project.getProperty('build.errors.total')
self.setValue(True)
            </scriptcondition>
        </condition>
Thanks

List:       ant-dev
Subject:    <scriptcondition> is broken with Jython in the recent trunk
builds
From:       "Alexey N. Solofnenko" <A.Solofnenko () mdl ! com>
Date:       2007-07-30 23:08:30
Message-ID: 46AE6F6E.3000700 () mdl ! com
[Download message RAW]

Recent trunk ANT fails in my builds because <scriptcondition> does 
something with the script that Jython cannot digest (new lines?).  
<script> with the same code works fine. This is a test script:

<project>
  <script language="jython"><![CDATA[ # test
self.log("test")
]]>
  </script>
  <condition property="test">
    <scriptcondition language="jython"><![CDATA[ # test
self.log("test")
]]>
    </scriptcondition>
  </condition>
</project>

and the output is:

Buildfile: test.xml
   [script] test

BUILD FAILED
C:\tmp\test.xml:6: Traceback (innermost last):
  (no code object) at line 0
SyntaxError: ('invalid syntax', ('<string>', 1, 8, ' # test'))


Total time: 0 seconds

- Alexey.

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


Re: Using property file to store a list

Posted by Nan Null <nu...@gmail.com>.
Yes, I meant properties file.  However, any file would do, because I
will create the file.
Your reply is just what I was looking for.

Thank you very much and have a good weekend.

On Fri, Sep 19, 2008 at 1:20 PM, Matt Benson <gu...@yahoo.com> wrote:
> Do you really mean a properties file?  e.g.
>
> filestoinclude=foo,bar,baz,blah,whatever,etc
>
> Then you can simply use <fileset dir="wheretolook"
> includes="${filestoinclude}" /> after loading the
> properties file.
>
> If you actually mean a separate file containing only
> the names of the files to include, you'd use an
> includesfile with <fileset> (common basedir/relative
> paths) or <files> (absolute paths).  Note that these
> are one pattern per line, however, and don't support
> comments (If you needed to support comments, you could
> <concat> and filter the original).  If you really need
> a single line containing comma-delimited files, you
> could filter that to an includesfile as well.  The
> good thing about includesfiles is that you can use
> them to specify paths with whitespace; IIRC you can't
> do that with <fileset|files>' includes attribute.
>
> HTH,
> Matt
>
> --- Nan Null <nu...@gmail.com> wrote:
>
>> Hi, I need to provide a fileset in ANT that is
>> customizable by the
>> developers.  To do that, I am thinking of a
>> customized property file
>> for each developer to put in the list of files for
>> the fileset.  My
>> question is how do I have this in the property file?
>>  I am thinking of
>> a comma separated property.  Then how do I turn this
>> single value with
>> comma separated into a fileset inside ANT?  Is there
>> another method?
>> If not, please give me a hint on write some custom
>> code to make this a
>> fileset.  I am not asking on how to split a string
>> here.  I mean to
>> ask for how to extends ANT so I can have a
>> customized fileset like
>> this.  Thanks.
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@ant.apache.org
>> For additional commands, e-mail:
>> user-help@ant.apache.org
>>
>>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Using property file to store a list

Posted by Matt Benson <gu...@yahoo.com>.
Do you really mean a properties file?  e.g.

filestoinclude=foo,bar,baz,blah,whatever,etc

Then you can simply use <fileset dir="wheretolook"
includes="${filestoinclude}" /> after loading the
properties file.

If you actually mean a separate file containing only
the names of the files to include, you'd use an
includesfile with <fileset> (common basedir/relative
paths) or <files> (absolute paths).  Note that these
are one pattern per line, however, and don't support
comments (If you needed to support comments, you could
<concat> and filter the original).  If you really need
a single line containing comma-delimited files, you
could filter that to an includesfile as well.  The
good thing about includesfiles is that you can use
them to specify paths with whitespace; IIRC you can't
do that with <fileset|files>' includes attribute.

HTH,
Matt

--- Nan Null <nu...@gmail.com> wrote:

> Hi, I need to provide a fileset in ANT that is
> customizable by the
> developers.  To do that, I am thinking of a
> customized property file
> for each developer to put in the list of files for
> the fileset.  My
> question is how do I have this in the property file?
>  I am thinking of
> a comma separated property.  Then how do I turn this
> single value with
> comma separated into a fileset inside ANT?  Is there
> another method?
> If not, please give me a hint on write some custom
> code to make this a
> fileset.  I am not asking on how to split a string
> here.  I mean to
> ask for how to extends ANT so I can have a
> customized fileset like
> this.  Thanks.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



      

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