2 messages in com.perforce.perforce-user[p4] Using labels as tags in built files
FromSent OnAttachments
David Evans13 Feb 2004 14:57 
Matt Stave13 Feb 2004 15:26 
Subject:[p4] Using labels as tags in built files
From:Matt Stave (MSt@alphablox.com)
Date:02/13/2004 03:26:36 PM
List:com.perforce.perforce-user

Does this help? I don't quite get what your asking, but here's how I do some related stuff. Bear in mind I'm a Perforce newbie, and I haven't tested this yet. This uses ANT 1.5.3:

<target name="get.buildnum"> <echo message="Getting build.number" /> <available file="${project.dir}\build.number" property="build.number.found" /> <fail unless="build.number.found" message="${project.dir}\build.number not found" /> <property file="${project.dir}\build.number" /> <echo message="... build number found [${cmbuild.number}]" /> </target>

<target name="update.buildnum"> <p4change description="updating build.number from ${cmbuild.number}"/> <p4edit view="//depot/${project.name}/build.number" /> <propertyfile file="${project.dir}/build.number" > <entry key="cmbuild.number" operation="+" value="1" type="int" /> </propertyfile> <p4submit change="${p4.change}" /> </target>

<target name="label" > <p4label view="//depot/${project.name}/..." name="${project.name}.${p4.buildnum}" description="cmbuild"/> <exec failonerror="false" executable="cmd.exe"> <arg value="/c" /> <arg value="p4" /> <arg value="labelsync" /> <arg value="-l" /> <arg value="${project.name}.${p4.buildnum}" /> <arg value="//depot/${project.name}/...#have" /> </exec> </target>

If you need to get a label name into a file you could do:

<echo file="label.property" message="label=${labelname}" /> or in my case it'd be <echo file="label.property" message="label=${project.name}.${p4.buildnum}" />

Sorry if I missed your point, which I suspect I have...

--- Matt

-----Original Message----- From: perf@perforce.com [mailto:perforce-user-admin at perforce.com]On Behalf Of David Evans Sent: Friday, February 13, 2004 2:58 PM To: perforce-user at perforce.com Subject: [p4] Using labels as tags in built files

I'm using ant to build a product (from mostly Java source) and I want to to be able to tag all of the files in a single build with some string I can later retreive as "product version" from the built objects.

I'd like to be able to use the Perforce Label as this string but I can't see a way of pushing the label name into a client workspace when I sync it to the label using P4WIN. I've checked the docs and I can't see anything obvious with cmd-line p4 either.

I know how to get strings from properties into files via ant ... I don't know how to get the label string I want into a place where I can use it.

Being able to reconcile a build with a known [and named] set of files is so basic that I think I must be missing something obvious here.

Any advice on how to send label info to a workspace, or a better way of reconciling a build with a named SCM state would be most welcome.

Thanks