ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46440] New: loadfile not overwriting property
Date Tue, 23 Dec 2008 22:56:03 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46440

           Summary: loadfile not overwriting property
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: chad.retz@gmail.com


In the following build script, only the initial file (Test1.js) is loaded into
file.contents and nothing else is after that. The @{srcfile} does change
everytime:

<project name="js-merger" default="merge" basedir=".">    
    <!-- simple file appender -->
    <macrodef name="fileappend">
        <attribute name="srcfile" />
        <attribute name="destfile" />
        <sequential>
            <tstamp>
                <format property="current.time" pattern="MM/dd/yyyy hh:mm aa"
/>
            </tstamp>
            <echo file="@{destfile}" append="true"><![CDATA[
/**
 * Imported by js-merger from @{srcfile} at ${current.time}
 * --------------------------------------------------------
 */  
]]></echo>
            <loadfile property="file.contents" srcFile="@{srcfile}" />
            <echo message="${file.contents}" file="@{destfile}" append="true"
/>
        </sequential>
    </macrodef>
    <target name="merge">
        <property name="dest.file" value="Combined.js" />
        <!-- clean -->
        <delete file="${dest.file}" />
        <!-- write -->
        <fileappend srcfile="Test1.js" destfile="${dest.file}" />
        <fileappend srcfile="Test2.js" destfile="${dest.file}" />
        <fileappend srcfile="Test3.js" destfile="${dest.file}" />
        <fileappend srcfile="Test4.js" destfile="${dest.file}" />
        <fileappend srcfile="Test5.js" destfile="${dest.file}" />
    </target>
</project>

ant -version
Apache Ant version 1.7.0 compiled on December 13 2006

I haven't bothered to look at the source yet, but I will. Of course, I can work
around like by changing my macrodef to:

    <macrodef name="fileappend">
        <attribute name="srcfile" />
        <attribute name="destfile" />
        <sequential>
            <tstamp>
                <format property="current.time" pattern="MM/dd/yyyy hh:mm aa"
/>
            </tstamp>
            <echo file="@{destfile}" append="true"><![CDATA[
/**
 * Imported by js-merger from @{srcfile} at ${current.time}
 * --------------------------------------------------------
 */  
]]></echo>
            <loadfile property="file.contents.@{srcfile}" srcFile="@{srcfile}"
/>
            <echo message="${file.contents.@{srcfile}}" file="@{destfile}"
append="true" />
        </sequential>
    </macrodef>

It'd be worth mentioning in the manual if this is intentional behavior.


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

Mime
View raw message