git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1442023 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -16,6 +16,8 @@ Changes that could break older environments: | |||
| * Any FileResource whose represented File has a parent also has a basedir. | |||
| * Removing the Perforce Ant tasks replaced by tasks supplied by Perforce Inc. | |||
| Fixed bugs: | |||
| ----------- | |||
| @@ -205,7 +205,6 @@ | |||
| <selector id="needs.apache-oro"> | |||
| <or> | |||
| <filename name="${regexp.package}/JakartaOro*"/> | |||
| <filename name="${optional.package}/perforce/"/> | |||
| </or> | |||
| </selector> | |||
| @@ -846,7 +846,7 @@ Installing Ant / Optional Tasks</a> section above.</p> | |||
| </tr> | |||
| <tr> | |||
| <td>jakarta-oro-2.0.8.jar</td> | |||
| <td>regexp type with mappers (if you do not wish to use java.util.regex) and the Perforce tasks<br> | |||
| <td>regexp type with mappers (if you do not wish to use java.util.regex)<br> | |||
| To use the FTP task, | |||
| you need jakarta-oro 2.0.8 or later, and <a href="#commons-net">commons-net</a></td> | |||
| <td><a href="http://attic.apache.org/projects/jakarta-oro.html" target="_top">http://attic.apache.org/projects/jakarta-oro.html</a></td> | |||
| @@ -457,13 +457,7 @@ org.apache.tools.ant.Executor implementation specified here. | |||
| org.apache.tools.ant.ArgumentProcessor. | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td><code>p4.port, p4.client, p4.user</code></td> | |||
| <td>several formats</td> | |||
| <td>Specify defaults for port-, client- and user-setting of the | |||
| <a href="Tasks/perforce.html">perforce</a> tasks. | |||
| </td> | |||
| </tr> | |||
| <tr> | |||
| <td><code>websphere.home</code></td> | |||
| <td>path</td> | |||
| @@ -132,7 +132,6 @@ | |||
| <li><a href="Tasks/parallel.html">Parallel</a></li> | |||
| <li><a href="Tasks/patch.html">Patch</a></li> | |||
| <li><a href="Tasks/pathconvert.html">PathConvert</a></li> | |||
| <li><a href="Tasks/perforce.html">Perforce Tasks</a></li> | |||
| <li><a href="Tasks/presetdef.html">PreSetDef</a></li> | |||
| <li><a href="Tasks/projecthelper.html">ProjectHelper</a></li> | |||
| <li><a href="Tasks/property.html">Property</a></li> | |||
| @@ -1142,13 +1142,7 @@ documentation.</p> | |||
| commands.</p></td> | |||
| </tr> | |||
| <tr valign="top"> | |||
| <td nowrap><a href="Tasks/perforce.html">Perforce</a></td> | |||
| <td><p>Tasks to perform the Perforce <i>p4sync</i>, <i>p4change</i>, | |||
| <i>p4edit</i>, <i>p4submit</i>, <i>p4have</i>, <i>p4label</i>, | |||
| <i>p4counter</i>, <i>p4reopen</i>, <i>p4revert</i>, and <i>p4add</i> | |||
| commands.</p></td> | |||
| </tr> | |||
| <tr valign="top"> | |||
| <td nowrap><a href="Tasks/pvcstask.html">Pvcs</a></td> | |||
| @@ -374,79 +374,78 @@ | |||
| <File DiskId="1" Id="file554" Name="MPARSE_1.HTM" LongName="mparse.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\mparse.html" /> | |||
| <File DiskId="1" Id="file555" Name="NATIVE_1.HTM" LongName="native2ascii.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\native2ascii.html" /> | |||
| <File DiskId="1" Id="file556" Name="NETREX_1.HTM" LongName="netrexxc.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\netrexxc.html" /> | |||
| <File DiskId="1" Id="file557" Name="PERFOR_1.HTM" LongName="perforce.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\perforce.html" /> | |||
| <File DiskId="1" Id="file558" Name="PROPER_1.HTM" LongName="propertyfile.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\propertyfile.html" /> | |||
| <File DiskId="1" Id="file559" Name="PVCSTA_1.HTM" LongName="pvcstask.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\pvcstask.html" /> | |||
| <File DiskId="1" Id="file560" Name="RENAME_1.HTM" LongName="renameextensions.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\renameextensions.html" /> | |||
| <File DiskId="1" Id="file561" Name="REPLAC_1.HTM" LongName="replaceregexp.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\replaceregexp.html" /> | |||
| <File DiskId="1" Id="file562" Name="REXEC_1.HTM" LongName="rexec.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\rexec.html" /> | |||
| <File DiskId="1" Id="file563" Name="RPM_1.HTM" LongName="rpm.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\rpm.html" /> | |||
| <File DiskId="1" Id="file564" Name="SCHEMA_1.HTM" LongName="schemavalidate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\schemavalidate.html" /> | |||
| <File DiskId="1" Id="file565" Name="SCP_1.HTM" LongName="scp.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\scp.html" /> | |||
| <File DiskId="1" Id="file566" Name="SCRIPT_2.HTM" LongName="script.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\script.html" /> | |||
| <File DiskId="1" Id="file567" Name="SCRIPT_1.HTM" LongName="scriptdef.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\scriptdef.html" /> | |||
| <File DiskId="1" Id="file568" Name="SERVER_1.HTM" LongName="serverdeploy.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\serverdeploy.html" /> | |||
| <File DiskId="1" Id="file569" Name="SETPRO_1.HTM" LongName="setproxy.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\setproxy.html" /> | |||
| <File DiskId="1" Id="file570" Name="SOS_1.HTM" LongName="sos.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sos.html" /> | |||
| <File DiskId="1" Id="file571" Name="SOUND_1.HTM" LongName="sound.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sound.html" /> | |||
| <File DiskId="1" Id="file572" Name="SPLASH_1.HTM" LongName="splash.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\splash.html" /> | |||
| <File DiskId="1" Id="file573" Name="SSHEXE_1.HTM" LongName="sshexec.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sshexec.html" /> | |||
| <File DiskId="1" Id="file574" Name="STARTE_1.HTM" LongName="starteam.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\starteam.html" /> | |||
| <File DiskId="1" Id="file576" Name="SYMLIN_1.HTM" LongName="symlink.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\symlink.html" /> | |||
| <File DiskId="1" Id="file577" Name="TELNET_1.HTM" LongName="telnet.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\telnet.html" /> | |||
| <File DiskId="1" Id="file578" Name="TRANSL_1.HTM" LongName="translate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\translate.html" /> | |||
| <File DiskId="1" Id="file579" Name="VBC_1.HTM" LongName="vbc.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\vbc.html" /> | |||
| <File DiskId="1" Id="file580" Name="VSS_1.HTM" LongName="vss.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\vss.html" /> | |||
| <File DiskId="1" Id="file581" Name="WLJSPC_1.HTM" LongName="wljspc.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\wljspc.html" /> | |||
| <File DiskId="1" Id="file582" Name="WSDLTO_1.HTM" LongName="wsdltodotnet.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\wsdltodotnet.html" /> | |||
| <File DiskId="1" Id="file583" Name="XMLVAL_1.HTM" LongName="xmlvalidate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\xmlvalidate.html" /> | |||
| <File DiskId="1" Id="file557" Name="PROPER_1.HTM" LongName="propertyfile.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\propertyfile.html" /> | |||
| <File DiskId="1" Id="file558" Name="PVCSTA_1.HTM" LongName="pvcstask.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\pvcstask.html" /> | |||
| <File DiskId="1" Id="file559" Name="RENAME_1.HTM" LongName="renameextensions.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\renameextensions.html" /> | |||
| <File DiskId="1" Id="file560" Name="REPLAC_1.HTM" LongName="replaceregexp.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\replaceregexp.html" /> | |||
| <File DiskId="1" Id="file561" Name="REXEC_1.HTM" LongName="rexec.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\rexec.html" /> | |||
| <File DiskId="1" Id="file562" Name="RPM_1.HTM" LongName="rpm.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\rpm.html" /> | |||
| <File DiskId="1" Id="file563" Name="SCHEMA_1.HTM" LongName="schemavalidate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\schemavalidate.html" /> | |||
| <File DiskId="1" Id="file564" Name="SCP_1.HTM" LongName="scp.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\scp.html" /> | |||
| <File DiskId="1" Id="file565" Name="SCRIPT_2.HTM" LongName="script.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\script.html" /> | |||
| <File DiskId="1" Id="file566" Name="SCRIPT_1.HTM" LongName="scriptdef.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\scriptdef.html" /> | |||
| <File DiskId="1" Id="file567" Name="SERVER_1.HTM" LongName="serverdeploy.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\serverdeploy.html" /> | |||
| <File DiskId="1" Id="file568" Name="SETPRO_1.HTM" LongName="setproxy.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\setproxy.html" /> | |||
| <File DiskId="1" Id="file569" Name="SOS_1.HTM" LongName="sos.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sos.html" /> | |||
| <File DiskId="1" Id="file570" Name="SOUND_1.HTM" LongName="sound.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sound.html" /> | |||
| <File DiskId="1" Id="file571" Name="SPLASH_1.HTM" LongName="splash.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\splash.html" /> | |||
| <File DiskId="1" Id="file572" Name="SSHEXE_1.HTM" LongName="sshexec.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\sshexec.html" /> | |||
| <File DiskId="1" Id="file573" Name="STARTE_1.HTM" LongName="starteam.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\starteam.html" /> | |||
| <File DiskId="1" Id="file574" Name="SYMLIN_1.HTM" LongName="symlink.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\symlink.html" /> | |||
| <File DiskId="1" Id="file575" Name="TELNET_1.HTM" LongName="telnet.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\telnet.html" /> | |||
| <File DiskId="1" Id="file576" Name="TRANSL_1.HTM" LongName="translate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\translate.html" /> | |||
| <File DiskId="1" Id="file577" Name="VBC_1.HTM" LongName="vbc.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\vbc.html" /> | |||
| <File DiskId="1" Id="file578" Name="VSS_1.HTM" LongName="vss.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\vss.html" /> | |||
| <File DiskId="1" Id="file579" Name="WLJSPC_1.HTM" LongName="wljspc.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\wljspc.html" /> | |||
| <File DiskId="1" Id="file580" Name="WSDLTO_1.HTM" LongName="wsdltodotnet.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\wsdltodotnet.html" /> | |||
| <File DiskId="1" Id="file581" Name="XMLVAL_1.HTM" LongName="xmlvalidate.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTasks\xmlvalidate.html" /> | |||
| </Component> | |||
| </Directory> | |||
| <Directory Id="directory93" Name="OPTION_2" LongName="OptionalTypes"> | |||
| <Component Id="component90" DiskId="1" Guid="0507ED6A-50CE-4c58-A046-B74E7CFCB3CA"> | |||
| <File DiskId="1" Id="file584" Name="CLASSF_1.HTM" LongName="classfileset.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\classfileset.html" /> | |||
| <File DiskId="1" Id="file585" Name="EXTENS_2.HTM" LongName="extension.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\extension.html" /> | |||
| <File DiskId="1" Id="file586" Name="EXTENS_1.HTM" LongName="extensionset.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\extensionset.html" /> | |||
| <File DiskId="1" Id="file582" Name="CLASSF_1.HTM" LongName="classfileset.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\classfileset.html" /> | |||
| <File DiskId="1" Id="file583" Name="EXTENS_2.HTM" LongName="extension.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\extension.html" /> | |||
| <File DiskId="1" Id="file584" Name="EXTENS_1.HTM" LongName="extensionset.html" Vital="yes" src="$(var.dist.dir)/docs\manual\OptionalTypes\extensionset.html" /> | |||
| </Component> | |||
| </Directory> | |||
| <Directory Id="directory94" Name="STYLES_1" LongName="stylesheets"> | |||
| <Component Id="component91" DiskId="1" Guid="4B25D154-CC25-4f93-8D36-BF23E4C29F06"> | |||
| <File DiskId="1" Id="file587" Name="ANTMAN_1.CSS" LongName="antmanual.css" Vital="yes" src="$(var.dist.dir)/docs\manual\stylesheets\antmanual.css" /> | |||
| <File DiskId="1" Id="file588" Name="style.css" Vital="yes" src="$(var.dist.dir)/docs\manual\stylesheets\style.css" /> | |||
| <File DiskId="1" Id="file585" Name="ANTMAN_1.CSS" LongName="antmanual.css" Vital="yes" src="$(var.dist.dir)/docs\manual\stylesheets\antmanual.css" /> | |||
| <File DiskId="1" Id="file586" Name="style.css" Vital="yes" src="$(var.dist.dir)/docs\manual\stylesheets\style.css" /> | |||
| </Component> | |||
| </Directory> | |||
| </Directory> | |||
| <Directory Id="directory95" Name="projects"> | |||
| <Component Id="component92" DiskId="1" Guid="FB149E10-8B7F-4206-AA50-8698C06BEC6E"> | |||
| <File DiskId="1" Id="file589" Name="INDEX_1.HTM" LongName="index.html" Vital="yes" src="$(var.dist.dir)/docs\projects\index.html" /> | |||
| <File DiskId="1" Id="file587" Name="INDEX_1.HTM" LongName="index.html" Vital="yes" src="$(var.dist.dir)/docs\projects\index.html" /> | |||
| </Component> | |||
| </Directory> | |||
| <Directory Id="directory96" Name="webtest"> | |||
| <Component Id="component93" DiskId="1" Guid="A26B499E-E57F-47e3-88B2-66C1293383BE"> | |||
| <File DiskId="1" Id="file590" Name="TESTKE_1" LongName="testkeystore" Vital="yes" src="$(var.dist.dir)/docs\webtest\testkeystore" /> | |||
| <File DiskId="1" Id="file588" Name="TESTKE_1" LongName="testkeystore" Vital="yes" src="$(var.dist.dir)/docs\webtest\testkeystore" /> | |||
| </Component> | |||
| </Directory> | |||
| </Directory> | |||
| <Directory Id="directory97" Name="etc"> | |||
| <Component Id="component94" DiskId="1" Guid="90BD5A92-DA62-48ce-8799-868E387EC7C8"> | |||
| <File DiskId="1" Id="file591" Name="ANT-BO_1.JAR" LongName="ant-bootstrap.jar" Vital="yes" src="$(var.dist.dir)/etc\ant-bootstrap.jar" /> | |||
| <File DiskId="1" Id="file592" Name="CHANGE_1.XSL" LongName="changelog.xsl" Vital="yes" src="$(var.dist.dir)/etc\changelog.xsl" /> | |||
| <File DiskId="1" Id="file593" Name="COVERA_1.XSL" LongName="coverage-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\coverage-frames.xsl" /> | |||
| <File DiskId="1" Id="file594" Name="JDEPEN_1.XSL" LongName="jdepend-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\jdepend-frames.xsl" /> | |||
| <File DiskId="1" Id="file595" Name="jdepend.xsl" Vital="yes" src="$(var.dist.dir)/etc\jdepend.xsl" /> | |||
| <File DiskId="1" Id="file596" Name="JUNIT-_3.XSL" LongName="junit-frames-xalan1.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-frames-xalan1.xsl" /> | |||
| <File DiskId="1" Id="file597" Name="JUNIT-_1.XSL" LongName="junit-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-frames.xsl" /> | |||
| <File DiskId="1" Id="file598" Name="JUNIT-_2.XSL" LongName="junit-noframes.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-noframes.xsl" /> | |||
| <File DiskId="1" Id="file599" Name="log.xsl" Vital="yes" src="$(var.dist.dir)/etc\log.xsl" /> | |||
| <File DiskId="1" Id="file600" Name="MAUDIT_1.XSL" LongName="maudit-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\maudit-frames.xsl" /> | |||
| <File DiskId="1" Id="file601" Name="MMETRI_1.XSL" LongName="mmetrics-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\mmetrics-frames.xsl" /> | |||
| <File DiskId="1" Id="file602" Name="tagdiff.xsl" Vital="yes" src="$(var.dist.dir)/etc\tagdiff.xsl" /> | |||
| <File DiskId="1" Id="file589" Name="ANT-BO_1.JAR" LongName="ant-bootstrap.jar" Vital="yes" src="$(var.dist.dir)/etc\ant-bootstrap.jar" /> | |||
| <File DiskId="1" Id="file590" Name="CHANGE_1.XSL" LongName="changelog.xsl" Vital="yes" src="$(var.dist.dir)/etc\changelog.xsl" /> | |||
| <File DiskId="1" Id="file591" Name="COVERA_1.XSL" LongName="coverage-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\coverage-frames.xsl" /> | |||
| <File DiskId="1" Id="file592" Name="JDEPEN_1.XSL" LongName="jdepend-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\jdepend-frames.xsl" /> | |||
| <File DiskId="1" Id="file593" Name="jdepend.xsl" Vital="yes" src="$(var.dist.dir)/etc\jdepend.xsl" /> | |||
| <File DiskId="1" Id="file594" Name="JUNIT-_3.XSL" LongName="junit-frames-xalan1.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-frames-xalan1.xsl" /> | |||
| <File DiskId="1" Id="file595" Name="JUNIT-_1.XSL" LongName="junit-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-frames.xsl" /> | |||
| <File DiskId="1" Id="file596" Name="JUNIT-_2.XSL" LongName="junit-noframes.xsl" Vital="yes" src="$(var.dist.dir)/etc\junit-noframes.xsl" /> | |||
| <File DiskId="1" Id="file597" Name="log.xsl" Vital="yes" src="$(var.dist.dir)/etc\log.xsl" /> | |||
| <File DiskId="1" Id="file598" Name="MAUDIT_1.XSL" LongName="maudit-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\maudit-frames.xsl" /> | |||
| <File DiskId="1" Id="file599" Name="MMETRI_1.XSL" LongName="mmetrics-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\mmetrics-frames.xsl" /> | |||
| <File DiskId="1" Id="file600" Name="tagdiff.xsl" Vital="yes" src="$(var.dist.dir)/etc\tagdiff.xsl" /> | |||
| </Component> | |||
| <Directory Id="directory98" Name="CHECKS_1" LongName="checkstyle"> | |||
| <Component Id="component95" DiskId="1" Guid="2AEB59C7-5CEF-401c-9AB9-911B995F00FC"> | |||
| <File DiskId="1" Id="file603" Name="CHECKS_1.XSL" LongName="checkstyle-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-frames.xsl" /> | |||
| <File DiskId="1" Id="file604" Name="CHECKS_3.XSL" LongName="checkstyle-text.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-text.xsl" /> | |||
| <File DiskId="1" Id="file605" Name="CHECKS_2.XSL" LongName="checkstyle-xdoc.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-xdoc.xsl" /> | |||
| <File DiskId="1" Id="file601" Name="CHECKS_1.XSL" LongName="checkstyle-frames.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-frames.xsl" /> | |||
| <File DiskId="1" Id="file602" Name="CHECKS_3.XSL" LongName="checkstyle-text.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-text.xsl" /> | |||
| <File DiskId="1" Id="file603" Name="CHECKS_2.XSL" LongName="checkstyle-xdoc.xsl" Vital="yes" src="$(var.dist.dir)/etc\checkstyle\checkstyle-xdoc.xsl" /> | |||
| </Component> | |||
| </Directory> | |||
| </Directory> | |||
| @@ -57,16 +57,12 @@ | |||
| <configuration> | |||
| <includes> | |||
| <include>org/apache/tools/ant/util/regexp/JakartaOro*</include> | |||
| <include>org/apache/tools/ant/taskdefs/optional/perforce/*</include> | |||
| </includes> | |||
| <testIncludes> | |||
| <include>org/apache/tools/ant/taskdefs/optional/perforce/*</include> | |||
| </testIncludes> | |||
| </configuration> | |||
| </plugin> | |||
| </plugins> | |||
| <sourceDirectory>../../../../src/main</sourceDirectory> | |||
| <testSourceDirectory>../../../../src/testcases</testSourceDirectory> | |||
| <testSourceDirectory>../../../../src/tests/junit</testSourceDirectory> | |||
| <outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory> | |||
| <testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory> | |||
| <directory>../../../../target/${project.artifactId}</directory> | |||
| @@ -102,7 +102,6 @@ | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/net/FTP*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/net/RExec*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/net/TelnetTask*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/perforce/*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/junit/*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/ssh/*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/image/*</exclude> | |||
| @@ -133,7 +132,6 @@ | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/junit/</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/net/FTP*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/ssh/*</exclude> | |||
| <exclude>org/apache/tools/ant/taskdefs/optional/perforce/*</exclude> | |||
| </testExcludes> | |||
| </configuration> | |||
| </plugin> | |||
| @@ -1,50 +0,0 @@ | |||
| <?xml version="1.0"?> | |||
| <!-- | |||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||
| contributor license agreements. See the NOTICE file distributed with | |||
| this work for additional information regarding copyright ownership. | |||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| (the "License"); you may not use this file except in compliance with | |||
| the License. You may obtain a copy of the License at | |||
| http://www.apache.org/licenses/LICENSE-2.0 | |||
| Unless required by applicable law or agreed to in writing, software | |||
| distributed under the License is distributed on an "AS IS" BASIS, | |||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <!-- author Antoine Levy-Lambert --> | |||
| <!-- this file demonstrates that p4.change will be modified by p4submit --> | |||
| <!-- if the change number is modified by the Perforce daemon during the submission --> | |||
| <project name="build1" default="runtest"> | |||
| <target name="runtest"> | |||
| <p4change/> | |||
| <property name="change1" value="${p4.change}" /> | |||
| <echo> | |||
| doing a first change ${change1} | |||
| </echo> | |||
| <p4change/> | |||
| <property name="change2" value="${p4.change}" /> | |||
| <echo> | |||
| doing a second change ${change2} | |||
| </echo> | |||
| <p4edit view="//depot/foobar" change="${change1}" /> | |||
| <p4edit view="//depot/hello" change="${change2}" /> | |||
| <echo> | |||
| before submitting of hello change ${change2} p4.change is now ${p4.change} | |||
| </echo> | |||
| <p4submit change="${change2}"/> | |||
| <echo> | |||
| after submitting of hello p4.change is now ${p4.change} | |||
| </echo> | |||
| <echo> | |||
| before submitting of foobar change ${change1} | |||
| </echo> | |||
| <p4submit change="${change1}"/> | |||
| <echo> | |||
| after submitting of foobar p4.change is now ${p4.change} | |||
| </echo> | |||
| </target> | |||
| </project> | |||
| @@ -1,73 +0,0 @@ | |||
| <?xml version="1.0"?> | |||
| <!-- | |||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||
| contributor license agreements. See the NOTICE file distributed with | |||
| this work for additional information regarding copyright ownership. | |||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| (the "License"); you may not use this file except in compliance with | |||
| the License. You may obtain a copy of the License at | |||
| http://www.apache.org/licenses/LICENSE-2.0 | |||
| Unless required by applicable law or agreed to in writing, software | |||
| distributed under the License is distributed on an "AS IS" BASIS, | |||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <!-- author Antoine Levy-Lambert --> | |||
| <!-- this test shows that p4 submit can now indicate that a file needs to be resolved --> | |||
| <!-- before running the test, edit this xml and change the 5 properties at the top to values which make sense on your system--> | |||
| <!-- the test uses two Perforce client specs which must exist beforehand --> | |||
| <!-- also using both client specs you should be able to edit the file ${depot_file_spec} --> | |||
| <project name="testresolve" default= "test"> | |||
| <property name="first_client" value="levyant_dev_ant"/> | |||
| <property name="first_client_root" value="C:\dev\depot"/> | |||
| <property name="second_client" value="levyant_cygwin_test"/> | |||
| <property name="second_client_root" value="C:\dev\test"/> | |||
| <property name="depot_file_spec" value="//depot/foobar"/> | |||
| <target name="test"> | |||
| <p4change client="${first_client}"/> | |||
| <property name="change1" value="${p4.change}" /> | |||
| <p4change client="${second_client}"/> | |||
| <property name="change2" value="${p4.change}" /> | |||
| <sequential> | |||
| <antcall target="edit"> | |||
| <param name="p4.client" value="${first_client}"/> | |||
| <param name="client_root" value="${first_client_root}"/> | |||
| <param name="change" value="${change1}"/> | |||
| </antcall> | |||
| <antcall target="edit"> | |||
| <param name="p4.client" value="${second_client}"/> | |||
| <param name="client_root" value="${second_client_root}"/> | |||
| <param name="change" value="${change2}"/> | |||
| </antcall> | |||
| <antcall target="submit"> | |||
| <param name="p4.client" value="${first_client}"/> | |||
| <param name="change" value="${change1}"/> | |||
| </antcall> | |||
| <antcall target="submit"> | |||
| <param name="p4.client" value="${second_client}"/> | |||
| <param name="change" value="${change2}"/> | |||
| </antcall> | |||
| </sequential> | |||
| </target> | |||
| <target name="edit"> | |||
| <echo> | |||
| doing a change ${change} on client ${p4.client} | |||
| </echo> | |||
| <p4edit change="${change}" view="${depot_file_spec}"/> | |||
| <mkdir dir="${client_root}/depot"/> | |||
| <echo file="${client_root}/depot/foobar"> | |||
| hello ${p4.client} ${change} | |||
| </echo> | |||
| </target> | |||
| <target name="submit"> | |||
| <p4submit change="${change}" needsresolveproperty="needsresolve" changeproperty="mychange"/> | |||
| <echo> | |||
| p4.needsresolve ${p4.needsresolve} after submit | |||
| needsresolveproperty ${needsresolve} after submit | |||
| changeproperty ${mychange} after submit | |||
| </echo> | |||
| </target> | |||
| </project> | |||
| @@ -159,21 +159,6 @@ junit=org.apache.tools.ant.taskdefs.optional.junit.JUnitTask | |||
| junitreport=org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator | |||
| native2ascii=org.apache.tools.ant.taskdefs.optional.Native2Ascii | |||
| netrexxc=org.apache.tools.ant.taskdefs.optional.NetRexxC | |||
| p4add=org.apache.tools.ant.taskdefs.optional.perforce.P4Add | |||
| p4change=org.apache.tools.ant.taskdefs.optional.perforce.P4Change | |||
| p4counter=org.apache.tools.ant.taskdefs.optional.perforce.P4Counter | |||
| p4delete=org.apache.tools.ant.taskdefs.optional.perforce.P4Delete | |||
| p4edit=org.apache.tools.ant.taskdefs.optional.perforce.P4Edit | |||
| p4fstat=org.apache.tools.ant.taskdefs.optional.perforce.P4Fstat | |||
| p4have=org.apache.tools.ant.taskdefs.optional.perforce.P4Have | |||
| p4integrate=org.apache.tools.ant.taskdefs.optional.perforce.P4Integrate | |||
| p4label=org.apache.tools.ant.taskdefs.optional.perforce.P4Label | |||
| p4labelsync=org.apache.tools.ant.taskdefs.optional.perforce.P4Labelsync | |||
| p4reopen=org.apache.tools.ant.taskdefs.optional.perforce.P4Reopen | |||
| p4resolve=org.apache.tools.ant.taskdefs.optional.perforce.P4Resolve | |||
| p4revert=org.apache.tools.ant.taskdefs.optional.perforce.P4Revert | |||
| p4submit=org.apache.tools.ant.taskdefs.optional.perforce.P4Submit | |||
| p4sync=org.apache.tools.ant.taskdefs.optional.perforce.P4Sync | |||
| propertyfile=org.apache.tools.ant.taskdefs.optional.PropertyFile | |||
| pvcs=org.apache.tools.ant.taskdefs.optional.pvcs.Pvcs | |||
| replaceregexp=org.apache.tools.ant.taskdefs.optional.ReplaceRegExp | |||
| @@ -1,60 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.oro.text.perl.Perl5Util; | |||
| import java.util.ArrayList; | |||
| /** | |||
| * FStatP4OutputHandler - spezialied Perforce output handler | |||
| * able to sort files recognized as managed by Perforce and files not | |||
| * managed by Perforce in the output | |||
| * | |||
| */ | |||
| class FStatP4OutputHandler extends P4HandlerAdapter { | |||
| private P4Fstat parent; | |||
| private ArrayList existing = new ArrayList(); | |||
| private ArrayList nonExisting = new ArrayList(); | |||
| private static Perl5Util util = new Perl5Util(); | |||
| public FStatP4OutputHandler(P4Fstat parent) { | |||
| this.parent = parent; | |||
| } | |||
| public void process(String line) throws BuildException { | |||
| if (util.match("/^... clientFile (.+)$/", line)) { | |||
| String f = util.group(1); | |||
| existing.add(f); | |||
| } else if (util.match("/^(.+) - no such file/", line)) { | |||
| String f = util.group(1); | |||
| nonExisting.add(f); | |||
| } | |||
| parent.log(parent.util.substitute("s/^.*: //", line), | |||
| Project.MSG_VERBOSE); | |||
| } | |||
| public ArrayList getExisting() { | |||
| return existing; | |||
| } | |||
| public ArrayList getNonExisting() { | |||
| return nonExisting; | |||
| } | |||
| } | |||
| @@ -1,143 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.File; | |||
| import java.util.Vector; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| /** | |||
| * Adds specified files to Perforce. | |||
| * | |||
| * <b>Example Usage:</b> | |||
| * <table border="1"> | |||
| * <th>Function</th><th>Command</th> | |||
| * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings specified</td> | |||
| * <td><P4add <br>P4view="//projects/foo/main/source/..." <br>P4User="fbloggs" | |||
| * <br>P4Port="km01:1666" | |||
| * <br>P4Client="fbloggsclient"><br><fileset basedir="dir" includes="**/*.java"><br> | |||
| * </p4add></td></tr> | |||
| * <tr><td>Add files using P4USER, P4PORT and P4CLIENT settings defined in environment</td><td> | |||
| * <P4add P4view="//projects/foo/main/source/..." /><br><fileset basedir="dir" | |||
| * includes="**/*.java"><br></p4add></td></tr> | |||
| * <tr><td>Specify the length of command line arguments to pass to each invocation of p4</td> | |||
| * <td><p4add Commandlength="450"></td></tr> | |||
| * </table> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Add extends P4Base { | |||
| private static final int DEFAULT_CMD_LENGTH = 450; | |||
| private int changelist; | |||
| private String addCmd = ""; | |||
| private Vector filesets = new Vector(); | |||
| private int cmdLength = DEFAULT_CMD_LENGTH; | |||
| /** | |||
| * Set the maximum length | |||
| * of the commandline when calling Perforce to add the files. | |||
| * Defaults to 450, higher values mean faster execution, | |||
| * but also possible failures. | |||
| * @param len maximum length of command line default is 450. | |||
| * @throws BuildException if trying to set the command line length to 0 or less. | |||
| */ | |||
| public void setCommandlength(int len) throws BuildException { | |||
| if (len <= 0) { | |||
| throw new BuildException("P4Add: Commandlength should be a positive number"); | |||
| } | |||
| this.cmdLength = len; | |||
| } | |||
| /** | |||
| * If specified the open files are associated with the | |||
| * specified pending changelist number; otherwise the open files are | |||
| * associated with the default changelist. | |||
| * | |||
| * @param changelist the change list number. | |||
| * | |||
| * @throws BuildException if trying to set a change list number <=0. | |||
| */ | |||
| public void setChangelist(int changelist) throws BuildException { | |||
| if (changelist <= 0) { | |||
| throw new BuildException("P4Add: Changelist# should be a positive number"); | |||
| } | |||
| this.changelist = changelist; | |||
| } | |||
| /** | |||
| * Add a fileset whose files will be added to Perforce. | |||
| * | |||
| * @param set the FileSet that one wants to add to Perforce Source Control. | |||
| */ | |||
| public void addFileset(FileSet set) { | |||
| filesets.addElement(set); | |||
| } | |||
| /** | |||
| * Run the task. | |||
| * | |||
| * @throws BuildException if the execution of the Perforce command fails. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (P4View != null) { | |||
| addCmd = P4View; | |||
| } | |||
| P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : ""; | |||
| StringBuffer filelist = new StringBuffer(); | |||
| final int size = filesets.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| if (srcFiles != null) { | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| File f = new File(ds.getBasedir(), srcFiles[j]); | |||
| filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); | |||
| if (filelist.length() > cmdLength) { | |||
| execP4Add(filelist); | |||
| filelist = new StringBuffer(); | |||
| } | |||
| } | |||
| if (filelist.length() > 0) { | |||
| execP4Add(filelist); | |||
| } | |||
| } else { | |||
| log("No files specified to add!", Project.MSG_WARN); | |||
| } | |||
| } | |||
| } | |||
| private void execP4Add(StringBuffer list) { | |||
| log("Execing add " + P4CmdOpts + " " + addCmd + list, Project.MSG_INFO); | |||
| execP4Command("-s add " + P4CmdOpts + " " + addCmd + list, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,311 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.IOException; | |||
| import org.apache.oro.text.perl.Perl5Util; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Execute; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| /** Base class for Perforce (P4) ANT tasks. See individual task for example usage. | |||
| * | |||
| * @see P4Sync | |||
| * @see P4Have | |||
| * @see P4Change | |||
| * @see P4Edit | |||
| * @see P4Submit | |||
| * @see P4Label | |||
| * @see org.apache.tools.ant.taskdefs.Execute | |||
| */ | |||
| public abstract class P4Base extends org.apache.tools.ant.Task { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| // CheckStyle:MemberNameCheck OFF - bc | |||
| /**Perl5 regexp in Java - cool eh? */ | |||
| protected Perl5Util util = null; | |||
| /** The OS shell to use (cmd.exe or /bin/sh) */ | |||
| protected String shell; | |||
| //P4 runtime directives | |||
| /** Perforce Server Port (eg KM01:1666) */ | |||
| protected String P4Port = ""; | |||
| /** Perforce Client (eg myclientspec) */ | |||
| protected String P4Client = ""; | |||
| /** Perforce User (eg fbloggs) */ | |||
| protected String P4User = ""; | |||
| /** Perforce view for commands. (eg //projects/foobar/main/source/... )*/ | |||
| protected String P4View = ""; | |||
| // Perforce task directives | |||
| /** Keep going or fail on error - defaults to fail. */ | |||
| protected boolean failOnError = true; | |||
| //P4 g-opts and cmd opts (rtfm) | |||
| /** Perforce 'global' opts. | |||
| * Forms half of low level API */ | |||
| protected String P4Opts = ""; | |||
| /** Perforce command opts. | |||
| * Forms half of low level API */ | |||
| protected String P4CmdOpts = ""; | |||
| /** Set by the task or a handler to indicate that the task has failed. BuildExceptions | |||
| * can also be thrown to indicate failure. */ | |||
| private boolean inError = false; | |||
| /** If inError is set, then errorMessage needs to contain the reason why. */ | |||
| private String errorMessage = ""; | |||
| // CheckStyle:MemberNameCheck ON | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * gets whether or not the task has encountered an error | |||
| * @return error flag | |||
| * @since ant 1.6 | |||
| */ | |||
| public boolean getInError() { | |||
| return inError; | |||
| } | |||
| /** | |||
| * sets the error flag on the task | |||
| * @param inError if true an error has been encountered by the handler | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setInError(boolean inError) { | |||
| this.inError = inError; | |||
| } | |||
| /** | |||
| * gets the error message recorded by the Perforce handler | |||
| * @return error message | |||
| */ | |||
| public String getErrorMessage() { | |||
| return errorMessage; | |||
| } | |||
| /** | |||
| * sets the error message | |||
| * @param errorMessage line of error output | |||
| */ | |||
| public void setErrorMessage(String errorMessage) { | |||
| this.errorMessage = errorMessage; | |||
| } | |||
| //Setters called by Ant | |||
| /** | |||
| * The p4d server and port to connect to; | |||
| * optional, default "perforce:1666" | |||
| * | |||
| * @param p4Port the port one wants to set such as localhost:1666 | |||
| */ | |||
| public void setPort(String p4Port) { | |||
| this.P4Port = "-p" + p4Port; | |||
| } | |||
| /** | |||
| * The p4 client spec to use; | |||
| * optional, defaults to the current user | |||
| * | |||
| * @param p4Client the name of the Perforce client spec | |||
| */ | |||
| public void setClient(String p4Client) { | |||
| this.P4Client = "-c" + p4Client; | |||
| } | |||
| /** | |||
| * The p4 username; | |||
| * optional, defaults to the current user | |||
| * | |||
| * @param p4User the user name | |||
| */ | |||
| public void setUser(String p4User) { | |||
| this.P4User = "-u" + p4User; | |||
| } | |||
| /** | |||
| * Set global P4 options; Used on all | |||
| * of the Perforce tasks. | |||
| * | |||
| * @param p4Opts global options, to use a specific P4Config file for instance | |||
| */ | |||
| public void setGlobalopts(String p4Opts) { | |||
| this.P4Opts = p4Opts; | |||
| } | |||
| /** | |||
| * The client, branch or label view to operate upon; | |||
| * optional default "//...". | |||
| * | |||
| * the view is required for the following tasks : | |||
| * <ul> | |||
| * <li>p4delete</li> | |||
| * <li>p4edit</li> | |||
| * <li>p4reopen</li> | |||
| * <li>p4resolve</li> | |||
| * </ul> | |||
| * | |||
| * @param p4View the view one wants to use | |||
| */ | |||
| public void setView(String p4View) { | |||
| this.P4View = p4View; | |||
| } | |||
| /** | |||
| * Set extra command options; only used on some | |||
| * of the Perforce tasks. | |||
| * | |||
| * @param p4CmdOpts command line options going after the particular | |||
| * Perforce command | |||
| */ | |||
| public void setCmdopts(String p4CmdOpts) { | |||
| this.P4CmdOpts = p4CmdOpts; | |||
| } | |||
| /** | |||
| * whether to stop the build (true, default) | |||
| * or keep going if an error is returned from the p4 command | |||
| * @param fail indicates whether one wants to fail the build if an error comes from the | |||
| * Perforce command | |||
| */ | |||
| public void setFailonerror(boolean fail) { | |||
| failOnError = fail; | |||
| } | |||
| /** | |||
| * sets attributes Port, Client, User from properties | |||
| * if these properties are defined. | |||
| * Called automatically by UnknownElement | |||
| * @see org.apache.tools.ant.UnknownElement | |||
| * <table> | |||
| * <tr><th>Property</th><th>Attribute</th></tr> | |||
| * <tr><td>p4.port</td><td>Port</td></tr> | |||
| * <tr><td>p4.client</td><td>Client</td></tr> | |||
| * <tr><td>p4.user</td><td>User</td></tr> | |||
| * </table> | |||
| */ | |||
| public void init() { | |||
| util = new Perl5Util(); | |||
| //Get default P4 settings from environment - Mark would have done something cool with | |||
| //introspection here.....:-) | |||
| String tmpprop; | |||
| // CheckStyle:InnerAssignment OFF | |||
| if ((tmpprop = getProject().getProperty("p4.port")) != null) { | |||
| setPort(tmpprop); | |||
| } | |||
| if ((tmpprop = getProject().getProperty("p4.client")) != null) { | |||
| setClient(tmpprop); | |||
| } | |||
| if ((tmpprop = getProject().getProperty("p4.user")) != null) { | |||
| setUser(tmpprop); | |||
| } | |||
| // CheckStyle:InnerAssignment ON | |||
| } | |||
| /** | |||
| * no usages found for this method | |||
| * runs a Perforce command without a handler | |||
| * @param command the command that one wants to execute | |||
| * @throws BuildException if failonerror is set and the command fails | |||
| */ | |||
| protected void execP4Command(String command) throws BuildException { | |||
| execP4Command(command, null); | |||
| } | |||
| /** | |||
| * Execute P4 command assembled by subclasses. | |||
| * | |||
| * @param command The command to run | |||
| * @param handler A P4Handler to process any input and output | |||
| * | |||
| * @throws BuildException if failonerror has been set to true | |||
| */ | |||
| protected void execP4Command(String command, P4Handler handler) throws BuildException { | |||
| try { | |||
| // reset error flags before executing the command | |||
| inError = false; | |||
| errorMessage = ""; | |||
| Commandline commandline = new Commandline(); | |||
| commandline.setExecutable("p4"); | |||
| //Check API for these - it's how CVS does it... | |||
| if (P4Port != null && P4Port.length() != 0) { | |||
| commandline.createArgument().setValue(P4Port); | |||
| } | |||
| if (P4User != null && P4User.length() != 0) { | |||
| commandline.createArgument().setValue(P4User); | |||
| } | |||
| if (P4Client != null && P4Client.length() != 0) { | |||
| commandline.createArgument().setValue(P4Client); | |||
| } | |||
| if (P4Opts != null && P4Opts.length() != 0) { | |||
| commandline.createArgument().setLine(P4Opts); | |||
| } | |||
| commandline.createArgument().setLine(command); | |||
| log(commandline.describeCommand(), Project.MSG_VERBOSE); | |||
| if (handler == null) { | |||
| handler = new SimpleP4OutputHandler(this); | |||
| } | |||
| Execute exe = new Execute(handler, null); | |||
| exe.setAntRun(getProject()); | |||
| exe.setCommandline(commandline.getCommandline()); | |||
| try { | |||
| exe.execute(); | |||
| if (inError && failOnError) { | |||
| throw new BuildException(errorMessage); | |||
| } | |||
| } catch (IOException e) { | |||
| throw new BuildException(e); | |||
| } finally { | |||
| try { | |||
| handler.stop(); | |||
| } catch (Exception e) { | |||
| log("Error stopping execution framework: " + e.toString(), | |||
| Project.MSG_ERR); | |||
| } | |||
| } | |||
| } catch (Exception e) { | |||
| String failMsg = "Problem exec'ing P4 command: " + e.getMessage(); | |||
| if (failOnError) { | |||
| if (e instanceof BuildException) { | |||
| throw (BuildException) e; | |||
| } else { | |||
| throw new BuildException(failMsg, e); | |||
| } | |||
| } else { | |||
| log(failMsg, Project.MSG_ERR); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1,147 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| /** | |||
| * Requests a new changelist from the Perforce server. | |||
| * P4Change creates a new changelist in perforce. P4Change sets the property | |||
| * ${p4.change} with the new changelist number. This should then be passed into | |||
| * p4edit and p4submit. | |||
| * | |||
| * | |||
| * @see P4Edit | |||
| * @see P4Submit | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Change extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| protected String emptyChangeList = null; | |||
| protected String description = "AutoSubmit By Ant"; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * creates a new Perforce change list | |||
| * sets the p4.change property to the number of the new change list | |||
| * @throws BuildException if the word error appears in the output coming from Perforce | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (emptyChangeList == null) { | |||
| emptyChangeList = getEmptyChangeList(); | |||
| } | |||
| final Project myProj = getProject(); | |||
| P4Handler handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| if (util.match("/Change/", line)) { | |||
| //Remove any non-numerical chars - should leave the change number | |||
| line = util.substitute("s/[^0-9]//g", line); | |||
| int changenumber = Integer.parseInt(line); | |||
| log("Change Number is " + changenumber, Project.MSG_INFO); | |||
| myProj.setProperty("p4.change", "" + changenumber); | |||
| } else if (util.match("/error/", line)) { | |||
| throw new BuildException("Perforce Error, check client settings and/or server"); | |||
| } | |||
| } | |||
| }; | |||
| handler.setOutput(emptyChangeList); | |||
| execP4Command("change -i", handler); | |||
| } | |||
| /** | |||
| * returns the text of an empty change list | |||
| * @return the text of an empty change list | |||
| * @throws BuildException if the text error is displayed | |||
| * in the Perforce output outside of a comment line | |||
| */ | |||
| public String getEmptyChangeList() throws BuildException { | |||
| final StringBuffer stringbuf = new StringBuffer(); | |||
| execP4Command("change -o", new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| if (!util.match("/^#/", line)) { | |||
| if (util.match("/error/", line)) { | |||
| log("Client Error", Project.MSG_VERBOSE); | |||
| throw new BuildException("Perforce Error, " | |||
| + "check client settings and/or server"); | |||
| } else if (util.match("/<enter description here>/", line)) { | |||
| // we need to escape the description in case there are / | |||
| description = backslash(description); | |||
| line = util.substitute("s/<enter description here>/" | |||
| + description + "/", line); | |||
| } else if (util.match("/\\/\\//", line)) { | |||
| //Match "//" for begining of depot filespec | |||
| return; | |||
| } | |||
| stringbuf.append(line); | |||
| stringbuf.append("\n"); | |||
| } | |||
| } | |||
| }); | |||
| return stringbuf.toString(); | |||
| } | |||
| /** | |||
| * Ensure that a string is backslashing slashes so that it does not | |||
| * confuse them with Perl substitution delimiter in Oro. Backslashes are | |||
| * always backslashes in a string unless they escape the delimiter. | |||
| * @param value the string to backslash for slashes | |||
| * @return the backslashed string | |||
| * @see <a href="http://jakarta.apache.org/oro/api/org/apache/oro/text/perl/Perl5Util.html | |||
| * #substitute(java.lang.String,%20java.lang.String)">Oro</a> | |||
| */ | |||
| public static final String backslash(String value) { | |||
| final StringBuffer buf = new StringBuffer(value.length()); | |||
| final int len = value.length(); | |||
| for (int i = 0; i < len; i++) { | |||
| char c = value.charAt(i); | |||
| if (c == '/') { | |||
| buf.append('\\'); | |||
| } | |||
| buf.append(c); | |||
| } | |||
| return buf.toString(); | |||
| } | |||
| /** | |||
| * Description for ChangeList;optional. | |||
| * If none is specified, it will default to "AutoSubmit By Ant" | |||
| * @param desc description for the change list | |||
| */ | |||
| public void setDescription(String desc) { | |||
| this.description = desc; | |||
| } | |||
| } //EoF | |||
| @@ -1,151 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| /** | |||
| * Obtains or sets the value of a counter. | |||
| * | |||
| * <p> When used in its base form | |||
| * (where only the counter name is provided), the counter value will be | |||
| * printed to the output stream. When the value is provided, the counter | |||
| * will be set to the value provided. When a property name is provided, | |||
| * the property will be filled with the value of the counter. You may | |||
| * not specify to both get and set the value of the counter in the same | |||
| * Task. | |||
| * </p> | |||
| * <P> | |||
| * The user performing this task must have Perforce "review" permissions | |||
| * as defined by Perforce protections in order for this task to succeed. | |||
| </P> | |||
| * Example Usage:<br> | |||
| * <p4counter name="${p4.counter}" property=${p4.change}"/> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Counter extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * name of the counter | |||
| */ | |||
| public String counter = null; | |||
| /** | |||
| * name of an optional property | |||
| */ | |||
| public String property = null; | |||
| /** | |||
| * flag telling whether the value of the counter should be set | |||
| */ | |||
| public boolean shouldSetValue = false; | |||
| /** | |||
| * flag telling whether a property should be set | |||
| */ | |||
| public boolean shouldSetProperty = false; | |||
| /** | |||
| * new value for the counter | |||
| */ | |||
| public int value = 0; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * The name of the counter; required | |||
| * @param counter name of the counter | |||
| */ | |||
| public void setName(String counter) { | |||
| this.counter = counter; | |||
| } | |||
| /** | |||
| * The new value for the counter; optional. | |||
| * @param value new value for the counter | |||
| */ | |||
| public void setValue(int value) { | |||
| this.value = value; | |||
| shouldSetValue = true; | |||
| } | |||
| /** | |||
| * A property to be set with the value of the counter | |||
| * @param property the name of a property to set with the value | |||
| * of the counter | |||
| */ | |||
| public void setProperty(String property) { | |||
| this.property = property; | |||
| shouldSetProperty = true; | |||
| } | |||
| /** | |||
| * again, properties are mutable in this tsk | |||
| * @throws BuildException if the required parameters are not supplied. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if ((counter == null) || counter.length() == 0) { | |||
| throw new BuildException("No counter specified to retrieve"); | |||
| } | |||
| if (shouldSetValue && shouldSetProperty) { | |||
| throw new BuildException("Cannot both set the value of the property and retrieve the " | |||
| + "value of the property."); | |||
| } | |||
| String command = "counter " + P4CmdOpts + " " + counter; | |||
| if (!shouldSetProperty) { | |||
| // NOTE kirk@radik.com 04-April-2001 -- If you put in the -s, you | |||
| // have to start running through regular expressions here. Much easier | |||
| // to just not include the scripting information than to try to add it | |||
| // and strip it later. | |||
| command = "-s " + command; | |||
| } | |||
| if (shouldSetValue) { | |||
| command += " " + value; | |||
| } | |||
| if (shouldSetProperty) { | |||
| final Project myProj = getProject(); | |||
| P4Handler handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| log("P4Counter retrieved line \"" + line + "\"", Project.MSG_VERBOSE); | |||
| try { | |||
| value = Integer.parseInt(line); | |||
| myProj.setProperty(property, "" + value); | |||
| } catch (NumberFormatException nfe) { | |||
| throw new BuildException("Perforce error. " | |||
| + "Could not retrieve counter value."); | |||
| } | |||
| } | |||
| }; | |||
| execP4Command(command, handler); | |||
| } else { | |||
| execP4Command(command, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,65 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** Checkout files for deletion. | |||
| * | |||
| * Example Usage:<br> | |||
| * <p4delete change="${p4.change}" view="//depot/project/foo.txt" /><br> | |||
| * | |||
| * Simple re-write of P4Edit changing 'edit' to 'delete'.<br> | |||
| * | |||
| * @todo What to do if file is already open in one of our changelists perhaps | |||
| * (See also {@link P4Edit P4Edit})?<br> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Delete extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * number of the change list to work on | |||
| */ | |||
| public String change = null; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * An existing changelist number for the deletion; optional | |||
| * but strongly recommended. | |||
| * @param change the number of a change list | |||
| */ | |||
| public void setChange(String change) { | |||
| this.change = change; | |||
| } | |||
| /** | |||
| * executes the p4 delete task | |||
| * @throws BuildException if there is no view specified | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (change != null) { | |||
| P4CmdOpts = "-c " + change; | |||
| } | |||
| if (P4View == null) { | |||
| throw new BuildException("No view specified to delete"); | |||
| } | |||
| execP4Command("-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,73 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| * Open file(s) for edit. | |||
| * P4Change should be used to obtain a new changelist for P4Edit as, | |||
| * although P4Edit can open files to the default change, | |||
| * P4Submit cannot yet submit to it. | |||
| * Example Usage:<br> | |||
| * <p4edit change="${p4.change}" view="//depot/project/foo.txt" /> | |||
| * | |||
| * @todo Should call reopen if file is already open in one of our changelists perhaps? | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Edit extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * number of the change list to work on | |||
| */ | |||
| public String change = null; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * An existing changelist number to assign files to; optional | |||
| * but strongly recommended. | |||
| * @param change the change list number | |||
| */ | |||
| public void setChange(String change) { | |||
| this.change = change; | |||
| } | |||
| /** | |||
| * Run the p4 edit command | |||
| * @throws BuildException if there is no view specified | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (change != null) { | |||
| P4CmdOpts = "-c " + change; | |||
| } | |||
| if (P4View == null) { | |||
| throw new BuildException("No view specified to edit"); | |||
| } | |||
| execP4Command("-s edit " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,200 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.File; | |||
| import java.util.Vector; | |||
| import java.util.ArrayList; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| /** | |||
| * P4Fstat--find out which files are under Perforce control and which are not. | |||
| * | |||
| * <br><b>Example Usage:</b><br> | |||
| * <pre> | |||
| * <project name="p4fstat" default="p4fstat" | |||
| * basedir="C:\dev\gnu"> | |||
| * <target name="p4fstat" > | |||
| * <p4fstat showfilter="all"> | |||
| * <fileset dir="depot" includes="**\/*"/> | |||
| * </p4fstat> | |||
| * </target> | |||
| * </project> | |||
| * </pre> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Fstat extends P4Base { | |||
| private int changelist; | |||
| private String addCmd = ""; | |||
| private Vector filesets = new Vector(); | |||
| private static final int DEFAULT_CMD_LENGTH = 300; | |||
| private int cmdLength = DEFAULT_CMD_LENGTH; | |||
| private static final int SHOW_ALL = 0; | |||
| private static final int SHOW_EXISTING = 1; | |||
| private static final int SHOW_NON_EXISTING = 2; | |||
| private int show = SHOW_NON_EXISTING; | |||
| private FStatP4OutputHandler handler; | |||
| private StringBuffer filelist; | |||
| private int fileNum = 0; | |||
| private int doneFileNum = 0; | |||
| private boolean debug = false; | |||
| private static final String EXISTING_HEADER | |||
| = "Following files exist in perforce"; | |||
| private static final String NONEXISTING_HEADER | |||
| = "Following files do not exist in perforce"; | |||
| /** | |||
| * Sets the filter that one wants applied. | |||
| * <table> | |||
| * <tr><th>Option</th><th>Meaning</th></tr> | |||
| * <tr><td>all</td><td>all files under Perforce control or not</td></tr> | |||
| * <tr><td>existing</td><td>only files under Perforce control</td></tr> | |||
| * <tr><td>non-existing</td><td>only files not under Perforce control or not</td></tr> | |||
| * </table> | |||
| * @param filter should be one of all|existing|non-existing. | |||
| */ | |||
| public void setShowFilter(String filter) { | |||
| if (filter.equalsIgnoreCase("all")) { | |||
| show = SHOW_ALL; | |||
| } else if (filter.equalsIgnoreCase("existing")) { | |||
| show = SHOW_EXISTING; | |||
| } else if (filter.equalsIgnoreCase("non-existing")) { | |||
| show = SHOW_NON_EXISTING; | |||
| } else { | |||
| throw new BuildException("P4Fstat: ShowFilter should be one of: " | |||
| + "all, existing, non-existing"); | |||
| } | |||
| } | |||
| /** | |||
| * Sets optionally a change list number. | |||
| * @param changelist change list that one wants information about. | |||
| * @throws BuildException if the change list number is negative. | |||
| */ | |||
| public void setChangelist(int changelist) throws BuildException { | |||
| if (changelist <= 0) { | |||
| throw new BuildException("P4FStat: Changelist# should be a " | |||
| + "positive number"); | |||
| } | |||
| this.changelist = changelist; | |||
| } | |||
| /** | |||
| * Adds a fileset to be examined by p4fstat. | |||
| * @param set the fileset to add. | |||
| */ | |||
| public void addFileset(FileSet set) { | |||
| filesets.addElement(set); | |||
| } | |||
| /** | |||
| * Executes the p4fstat task. | |||
| * @throws BuildException if no files are specified. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| handler = new FStatP4OutputHandler(this); | |||
| if (P4View != null) { | |||
| addCmd = P4View; | |||
| } | |||
| P4CmdOpts = (changelist > 0) ? ("-c " + changelist) : ""; | |||
| filelist = new StringBuffer(); | |||
| final int size = filesets.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| if (srcFiles != null) { | |||
| fileNum = srcFiles.length; | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| File f = new File(ds.getBasedir(), srcFiles[j]); | |||
| filelist.append(" ").append('"').append(f.getAbsolutePath()).append('"'); | |||
| doneFileNum++; | |||
| if (filelist.length() > cmdLength) { | |||
| execP4Fstat(filelist); | |||
| filelist = new StringBuffer(); | |||
| } | |||
| } | |||
| if (filelist.length() > 0) { | |||
| execP4Fstat(filelist); | |||
| } | |||
| } else { | |||
| log("No files specified to query status on!", Project.MSG_WARN); | |||
| } | |||
| } | |||
| if (show == SHOW_ALL || show == SHOW_EXISTING) { | |||
| printRes(handler.getExisting(), EXISTING_HEADER); | |||
| } | |||
| if (show == SHOW_ALL || show == SHOW_NON_EXISTING) { | |||
| printRes(handler.getNonExisting(), NONEXISTING_HEADER); | |||
| } | |||
| } | |||
| /** | |||
| * Return the number of files seen. | |||
| * @return the number of files seen. | |||
| */ | |||
| public int getLengthOfTask() { | |||
| return fileNum; | |||
| } | |||
| /** | |||
| * Return the number of passes to make. | |||
| * IS THIS BEING USED? | |||
| * @return number of passes (how many filesets). | |||
| */ | |||
| int getPasses() { | |||
| return filesets.size(); | |||
| } | |||
| private void printRes(ArrayList ar, String header) { | |||
| log(header, Project.MSG_INFO); | |||
| final int size = ar.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| log((String) ar.get(i), Project.MSG_INFO); | |||
| } | |||
| } | |||
| private void execP4Fstat(StringBuffer list) { | |||
| String l = list.substring(0); | |||
| if (debug) { | |||
| log("Executing fstat " + P4CmdOpts + " " + addCmd + l + "\n", | |||
| Project.MSG_INFO); | |||
| } | |||
| execP4Command("fstat " + P4CmdOpts + " " + addCmd + l, handler); | |||
| } | |||
| } | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | |||
| /** Interface for p4 job output stream handler. Classes implementing this interface | |||
| * can be called back by P4Base.execP4Command(); | |||
| * | |||
| */ | |||
| public interface P4Handler extends ExecuteStreamHandler { | |||
| /** | |||
| * processing of one line of stdout or of stderr | |||
| * @param line a line of stdout or stderr that the implementation will process | |||
| * @throws BuildException at the discretion of the implementation. | |||
| */ | |||
| void process(String line) throws BuildException; | |||
| /** | |||
| * set any data to be written to P4's stdin | |||
| * @param line the text to write to P4's stdin | |||
| * @throws BuildException if the line cannot be processed. | |||
| */ | |||
| void setOutput(String line) throws BuildException; | |||
| } | |||
| @@ -1,117 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.io.OutputStream; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.PumpStreamHandler; | |||
| /** | |||
| * base class to manage streams around the execution of the Perforce | |||
| * command line client | |||
| */ | |||
| public abstract class P4HandlerAdapter implements P4Handler { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| String p4input = ""; | |||
| private PumpStreamHandler myHandler = null; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * set any data to be written to P4's stdin | |||
| * @param p4Input the text to write to P4's stdin | |||
| */ | |||
| public void setOutput(String p4Input) { | |||
| this.p4input = p4Input; | |||
| } | |||
| /** | |||
| * subclasses of P4HandlerAdapter must implement this routine | |||
| * processing of one line of stdout or of stderr | |||
| * @param line line of stdout or stderr to process | |||
| */ | |||
| public abstract void process(String line); | |||
| /** | |||
| * this routine gets called by the execute routine of the Execute class | |||
| * it connects the PumpStreamHandler to the input/output/error streams of the process. | |||
| * @throws BuildException if there is a error. | |||
| * @see org.apache.tools.ant.taskdefs.Execute#execute | |||
| */ | |||
| public void start() throws BuildException { | |||
| if (p4input != null && p4input.length() > 0) { | |||
| myHandler = new PumpStreamHandler(new P4OutputStream(this), new P4OutputStream(this), | |||
| new ByteArrayInputStream(p4input.getBytes())); | |||
| } else { | |||
| myHandler = new PumpStreamHandler(new P4OutputStream(this), new P4OutputStream(this)); | |||
| } | |||
| myHandler.setProcessInputStream(os); | |||
| myHandler.setProcessErrorStream(es); | |||
| myHandler.setProcessOutputStream(is); | |||
| myHandler.start(); | |||
| } | |||
| /** | |||
| * stops the processing of streams | |||
| * called from P4Base#execP4Command(String command, P4Handler handler) | |||
| * @see P4Base#execP4Command(String, P4Handler) | |||
| */ | |||
| public void stop() { | |||
| if (myHandler != null) { | |||
| // might never have been started, forfor example ifif p4 | |||
| // is not on the PATH | |||
| myHandler.stop(); | |||
| } | |||
| } | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| OutputStream os; //Input | |||
| InputStream is; //Output | |||
| InputStream es; //Error | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * connects the handler to the input stream into Perforce | |||
| * used indirectly by tasks requiring to send specific standard input | |||
| * such as p4label, p4change | |||
| * @param os the stream bringing input to the p4 executable | |||
| * @throws IOException under unknown circumstances | |||
| */ | |||
| public void setProcessInputStream(OutputStream os) throws IOException { | |||
| this.os = os; | |||
| } | |||
| /** | |||
| * connects the handler to the stderr of the Perforce process | |||
| * @param is stderr coming from Perforce | |||
| * @throws IOException under unknown circumstances | |||
| */ | |||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||
| this.es = is; | |||
| } | |||
| /** | |||
| * connects the handler to the stdout of the Perforce process | |||
| * @param is stdout coming from Perforce | |||
| * @throws IOException under unknown circumstances | |||
| */ | |||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||
| this.is = is; | |||
| } | |||
| } | |||
| @@ -1,46 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** Lists Perforce files currently on client. | |||
| * | |||
| * P4Have simply dumps the current file version info into | |||
| * the Ant log (or stdout). | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Have extends P4Base { | |||
| /** | |||
| * Execute the Perforce <code>have</code> command. | |||
| * | |||
| * @throws BuildException if the command cannot be executed. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| execP4Command("have " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,318 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| * Integrate file(s). | |||
| * P4Change should be used to obtain a new changelist for P4Integrate, | |||
| * although P4Integrate can open files to the default change, | |||
| * P4Submit cannot yet submit to it. | |||
| * Example Usage:<br> | |||
| * <p4integrate change="${p4.change}" | |||
| * fromfile="//depot/project/dev/foo.txt" tofile="//depot/project/main/foo.txt" /> | |||
| * | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Integrate extends P4Base { | |||
| private String change = null; | |||
| private String fromfile = null; | |||
| private String tofile = null; | |||
| private String branch = null; | |||
| private boolean restoredeletedrevisions = false; | |||
| private boolean forceintegrate = false; | |||
| private boolean leavetargetrevision = false; | |||
| private boolean enablebaselessmerges = false; | |||
| private boolean simulationmode = false; | |||
| private boolean reversebranchmappings = false; | |||
| private boolean propagatesourcefiletype = false; | |||
| private boolean nocopynewtargetfiles = false; | |||
| /** | |||
| * get the changelist number | |||
| * | |||
| * @return the changelist number set for this task | |||
| */ | |||
| public String getChange() { | |||
| return change; | |||
| } | |||
| /** | |||
| * set the changelist number for the operation | |||
| * | |||
| * @param change An existing changelist number to assign files to; optional | |||
| * but strongly recommended. | |||
| */ | |||
| public void setChange(String change) { | |||
| this.change = change; | |||
| } | |||
| /** | |||
| * get the from file specification | |||
| * | |||
| * @return the from file specification | |||
| */ | |||
| public String getFromfile() { | |||
| return fromfile; | |||
| } | |||
| /** | |||
| * sets the from file specification | |||
| * | |||
| * @param fromf the from file specification | |||
| */ | |||
| public void setFromfile(String fromf) { | |||
| this.fromfile = fromf; | |||
| } | |||
| /** | |||
| * get the to file specification | |||
| * | |||
| * @return the to file specification | |||
| */ | |||
| public String getTofile() { | |||
| return tofile; | |||
| } | |||
| /** | |||
| * sets the to file specification | |||
| * | |||
| * @param tof the to file specification | |||
| */ | |||
| public void setTofile(String tof) { | |||
| this.tofile = tof; | |||
| } | |||
| /** | |||
| * get the branch | |||
| * | |||
| * @return the name of the branch | |||
| */ | |||
| public String getBranch() { | |||
| return branch; | |||
| } | |||
| /** | |||
| * sets the branch | |||
| * | |||
| * @param br the name of the branch to use | |||
| */ | |||
| public void setBranch(String br) { | |||
| this.branch = br; | |||
| } | |||
| /** | |||
| * gets the restoredeletedrevisions flag | |||
| * | |||
| * @return restore deleted revisions | |||
| */ | |||
| public boolean isRestoreDeletedRevisions() { | |||
| return restoredeletedrevisions; | |||
| } | |||
| /** | |||
| * sets the restoredeletedrevisions flag | |||
| * | |||
| * @param setrest value chosen for restoredeletedrevisions | |||
| */ | |||
| public void setRestoreDeletedRevisions(boolean setrest) { | |||
| this.restoredeletedrevisions = setrest; | |||
| } | |||
| /** | |||
| * gets the forceintegrate flag | |||
| * | |||
| * @return restore deleted revisions | |||
| */ | |||
| public boolean isForceIntegrate() { | |||
| return forceintegrate; | |||
| } | |||
| /** | |||
| * sets the forceintegrate flag | |||
| * | |||
| * @param setrest value chosen for forceintegrate | |||
| */ | |||
| public void setForceIntegrate(boolean setrest) { | |||
| this.forceintegrate = setrest; | |||
| } | |||
| /** | |||
| * gets the leavetargetrevision flag | |||
| * | |||
| * @return flag indicating if the target revision should be preserved | |||
| */ | |||
| public boolean isLeaveTargetRevision() { | |||
| return leavetargetrevision; | |||
| } | |||
| /** | |||
| * sets the leavetargetrevision flag | |||
| * | |||
| * @param setrest value chosen for leavetargetrevision | |||
| */ | |||
| public void setLeaveTargetRevision(boolean setrest) { | |||
| this.leavetargetrevision = setrest; | |||
| } | |||
| /** | |||
| * gets the enablebaselessmerges flag | |||
| * | |||
| * @return boolean indicating if baseless merges are desired | |||
| */ | |||
| public boolean isEnableBaselessMerges() { | |||
| return enablebaselessmerges; | |||
| } | |||
| /** | |||
| * sets the enablebaselessmerges flag | |||
| * | |||
| * @param setrest value chosen for enablebaselessmerges | |||
| */ | |||
| public void setEnableBaselessMerges(boolean setrest) { | |||
| this.enablebaselessmerges = setrest; | |||
| } | |||
| /** | |||
| * gets the simulationmode flag | |||
| * | |||
| * @return simulation mode flag | |||
| */ | |||
| public boolean isSimulationMode() { | |||
| return simulationmode; | |||
| } | |||
| /** | |||
| * sets the simulationmode flag | |||
| * | |||
| * @param setrest value chosen for simulationmode | |||
| */ | |||
| public void setSimulationMode(boolean setrest) { | |||
| this.simulationmode = setrest; | |||
| } | |||
| /** | |||
| * returns the flag indicating if reverse branch mappings are sought | |||
| * | |||
| * @return reversebranchmappings flag | |||
| */ | |||
| public boolean isReversebranchmappings() { | |||
| return reversebranchmappings; | |||
| } | |||
| /** | |||
| * sets the reversebranchmappings flag | |||
| * | |||
| * @param reversebranchmappings flag indicating if reverse branch mappings are sought | |||
| */ | |||
| public void setReversebranchmappings(boolean reversebranchmappings) { | |||
| this.reversebranchmappings = reversebranchmappings; | |||
| } | |||
| /** | |||
| * returns flag indicating if propagation of source file type is sought | |||
| * | |||
| * @return flag set to true if you want to propagate source file type for existing target files | |||
| */ | |||
| public boolean isPropagatesourcefiletype() { | |||
| return propagatesourcefiletype; | |||
| } | |||
| /** | |||
| * sets flag indicating if one wants to propagate the source file type | |||
| * | |||
| * @param propagatesourcefiletype | |||
| * set it to true if you want to change the type of existing target files | |||
| * according to type of source file. | |||
| */ | |||
| public void setPropagatesourcefiletype(boolean propagatesourcefiletype) { | |||
| this.propagatesourcefiletype = propagatesourcefiletype; | |||
| } | |||
| /** | |||
| * indicates intention to suppress the copying on the local hard disk of new target files. | |||
| * | |||
| * @return indicates intention to suppress the copying | |||
| * on the local hard disk of new target files. | |||
| */ | |||
| public boolean isNocopynewtargetfiles() { | |||
| return nocopynewtargetfiles; | |||
| } | |||
| /** | |||
| * sets nocopynewtargetfiles flag | |||
| * | |||
| * @param nocopynewtargetfiles set it to true to gain speed in integration by not copying on | |||
| * the local Perforce client new target files | |||
| */ | |||
| public void setNocopynewtargetfiles(boolean nocopynewtargetfiles) { | |||
| this.nocopynewtargetfiles = nocopynewtargetfiles; | |||
| } | |||
| /** | |||
| * execute the p4 integrate | |||
| * @throws BuildException if there are missing parameters | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (change != null) { | |||
| P4CmdOpts = "-c " + change; | |||
| } | |||
| if (this.forceintegrate) { | |||
| P4CmdOpts = P4CmdOpts + " -f"; | |||
| } | |||
| if (this.restoredeletedrevisions) { | |||
| P4CmdOpts = P4CmdOpts + " -d"; | |||
| } | |||
| if (this.leavetargetrevision) { | |||
| P4CmdOpts = P4CmdOpts + " -h"; | |||
| } | |||
| if (this.enablebaselessmerges) { | |||
| P4CmdOpts = P4CmdOpts + " -i"; | |||
| } | |||
| if (this.simulationmode) { | |||
| P4CmdOpts = P4CmdOpts + " -n"; | |||
| } | |||
| if (this.reversebranchmappings) { | |||
| P4CmdOpts = P4CmdOpts + " -r"; | |||
| } | |||
| if (this.propagatesourcefiletype) { | |||
| P4CmdOpts = P4CmdOpts + " -t"; | |||
| } | |||
| if (this.nocopynewtargetfiles) { | |||
| P4CmdOpts = P4CmdOpts + "-v"; | |||
| } | |||
| String command; | |||
| if (branch == null && fromfile != null && tofile != null) { | |||
| command = P4CmdOpts + " " + fromfile + " " + tofile; | |||
| } else if (branch != null && fromfile == null && tofile != null) { | |||
| command = P4CmdOpts + " -b " + branch + " " + tofile; | |||
| } else if (branch != null && fromfile != null) { | |||
| command = P4CmdOpts + " -b " + branch + " -s " + fromfile + " " + tofile; | |||
| } else { | |||
| throw new BuildException("you need to specify fromfile and tofile, " | |||
| + "or branch and tofile, or branch and fromfile, or branch and fromfile and tofile "); | |||
| } | |||
| execP4Command("-s integrate " + command, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,176 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| /** | |||
| * Creates a new Perforce label and set contents to reflect current | |||
| * client file revisions. | |||
| * | |||
| * Label name defaults to AntLabel if none set. | |||
| * | |||
| * Example Usage: | |||
| * <pre> | |||
| * <P4Label name="MyLabel-${TSTAMP}-${DSTAMP}" desc="Auto Build Label" /> | |||
| * </pre> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Label extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| protected String name; | |||
| protected String desc; | |||
| protected String lock; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * The name of the label; optional, default "AntLabel" | |||
| * @param name the name of the label | |||
| */ | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| /** | |||
| *Label Description; optional | |||
| * @param desc description of the label | |||
| */ | |||
| public void setDesc(String desc) { | |||
| this.desc = desc; | |||
| } | |||
| /** | |||
| * when set to "locked", Perforce will lock the label once created; optional. | |||
| * @param lock only admissible value "locked" | |||
| */ | |||
| public void setLock(String lock) { | |||
| this.lock = lock; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if failonerror has been set to true and Perforce fails | |||
| */ | |||
| public void execute() throws BuildException { | |||
| log("P4Label exec:", Project.MSG_INFO); | |||
| if (P4View == null || P4View.length() < 1) { | |||
| log("View not set, assuming //depot/...", Project.MSG_WARN); | |||
| P4View = "//depot/..."; | |||
| } else { | |||
| P4View = StringUtils.replace(P4View, ":", "\n\t"); | |||
| P4View = StringUtils.replace(P4View, ";", "\n\t"); | |||
| } | |||
| if (desc == null || desc.length() < 1) { | |||
| log("Label Description not set, assuming 'AntLabel'", | |||
| Project.MSG_WARN); | |||
| desc = "AntLabel"; | |||
| } | |||
| if (lock != null && !lock.equalsIgnoreCase("locked")) { | |||
| log("lock attribute invalid - ignoring", Project.MSG_WARN); | |||
| } | |||
| if (name == null || name.length() < 1) { | |||
| SimpleDateFormat formatter | |||
| = new SimpleDateFormat("yyyy.MM.dd-hh:mm"); | |||
| Date now = new Date(); | |||
| name = "AntLabel-" + formatter.format(now); | |||
| log("name not set, assuming '" + name + "'", Project.MSG_WARN); | |||
| } | |||
| //We have to create a unlocked label first | |||
| String newLabel = | |||
| "Label: " + name | |||
| + "\nDescription: " + desc | |||
| + "\nOptions: unlocked" | |||
| + "\nView: \n\t" + P4View; | |||
| P4Handler handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| log(line, Project.MSG_VERBOSE); | |||
| } | |||
| }; | |||
| handler.setOutput(newLabel); | |||
| execP4Command("label -i", handler); | |||
| execP4Command("labelsync -l " + name, new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| log(line, Project.MSG_VERBOSE); | |||
| } | |||
| }); | |||
| log("Created Label " + name + " (" + desc + ") with view:\n" + P4View, | |||
| Project.MSG_INFO); | |||
| //Now lock if required | |||
| if (lock != null && lock.equalsIgnoreCase("locked")) { | |||
| log("Modifying lock status to 'locked'", Project.MSG_INFO); | |||
| final StringBuffer labelSpec = new StringBuffer(); | |||
| //Read back the label spec from perforce, | |||
| //Replace Options | |||
| //Submit back to Perforce | |||
| handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| log(line, Project.MSG_VERBOSE); | |||
| if (util.match("/^Options:/", line)) { | |||
| line = "Options: " + lock; | |||
| } | |||
| labelSpec.append(line + "\n"); | |||
| } | |||
| }; | |||
| execP4Command("label -o " + name, handler); | |||
| log(labelSpec.toString(), Project.MSG_DEBUG); | |||
| log("Now locking label...", Project.MSG_VERBOSE); | |||
| handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| log(line, Project.MSG_VERBOSE); | |||
| } | |||
| }; | |||
| handler.setOutput(labelSpec.toString()); | |||
| execP4Command("label -i", handler); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,150 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| /** | |||
| * This method syncs an existing Perforce label against the Perforce client | |||
| * or against a set of files/revisions. | |||
| * | |||
| * | |||
| * Example Usage: | |||
| * <pre> | |||
| * <p4labelsync name="MyLabel-${TSTAMP}-${DSTAMP}" | |||
| * view="//depot/...#head;//depot2/file1#25" /> | |||
| * </pre> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Labelsync extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| protected String name; | |||
| private boolean add; /* -a */ | |||
| private boolean delete; /* -n */ | |||
| private boolean simulationmode; /* -n */ | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * -a flag of p4 labelsync - preserve files which exist in the label, | |||
| * but not in the current view | |||
| * @return add attribute | |||
| * if set to true the task will not remove any files from the label | |||
| * only add files which were not there previously or update these where the revision has changed | |||
| * the add attribute is the -a flag of p4 labelsync | |||
| */ | |||
| public boolean isAdd() { | |||
| return add; | |||
| } | |||
| /** | |||
| * -a flag of p4 labelsync - preserve files which exist in the label, | |||
| * but not in the current view | |||
| * @param add if set to true the task will not remove any files from the label | |||
| * only add files which were not there previously or update these where the revision has changed | |||
| * the add attribute is the -a flag of p4 labelsync | |||
| */ | |||
| public void setAdd(boolean add) { | |||
| this.add = add; | |||
| } | |||
| /** | |||
| * -d flag of p4 labelsync; indicates an intention of deleting from the label | |||
| * the files specified in the view | |||
| * @return delete attribute | |||
| */ | |||
| public boolean isDelete() { | |||
| return delete; | |||
| } | |||
| /** | |||
| * -d flag of p4 labelsync; indicates an intention of deleting from the label | |||
| * the files specified in the view | |||
| * @param delete indicates intention of deleting from the label | |||
| * the files specified in the view | |||
| */ | |||
| public void setDelete(boolean delete) { | |||
| this.delete = delete; | |||
| } | |||
| /** | |||
| * The name of the label; optional, default "AntLabel" | |||
| * @param name of the label | |||
| */ | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| /** | |||
| * -n flag of p4 labelsync - display changes without actually doing them | |||
| * @return -n flag of p4 labelsync | |||
| */ | |||
| public boolean isSimulationmode() { | |||
| return simulationmode; | |||
| } | |||
| /** | |||
| * -n flag of p4 labelsync - display changes without actually doing them | |||
| * @param simulationmode display changes without actually doing them | |||
| */ | |||
| public void setSimulationmode(boolean simulationmode) { | |||
| this.simulationmode = simulationmode; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if the label name is not supplied | |||
| */ | |||
| public void execute() throws BuildException { | |||
| log("P4Labelsync exec:", Project.MSG_INFO); | |||
| if (P4View != null && P4View.length() >= 1) { | |||
| P4View = StringUtils.replace(P4View, ":", "\n\t"); | |||
| P4View = StringUtils.replace(P4View, ";", "\n\t"); | |||
| } | |||
| if (P4View == null) { | |||
| P4View = ""; | |||
| } | |||
| if (name == null || name.length() < 1) { | |||
| throw new BuildException("name attribute is compulsory for labelsync"); | |||
| } | |||
| if (this.isSimulationmode()) { | |||
| P4CmdOpts = P4CmdOpts + " -n"; | |||
| } | |||
| if (this.isDelete()) { | |||
| P4CmdOpts = P4CmdOpts + " -d"; | |||
| } | |||
| if (this.isAdd()) { | |||
| P4CmdOpts = P4CmdOpts + " -a"; | |||
| } | |||
| execP4Command("-s labelsync -l " + name + " " + P4CmdOpts + " " + P4View, | |||
| new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,34 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** Interface for p4 job output stream handler. Classes implementing this interface | |||
| * can be called back by P4Base.execP4Command(); | |||
| * | |||
| */ | |||
| public interface P4OutputHandler { | |||
| /** | |||
| * implementations will be able to process lines of output from Perforce | |||
| * @param line a line of stdout or stderr coming from Perforce | |||
| * @throws BuildException implementations are allowed to throw BuildException | |||
| */ | |||
| void process(String line) throws BuildException; | |||
| } | |||
| @@ -1,85 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import java.io.OutputStream; | |||
| import java.io.ByteArrayOutputStream; | |||
| import java.io.IOException; | |||
| /** | |||
| * heavily inspired from LogOutputStream | |||
| * this stream class calls back the P4Handler on each line of stdout or stderr read | |||
| */ | |||
| public class P4OutputStream extends OutputStream { | |||
| private P4Handler handler; | |||
| private ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||
| private boolean skip = false; | |||
| /** | |||
| * creates a new P4OutputStream for a P4Handler | |||
| * @param handler the handler which will process the streams | |||
| */ | |||
| public P4OutputStream(P4Handler handler) { | |||
| this.handler = handler; | |||
| } | |||
| /** | |||
| * Write the data to the buffer and flush the buffer, if a line | |||
| * separator is detected. | |||
| * | |||
| * @param cc data to log (byte). | |||
| * @throws IOException IOException if an I/O error occurs. In particular, | |||
| * an <code>IOException</code> may be thrown if the | |||
| * output stream has been closed. | |||
| */ | |||
| public void write(int cc) throws IOException { | |||
| final byte c = (byte) cc; | |||
| if ((c == '\n') || (c == '\r')) { | |||
| if (!skip) { | |||
| processBuffer(); | |||
| } | |||
| } else { | |||
| buffer.write(cc); | |||
| } | |||
| skip = (c == '\r'); | |||
| } | |||
| /** | |||
| * Converts the buffer to a string and sends it to <code>processLine</code> | |||
| */ | |||
| protected void processBuffer() { | |||
| handler.process(buffer.toString()); | |||
| buffer.reset(); | |||
| } | |||
| /** | |||
| * Writes all remaining | |||
| * @throws IOException if an I/O error occurs. | |||
| */ | |||
| public void close() throws IOException { | |||
| if (buffer.size() > 0) { | |||
| processBuffer(); | |||
| } | |||
| super.close(); | |||
| } | |||
| } | |||
| @@ -1,60 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| * Reopen Perforce checkout files between changelists. | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Reopen extends P4Base { | |||
| private String toChange = ""; | |||
| /** | |||
| * The changelist to move files to; required. | |||
| * @param toChange new change list number | |||
| * @throws BuildException if the change parameter is null or empty | |||
| */ | |||
| public void setToChange(String toChange) throws BuildException { | |||
| if (toChange == null || toChange.equals("")) { | |||
| throw new BuildException("P4Reopen: tochange cannot be null or empty"); | |||
| } | |||
| this.toChange = toChange; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if P4View is null | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (P4View == null) { | |||
| throw new BuildException("No view specified to reopen"); | |||
| } | |||
| execP4Command("-s reopen -c " + toChange + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,187 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Resolve extends P4Base { | |||
| private String resolvemode = null; | |||
| private boolean redoall; /* -f */ | |||
| private boolean simulationmode; /* -n */ | |||
| private boolean forcetextmode; /* -t */ | |||
| private boolean markersforall; /* -v */ | |||
| private static final String AUTOMATIC = "automatic"; | |||
| private static final String FORCE = "force"; | |||
| private static final String SAFE = "safe"; | |||
| private static final String THEIRS = "theirs"; | |||
| private static final String YOURS = "yours"; | |||
| private static final String[] RESOLVE_MODES = { | |||
| AUTOMATIC, | |||
| FORCE, | |||
| SAFE, | |||
| THEIRS, | |||
| YOURS | |||
| }; | |||
| /** | |||
| * returns the resolve mode | |||
| * @return returns the resolve mode | |||
| */ | |||
| public String getResolvemode() { | |||
| return resolvemode; | |||
| } | |||
| /** | |||
| * values for resolvemode | |||
| * <ul> | |||
| * <li> automatic -am</li> | |||
| * <li> force -af </li> | |||
| * <li> safe -as </li> | |||
| * <li> theirs -at </li> | |||
| * <li> yours -ay </li> | |||
| * </ul> | |||
| * @param resolvemode one of automatic, force, safe, theirs, yours | |||
| */ | |||
| public void setResolvemode(String resolvemode) { | |||
| boolean found = false; | |||
| for (int counter = 0; counter < RESOLVE_MODES.length; counter++) { | |||
| if (resolvemode.equals(RESOLVE_MODES[counter])) { | |||
| found = true; | |||
| break; | |||
| } | |||
| } | |||
| if (!found) { | |||
| throw new BuildException("Unacceptable value for resolve mode"); | |||
| } | |||
| this.resolvemode = resolvemode; | |||
| } | |||
| /** | |||
| * allows previously resolved files to be resolved again | |||
| * @return flag indicating whether one wants to | |||
| * allow previously resolved files to be resolved again | |||
| */ | |||
| public boolean isRedoall() { | |||
| return redoall; | |||
| } | |||
| /** | |||
| * set the redoall flag | |||
| * @param redoall flag indicating whether one want to | |||
| * allow previously resolved files to be resolved again | |||
| */ | |||
| public void setRedoall(boolean redoall) { | |||
| this.redoall = redoall; | |||
| } | |||
| /** | |||
| * read the simulation mode flag | |||
| * @return flag indicating whether one wants just to simulate | |||
| * the p4 resolve operation without actually doing it | |||
| */ | |||
| public boolean isSimulationmode() { | |||
| return simulationmode; | |||
| } | |||
| /** | |||
| * sets a flag | |||
| * @param simulationmode set to true, lists the integrations which would be performed, | |||
| * without actually doing them. | |||
| */ | |||
| public void setSimulationmode(boolean simulationmode) { | |||
| this.simulationmode = simulationmode; | |||
| } | |||
| /** | |||
| * If set to true, attempts a textual merge, even for binary files | |||
| * @return flag value | |||
| */ | |||
| public boolean isForcetextmode() { | |||
| return forcetextmode; | |||
| } | |||
| /** | |||
| * If set to true, attempts a textual merge, even for binary files | |||
| * @param forcetextmode set the flag value | |||
| */ | |||
| public void setForcetextmode(boolean forcetextmode) { | |||
| this.forcetextmode = forcetextmode; | |||
| } | |||
| /** | |||
| * If set to true, puts in markers for all changes, conflicting or not | |||
| * @return flag markersforall value | |||
| */ | |||
| public boolean isMarkersforall() { | |||
| return markersforall; | |||
| } | |||
| /** | |||
| * If set to true, puts in markers for all changes, conflicting or not | |||
| * @param markersforall flag true or false | |||
| */ | |||
| public void setMarkersforall(boolean markersforall) { | |||
| this.markersforall = markersforall; | |||
| } | |||
| /** | |||
| * execute the p4 resolve | |||
| * @throws BuildException if there is a wrong resolve mode specified | |||
| * or no view specified | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (this.resolvemode.equals(AUTOMATIC)) { | |||
| P4CmdOpts = P4CmdOpts + " -am"; | |||
| } else if (this.resolvemode.equals(FORCE)) { | |||
| P4CmdOpts = P4CmdOpts + " -af"; | |||
| } else if (this.resolvemode.equals(SAFE)) { | |||
| P4CmdOpts = P4CmdOpts + " -as"; | |||
| } else if (this.resolvemode.equals(THEIRS)) { | |||
| P4CmdOpts = P4CmdOpts + " -at"; | |||
| } else if (this.resolvemode.equals(YOURS)) { | |||
| P4CmdOpts = P4CmdOpts + " -ay"; | |||
| } else { | |||
| throw new BuildException("unsupported or absent resolve mode"); | |||
| } | |||
| if (P4View == null) { | |||
| throw new BuildException("please specify a view"); | |||
| } | |||
| if (this.isRedoall()) { | |||
| P4CmdOpts = P4CmdOpts + " -f"; | |||
| } | |||
| if (this.isSimulationmode()) { | |||
| P4CmdOpts = P4CmdOpts + " -n"; | |||
| } | |||
| if (this.isForcetextmode()) { | |||
| P4CmdOpts = P4CmdOpts + " -t"; | |||
| } | |||
| if (this.isMarkersforall()) { | |||
| P4CmdOpts = P4CmdOpts + " -v"; | |||
| } | |||
| execP4Command("-s resolve " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,85 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| /** | |||
| * Revert Perforce open files or files in a changelist | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Revert extends P4Base { | |||
| private String revertChange = null; | |||
| private boolean onlyUnchanged = false; | |||
| /** | |||
| * The changelist to revert; optional. | |||
| * @param revertChange : the change list to revert | |||
| * @throws BuildException if the change list is null or empty string | |||
| */ | |||
| public void setChange(String revertChange) throws BuildException { | |||
| if (revertChange == null || revertChange.equals("")) { | |||
| throw new BuildException("P4Revert: change cannot be null or empty"); | |||
| } | |||
| this.revertChange = revertChange; | |||
| } | |||
| /** | |||
| * flag to revert only unchanged files (p4 revert -a); optional, default false. | |||
| * @param onlyUnchanged if set to true revert only unchanged files | |||
| */ | |||
| public void setRevertOnlyUnchanged(boolean onlyUnchanged) { | |||
| this.onlyUnchanged = onlyUnchanged; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if an error occurs during the execution of the Perforce command | |||
| * and failonError is set to true | |||
| */ | |||
| public void execute() throws BuildException { | |||
| /* Here we can either revert any unchanged files in a changelist | |||
| * or | |||
| * any files regardless of whether they have been changed or not | |||
| * | |||
| * | |||
| * The whole process also accepts a p4 filespec | |||
| */ | |||
| String p4cmd = "-s revert"; | |||
| if (onlyUnchanged) { | |||
| p4cmd += " -a"; | |||
| } | |||
| if (revertChange != null) { | |||
| p4cmd += " -c " + revertChange; | |||
| } | |||
| execP4Command(p4cmd + " " + P4View, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,155 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import java.util.Vector; | |||
| /** Submits a numbered changelist to Perforce. | |||
| * | |||
| * <B>Note:</B> P4Submit cannot (yet) submit the default changelist. | |||
| * This shouldn't be a problem with the ANT task as the usual flow is | |||
| * P4Change to create a new numbered change followed by P4Edit then P4Submit. | |||
| * | |||
| * Example Usage:-<br> | |||
| * <p4submit change="${p4.change}" /> | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Submit extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| //ToDo: If dealing with default cl need to parse out <enter description here> | |||
| /** | |||
| * change list number | |||
| */ | |||
| public String change; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * change property | |||
| */ | |||
| private String changeProperty; | |||
| /** | |||
| * needsresolveproperty | |||
| */ | |||
| private String needsResolveProperty; | |||
| /** | |||
| * set the change list number to submit | |||
| * @param change The changelist number to submit; required. | |||
| */ | |||
| public void setChange(String change) { | |||
| this.change = change; | |||
| } | |||
| /** | |||
| * property defining the change number if the change number gets renumbered | |||
| * @param changeProperty name of a new property to which the change number | |||
| * will be assigned if it changes | |||
| * @since ant 1.6.1 | |||
| */ | |||
| public void setChangeProperty(String changeProperty) { | |||
| this.changeProperty = changeProperty; | |||
| } | |||
| /** | |||
| * property defining the need to resolve the change list | |||
| * @param needsResolveProperty a property which will be set if the change needs resolve | |||
| * @since ant 1.6.1 | |||
| */ | |||
| public void setNeedsResolveProperty(String needsResolveProperty) { | |||
| this.needsResolveProperty = needsResolveProperty; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if no change list specified | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (change != null) { | |||
| execP4Command("submit -c " + change, (P4HandlerAdapter) new P4SubmitAdapter(this)); | |||
| } else { | |||
| //here we'd parse the output from change -o into submit -i | |||
| //in order to support default change. | |||
| throw new BuildException("No change specified (no support for default change yet...."); | |||
| } | |||
| } | |||
| /** | |||
| * internal class used to process the output of p4 submit | |||
| */ | |||
| public class P4SubmitAdapter extends SimpleP4OutputHandler { | |||
| /** | |||
| * Constructor. | |||
| * @param parent a P4Base instance. | |||
| */ | |||
| public P4SubmitAdapter(P4Base parent) { | |||
| super(parent); | |||
| } | |||
| /** | |||
| * process a line of stdout/stderr coming from Perforce | |||
| * @param line line of stdout or stderr coming from Perforce | |||
| */ | |||
| public void process(String line) { | |||
| super.process(line); | |||
| getProject().setProperty("p4.needsresolve", "0"); | |||
| // this type of output might happen | |||
| // Change 18 renamed change 20 and submitted. | |||
| if (util.match("/renamed/", line)) { | |||
| try { | |||
| Vector myarray = new Vector(); | |||
| util.split(myarray, line); | |||
| boolean found = false; | |||
| final int size = myarray.size(); | |||
| for (int counter = 0; counter < size; counter++) { | |||
| if (found) { | |||
| String chnum = (String) myarray.elementAt(counter + 1); | |||
| int changenumber = Integer.parseInt(chnum); | |||
| log("Perforce change renamed " + changenumber, Project.MSG_INFO); | |||
| getProject().setProperty("p4.change", "" + changenumber); | |||
| if (changeProperty != null) { | |||
| getProject().setNewProperty(changeProperty, chnum); | |||
| } | |||
| found = false; | |||
| } | |||
| if (((myarray.elementAt(counter))).equals("renamed")) { | |||
| found = true; | |||
| } | |||
| } | |||
| // NumberFormatException or ArrayOutOfBondsException could happen here | |||
| } catch (Exception e) { | |||
| String msg = "Failed to parse " + line + "\n" | |||
| + " due to " + e.getMessage(); | |||
| throw new BuildException(msg, e, getLocation()); | |||
| } | |||
| } | |||
| if (util.match("/p4 submit -c/", line)) { | |||
| getProject().setProperty("p4.needsresolve", "1"); | |||
| if (needsResolveProperty != null) { | |||
| getProject().setNewProperty(needsResolveProperty, "true"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1,107 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| /** Synchronize client space to a Perforce depot view. | |||
| * | |||
| * The API allows additional functionality of the "p4 sync" command | |||
| * (such as "p4 sync -f //...#have" or other exotic invocations).</P> | |||
| * | |||
| * <b>Example Usage:</b> | |||
| * <table border="1"> | |||
| * <th>Function</th><th>Command</th> | |||
| * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings specified</td> | |||
| * <td><P4Sync <br>P4view="//projects/foo/main/source/..." <br> | |||
| * P4User="fbloggs" <br>P4Port="km01:1666" <br>P4Client="fbloggsclient" /></td></tr> | |||
| * <tr><td>Sync to head using P4USER, P4PORT and P4CLIENT settings defined in environment</td> | |||
| * <td><P4Sync P4view="//projects/foo/main/source/..." /></td></tr> | |||
| * <tr><td>Force a re-sync to head, refreshing all files</td> | |||
| * <td><P4Sync force="yes" P4view="//projects/foo/main/source/..." /></td></tr> | |||
| * <tr><td>Sync to a label</td><td><P4Sync label="myPerforceLabel" /></td></tr> | |||
| * </table> | |||
| * | |||
| * @todo Add decent label error handling for non-exsitant labels | |||
| * | |||
| * @ant.task category="scm" | |||
| */ | |||
| public class P4Sync extends P4Base { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| String label; | |||
| private String syncCmd = ""; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * Label to sync client to; optional. | |||
| * @param label name of a label against which one want to sync | |||
| * @throws BuildException if label is null or empty string | |||
| */ | |||
| public void setLabel(String label) throws BuildException { | |||
| if (label == null || label.equals("")) { | |||
| throw new BuildException("P4Sync: Labels cannot be Null or Empty"); | |||
| } | |||
| this.label = label; | |||
| } | |||
| /** | |||
| * force a refresh of files, if this attribute is set; false by default. | |||
| * @param force sync all files, whether they are supposed to be already uptodate or not. | |||
| * @throws BuildException if a label is set and force is null | |||
| */ | |||
| public void setForce(String force) throws BuildException { | |||
| if (force == null && !label.equals("")) { | |||
| throw new BuildException("P4Sync: If you want to force, set force to non-null string!"); | |||
| } | |||
| P4CmdOpts = "-f"; | |||
| } | |||
| /** | |||
| * do the work | |||
| * @throws BuildException if an error occurs during the execution of the Perforce command | |||
| * and failOnError is set to true | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (P4View != null) { | |||
| syncCmd = P4View; | |||
| } | |||
| if (label != null && !label.equals("")) { | |||
| syncCmd = syncCmd + "@" + label; | |||
| } | |||
| log("Execing sync " + P4CmdOpts + " " + syncCmd, Project.MSG_VERBOSE); | |||
| execP4Command("-s sync " + P4CmdOpts + " " + syncCmd, new SimpleP4OutputHandler(this)); | |||
| } | |||
| } | |||
| @@ -1,96 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| /* | |||
| * Portions of this software are based upon public domain software | |||
| * originally written at the National Center for Supercomputing Applications, | |||
| * University of Illinois, Urbana-Champaign. | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.util.StringUtils; | |||
| /** | |||
| * simple implementation of P4HandlerAdapter used by tasks which are not | |||
| * actually processing the output from Perforce | |||
| */ | |||
| public class SimpleP4OutputHandler extends P4HandlerAdapter { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| P4Base parent; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * simple constructor | |||
| * @param parent a P4Base instance | |||
| */ | |||
| public SimpleP4OutputHandler(P4Base parent) { | |||
| this.parent = parent; | |||
| } | |||
| /** | |||
| * process one line of stderr/stdout | |||
| * if error conditions are detected, then setters are called on the | |||
| * parent | |||
| * @param line line of output | |||
| * @throws BuildException does not throw exceptions any more | |||
| */ | |||
| public void process(String line) throws BuildException { | |||
| if (parent.util.match("/^exit/", line)) { | |||
| return; | |||
| } | |||
| //Throw exception on errors (except up-to-date) | |||
| // | |||
| //When a server is down, the code expects : | |||
| //Perforce client error: | |||
| //Connect to server failed; check $P4PORT. | |||
| //TCP connect to localhost:1666 failed. | |||
| //connect: localhost:1666: Connection refused | |||
| //Some forms producing commands (p4 -s change -o) do tag the output | |||
| //others don't..... | |||
| //Others mark errors as info, for example edit a file | |||
| //which is already open for edit..... | |||
| //Just look for error: - catches most things.... | |||
| if (parent.util.match("/^error:/", line) | |||
| || parent.util.match("/^Perforce client error:/", line)) { | |||
| //when running labelsync, if view elements are in sync, | |||
| //Perforce produces a line of output | |||
| //looking like this one : | |||
| //error: //depot/file2 - label in sync. | |||
| if (!parent.util.match("/label in sync/", line) | |||
| && !parent.util.match("/up-to-date/", line)) { | |||
| parent.setInError(true); | |||
| } else { | |||
| //sync says "error:" when a file is up-to-date | |||
| line = parent.util.substitute("s/^[^:]*: //", line); | |||
| } | |||
| } else if (parent.util.match("/^info.*?:/", line)) { | |||
| //sometimes there's "info1: | |||
| line = parent.util.substitute("s/^[^:]*: //", line); | |||
| } | |||
| parent.log(line, parent.getInError() ? Project.MSG_ERR : Project.MSG_INFO); | |||
| if (parent.getInError()) { | |||
| parent.setErrorMessage(parent.getErrorMessage() + line + StringUtils.LINE_SEP); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,40 +0,0 @@ | |||
| <!-- | |||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||
| contributor license agreements. See the NOTICE file distributed with | |||
| this work for additional information regarding copyright ownership. | |||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| (the "License"); you may not use this file except in compliance with | |||
| the License. You may obtain a copy of the License at | |||
| http://www.apache.org/licenses/LICENSE-2.0 | |||
| Unless required by applicable law or agreed to in writing, software | |||
| distributed under the License is distributed on an "AS IS" BASIS, | |||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <body> | |||
| ANT Tasks for Perforce integration. | |||
| These tasks provide basic P4 capabilities to automated ANT-based build systems. <b>Note:</b> | |||
| the tasks in this package are linked against the Jakarta ORO 2.0 library which | |||
| brings the power of Perl 5 regular expressions to Java. | |||
| These tasks also require you to have the p4 (or p4.exe) client in your path. | |||
| @see <A HREF="http://ant.apache.org/">Ant Project</A> | |||
| @see <A HREF="http://www.perforce.com/">Perforce</A> | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Sync | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Label | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Have | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Change | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Edit | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Submit | |||
| @see org.apache.tools.ant.taskdefs.optional.perforce.P4Counter | |||
| @author <A HREF="mailto:leslie.hughes@rubus.com">Les Hughes</A> | |||
| </body> | |||
| @@ -1,52 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.taskdefs.optional.perforce; | |||
| import junit.framework.TestCase; | |||
| import org.apache.oro.text.perl.Perl5Util; | |||
| /** | |||
| * Basic testcase to ensure that backslashing is OK. | |||
| */ | |||
| public class P4ChangeTest extends TestCase { | |||
| protected P4Change p4change; | |||
| public P4ChangeTest(String s) { | |||
| super(s); | |||
| } | |||
| protected void setUp() throws Exception { | |||
| p4change = new P4Change(); | |||
| } | |||
| public void testBackslash(){ | |||
| String input = "comment with a / inside"; | |||
| String output = P4Change.backslash(input); | |||
| assertEquals("comment with a \\/ inside", output); | |||
| } | |||
| public void testSubstitute(){ | |||
| Perl5Util util = new Perl5Util(); | |||
| String tosubstitute = "xx<here>xx"; | |||
| String input = P4Change.backslash("/a/b/c/"); | |||
| String output = util.substitute("s/<here>/" + input + "/", tosubstitute); | |||
| assertEquals("xx/a/b/c/xx", output); | |||
| } | |||
| } | |||
| @@ -1,32 +0,0 @@ | |||
| <?xml version="1.0"?> | |||
| <!-- | |||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||
| contributor license agreements. See the NOTICE file distributed with | |||
| this work for additional information regarding copyright ownership. | |||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| (the "License"); you may not use this file except in compliance with | |||
| the License. You may obtain a copy of the License at | |||
| http://www.apache.org/licenses/LICENSE-2.0 | |||
| Unless required by applicable law or agreed to in writing, software | |||
| distributed under the License is distributed on an "AS IS" BASIS, | |||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <!-- author Antoine Levy-Lambert levylambert@tiscali-dsl.de --> | |||
| <!-- this test demonstrates p4integrate --> | |||
| <project name="integrate" default= "testintegrate"> | |||
| <property name="second_client" value="levyant_cygwin_test"/> | |||
| <property name="second_client_root" value="C:\dev\test"/> | |||
| <property name="depot_file_spec" value="//depot/foobar"/> | |||
| <property name="depot_file_spec_2" value="//depot/hello"/> | |||
| <target name="testintegrate"> | |||
| <p4change client="${second_client}"/> | |||
| <property name="change1" value="${p4.change}" /> | |||
| <p4integrate client="${second_client}" change="${p4.change}" fromfile="${depot_file_spec}" tofile="${depot_file_spec_2}" forceintegrate="true" /> | |||
| <p4resolve client="${second_client}" view="${depot_file_spec_2}" resolvemode="theirs"/> | |||
| <p4submit client="${second_client}" change="${p4.change}"/> | |||
| </target> | |||
| </project> | |||