ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MARZIOU,GAEL (HP-France,ex1)" <>
Subject RE: Perforce tasks
Date Fri, 21 Jun 2002 10:53:01 GMT
Thanks for your fast answer.

I'll make patches but I don't want to go into long discussions about
unmutable properties, so if it takes too long I will keep my custom task.

You're right that P4 counters are rather "powerful", so as you did I also
looked at the p4 edit/submit alternative but then I have to complexify
cruise control setup for continuous integration to make it ignore changes to
version files.

Thanks for your javascript example, however I try to limit the number of
programming languages required for our projects.

So, below is an alternative that uses a temporary property file.

<target name="counter" description="Increment a Perforce counter">
   <!-- get counter value from Perforce --> 
   <p4counter name="${framework.counter}" property="counter" />
   <echo message="${counter} from P4"/>

   <!-- use property file to increment counter -->
   <delete file="" quiet="yes"/>
   <propertyfile file="">
	<entry key="buildNumber" type="int" value="${counter}"/>
   <propertyfile file="">
	<entry key="buildNumber" type="int" operation="+" value="1"/>
   <property file="./"/>
   <delete file="" quiet="yes"/>
   <!-- update counter value in Perforce --> 
   <p4counter name="${framework.counter}" value="${buildNumber}" />

   <!-- get counter value from Perforce --> 
   <p4counter name="${framework.counter}" property="counter" />
   <echo message="${counter} from P4"/>

Best regards,


-----Original Message-----
From: Les Hughes []
Sent: vendredi 21 juin 2002 11:43
To: ''
Cc: 'MARZIOU,GAEL (HP-France,ex1) '; ' '
Subject: RE: Perforce tasks


Thanks for you feedback. Can you submit a patch for the documentation to

As for changing p4counter - well, the perms required to update counters in
perforce are quiet "powerful". Since these grant a whole bunch of perms, I
haven't actually found the counter to be of much use. Have you seen the
counter task? I'd rather use this with a p4edit and p4submit to keep the
build number in a file. The other way is to use the script task and do
something like

<target name="label">
<p4counter name="buildnumber" property=""/>
<script language="javascript">
var count;
count = parseInt(label.getProject().getProperty(""));
if(isNaN(count)) count =0;
<p4counter name="buildnumber" value="${}"/>

But anyway, feel free to change the code - it's not mine anymore, it's
everybodies/anybodies - and submit a patch to ant-dev.

Oh and BTW, this'll probably open up the mutable properties can of worms
again ;-)


PS. Again, I dont mind answering direct but could you keep you mails to
ant-dev or ant-user? That way they get into the archive and everyone
benefits. Ta.

-----Original Message-----
From: MARZIOU,GAEL (HP-France,ex1)
Sent: 6/21/02 10:29 AM
Subject: Perforce tasks

Hi Les and Kirk,

First, let me thank you for developing the Perforce ant tasks.

I found an error in p4counter documentation, last example is wrong:

<p4counter name="last-clean-build" property="${}" />

Property should contain the name of property and not its value, so it

<p4counter name="last-clean-build" property="" />

I need a new feature for p4counter, possibility to increment a counter,
have thought of adding a new attribute "increment":

<p4counter name="last-clean-build" increment="1" />

would increment last-clean-build counter by 1

<p4counter name="last-clean-build" increment="1"
property="" />

would increment last-clean-build counter by 1 and set the property with
updated value.

What do you think of this feature?

I was planning to implement it myself but I would like to know if you
agree to include it in official release.
Or maybe there is a simpler solution that could be implemented using
ant task.


Gael Marziou

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

View raw message