You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Eli Skoran <el...@telmap.com> on 2012/10/29 08:39:41 UTC
question about tstamp
Hello.
I am using tstamp and I have a problem I did not find a solution for:
Here is a code sample:
<project name="XXX">
<tstamp>
<format property="date" pattern="dd_MM_yyyy" />
<format property="time" pattern="HH_mm_ss" />
</tstamp>
<property name = "version.name" value="VERSION_NAME_${date}_${time}" />
<property name = "fullpath.tag.name" value="${svn.tags}/${version.name}" />
<target name="create.tag">
<if>
<svnExists target="${fullpath.tag.name}"/>
<then>
<echo>SVN tag already exists: ${fullpath.tag.name}, reusing</echo>
</then>
<else>
<echo>Creating new folder in SVN: ${fullpath.tag.name}</echo>
<svn username="${svn.username}" password="${svn.password}">
<mkdir url="${fullpath.tag.name}" message="tag: ${p.tag}" />
</svn>
<foreach param="module_name" target="tag.module" list="${svn.projects}" parallel="false" maxthreads="10" delimiter=";"/>
</else></if>
</target>
<target name="tag.module">
<echo message="tagging ${module_name}" />
<echo>Copying from ${svn.root}/${module_name} to ${fullpath.tag.name}</echo>
<svn username="${svn.username}" password="${svn.password}">
<copy srcUrl="${svn.root}/${module_name}" destUrl="${fullpath.tag.name}" message="tag: ${version.name}" />
</svn>
</target>
The problem is that each time version.name is used (inside the forreach -> tag.module) the timestamp is different, hence there is a new folder created in SVN.
How can I fix that?
Thanks.
Eli Skoran
AW: question about tstamp
Posted by .
Use <ac:foreach inheritrefs="true"/>
Jan
<project default="main">
<tstamp>
<format property="time" pattern="HH:mm:ss,SSS" />
</tstamp>
<presetdef name="list">
<ac:foreach param="nr" list="1,2,3,4,5,6,7,8,9" target="mod" xmlns:ac="antlib:net.sf.antcontrib"/>
</presetdef>
<target name="main">
<echo>${time}</echo>
<echo>***************** inheritall="false" *****************</echo>
<list inheritall="false"/>
<echo>***************** inheritall="true" *****************</echo>
<list inheritall="true"/>
</target>
<target name="mod">
<echo>${nr}: ${time}</echo>
</target>
</project>
-----Ursprüngliche Nachricht-----
Von: Eli Skoran [mailto:eli.skoran@telmap.com]
Gesendet: Montag, 29. Oktober 2012 08:40
An: user@ant.apache.org
Betreff: question about tstamp
Hello.
I am using tstamp and I have a problem I did not find a solution for:
Here is a code sample:
<project name="XXX">
<tstamp>
<format property="date" pattern="dd_MM_yyyy" />
<format property="time" pattern="HH_mm_ss" />
</tstamp>
<property name = "version.name" value="VERSION_NAME_${date}_${time}" />
<property name = "fullpath.tag.name" value="${svn.tags}/${version.name}" />
<target name="create.tag">
<if>
<svnExists target="${fullpath.tag.name}"/>
<then>
<echo>SVN tag already exists: ${fullpath.tag.name}, reusing</echo>
</then>
<else>
<echo>Creating new folder in SVN: ${fullpath.tag.name}</echo>
<svn username="${svn.username}" password="${svn.password}">
<mkdir url="${fullpath.tag.name}" message="tag: ${p.tag}" />
</svn>
<foreach param="module_name" target="tag.module" list="${svn.projects}" parallel="false" maxthreads="10" delimiter=";"/>
</else></if>
</target>
<target name="tag.module">
<echo message="tagging ${module_name}" />
<echo>Copying from ${svn.root}/${module_name} to ${fullpath.tag.name}</echo>
<svn username="${svn.username}" password="${svn.password}">
<copy srcUrl="${svn.root}/${module_name}" destUrl="${fullpath.tag.name}" message="tag: ${version.name}" />
</svn>
</target>
The problem is that each time version.name is used (inside the forreach -> tag.module) the timestamp is different, hence there is a new folder created in SVN.
How can I fix that?
Thanks.
Eli Skoran
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org