ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael Petterson (KI/EAB)" <>
Subject RE: make properites of data in file
Date Mon, 17 Oct 2005 10:17:26 GMT

which version of rhino(js) and bsf do you use?



-----Original Message-----
From: []
Sent: den 17 oktober 2005 11:23
Subject: AW: make properites of data in file

The easiest way is defining the Ant properties and creating the product.attributes.
But you can parse that file and assign properties ... using your own task.

Quick hack (without any error handling). It parses the first line to get the meta data
and parses the second line for the data. After that it stores the values.



<scriptdef name="getProductInfos" language="javascript">
    <attribute name="prefix"/>
    <attribute name="file"/>
        // imports
        // constants
        splitChar = ":";

        // arguments
        prefix = attributes.get("prefix");
        file   = attributes.get("file");

        // read the file
        rdr = new;
        content = FileUtils.readFully(rdr);

        // split into metadata and content data
        lines = content.split( project.getProperty("line.separator") );
        header = lines[0];
        body = lines[1];

        // get the metadata
        metaData = header.split(splitChar);

        // get the content data and save as Ant properties
        contentData = body.split(splitChar);
        for (i=0; i<contentData.length; i++) {
            project.setNewProperty(prefix + "." + metaData[i], contentData[i]);

<getProductInfos prefix="prod" file="product.attributes"/>
<echoproperties prefix="prod"/>



>-----Urspr√ľngliche Nachricht-----
>Von: Mikael Petterson (KI/EAB) [] 
>Gesendet: Montag, 17. Oktober 2005 10:38
>Betreff: make properites of data in file
>I have the following properties in my build.xml:
><property name="target" value="xxx"/>
><property name="productnumber" value="yyy"/> <property 
>name="productrevision" value="zzz"/>
>In a file called product.attribues I have the following information:
>Is it possible to assign ant properties with the values in my files? 
>To unsubscribe, e-mail: For 
>additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message