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="counter.properties" quiet="yes"/>
<propertyfile file="counter.properties">
<entry key="buildNumber" type="int" value="${counter}"/>
</propertyfile>
<propertyfile file="counter.properties">
<entry key="buildNumber" type="int" operation="+" value="1"/>
</propertyfile>
<property file="./counter.properties"/>
<delete file="counter.properties" 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"/>
</target>
Best regards,
Gael
-----Original Message-----
From: Les Hughes [mailto:leslie.hughes@rubus.com]
Sent: vendredi 21 juin 2002 11:43
To: 'ant-user@jakarta.apache.org'
Cc: 'MARZIOU,GAEL (HP-France,ex1) '; 'kirk@radik.com '
Subject: RE: Perforce tasks
Hi,
Thanks for you feedback. Can you submit a patch for the documentation to
ant-dev?
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="p4.build.count"/>
<script language="javascript">
<![CDATA[
var count;
count = parseInt(label.getProject().getProperty("p4.build.count"));
if(isNaN(count)) count =0;
label.getProject().setProperty("p4.build.count",++count);
]]>
</script>
<p4counter name="buildnumber" value="${p4.build.count}"/>
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 ;-)
Bye,
Les
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)
To: leslie.hughes@rubus.com; kirk@radik.com
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="${p4.last.clean.build}" />
Property should contain the name of property and not its value, so it
should
be:
<p4counter name="last-clean-build" property="p4.last.clean.build" />
I need a new feature for p4counter, possibility to increment a counter,
I
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="p4.last.clean.build" />
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
would
agree to include it in official release.
Or maybe there is a simpler solution that could be implemented using
another
ant task.
Thanks,
Gael Marziou
--
To unsubscribe, e-mail: <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
|