Sunday, December 7, 2003, 11:23:16 PM, you wrote: > I've just checked in a p4sync task into nantcontrib. Please grab a > nightly and try it out. More p4 tasks to come - add, submit etc.
Works like a charm! I had to tweak the build file (patch attached) and build NAntContrib CVS head with .NET 1.0 -- couldn't figure out how to work around build errors with .NET 1.1. Once I got it built, though, everything was fine. I got as far in my own efforts as to build a base class with support for Ant's p4.{port|client|user|passwd} properties. I figure it'll be useful in producing buildfiles that work on both developer boxes and build machines. Is that level of compatibility with Ant's Perforce tasks -- http://ant.apache.org/manual/OptionalTasks/perforce.html -- something of interest? Or with Ant tasks in general? I also attached a minimal p4print task. We use it to fetch a clientspec file and feed it to 'p4 client -i' so that's the next task I'll work on. (Maybe after flush -- another one we use.) Should I send them to nantcontrib-developer? -- sig://boB http://foobob.com
NAntContrib.build.patch
Description: Binary data
// NAnt - A .NET build tool // Copyright (C) 2001-2002 Gerry Shaw // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // Bob Arnson ([EMAIL PROTECTED]) using System; using System.Text; using NAnt.Core; using NAnt.Core.Util; using NAnt.Core.Tasks; using NAnt.Core.Attributes; namespace NAnt.Contrib.Tasks.Perforce { /// <summary> /// Fetch a specific file from a Perforce depot without needing a clientspec to map it. Wraps the 'p4 print' command. /// </summary> /// <remarks> /// <para> /// ///<code> /// <![CDATA[ ///<p4print file="//depot/foo/mainline/clientspec" outputfile=".\clientspec" /> ///<p4client input=".\clientspec" /> /// ]]> /// </code> /// </para> /// </remarks> /// <todo> fileset? </todo> /// <author> <a href="mailto:[EMAIL PROTECTED]">Bob Arnson</a></author> [TaskName("p4print")] public class P4Print : P4Base { #region Private Instance Fields private string _file = null; private string _outputFile = null; #endregion Private Instance Fields #region Public Instance Properties /// <summary> /// The depot or local filename (including optional path) of the file to fetch; required /// </summary> [TaskAttribute("file", Required = true)] public string File { get { return _file; } set { _file = StringUtils.ConvertEmptyToNull(value); } } /// <summary> /// The local filename to write the fetched file to; required /// </summary> [TaskAttribute("outputfile", Required = true)] public string P4OutputFile { get { return _outputFile; } set { _outputFile = StringUtils.ConvertEmptyToNull(value); } } #endregion Public Instance Properties /// <summary> /// This is an override used by the base class to get command specific args. /// </summary> protected override string CommandSpecificArguments { get { return getSpecificCommandArguments(); } } #region Override implementation of Task /// <summary> /// local method to build the command string for this particular command /// </summary> /// <returns></returns> protected string getSpecificCommandArguments( ) { StringBuilder arguments = new StringBuilder(); arguments.Append("-s print -q "); arguments.Append(string.Format("-o {0} ", P4OutputFile)); arguments.Append(File); return arguments.ToString(); } #endregion Override implementation of Task } }