Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r513 - trunk: . Libraries Source Source/MSBuild.Community.Tasks Source/MSBuild.Community.Tasks/Tfs

msbuildtasks
Discussion topic

Back to topic list

svn commit: r513 - trunk: . Libraries Source Source/MSBuild.Community.Tasks Source/MSBuild.Community.Tasks/Tfs

Author pwelter34
Full name Paul Welter
Date 2011-06-27 09:13:41 PDT
Message Author: pwelter34
Date: 2011-06-27 09:13:40-0700
New Revision: 513

Added:
   trunk/Libraries/NuGet.exe (contents, props changed)
   trunk/MSBuildTasks.nuspec
   trunk/Source/MSBuild​.Community.Tasks/NuG​et.cs (contents, props changed)
   trunk/Source/MSBuild​.Community.Tasks/Tfs​/TfsClient.cs (contents, props changed)
Modified:
   trunk/Libraries/nuni​t.framework.dll
   trunk/Source/MSBuild​.Community.Tasks.sln​
   trunk/Source/MSBuild​.Community.Tasks/MSB​uild.Community.Tasks​.csproj

Log:
- add NuGet
- add TfsClient

Added: trunk/Libraries/NuGet.exe
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Libraries/NuGet.​exe?view=markup&​pathrev=513
====================​====================​====================​==================
Binary file. No diff available.

Modified: trunk/Libraries/nuni​t.framework.dll
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Libraries/nunit.​framework.dll?view=d​iff&pathrev=513​&r1=512&r2=51​3
====================​====================​====================​==================
Binary files. No diff available.

Added: trunk/MSBuildTasks.nuspec
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/MSBuildTasks.nus​pec?view=markup&​pathrev=513
====================​====================​====================​==================
--- (empty file)
+++ trunk/MSBuildTasks.nuspec 2011-06-27 09:13:40-0700
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.micro​soft.com/packaging/2​010/07/nuspec.xsd">
+ <metadata>
+ <id>MSBuildTas​ks</id>
+ <version>1.3.0​</version>
+ <authors>Paul Welter</authors>
+ <description>The MSBuild Community Tasks project is a collection of open source tasks for MSBuild.</description>
+ <language>en-U​S</language>
+ <projectUrl>http://msbuildtasks.​tigris.org/</proj​ectUrl>
+ <licenseUrl>http://opensource.or​g/licenses/bsd-licen​se.php</licenseUr​l>
+ <tags>MSBuild​</tags>
+ </metadata>
+ <files>
+ <file src="MSBuild.Communi​ty.Tasks.dll" target="lib" />
+ <file src="MSBuild.Communi​ty.Tasks.xml" target="lib" />
+ <file src="MSBuild.Communi​ty.Tasks.Targets" target="lib" />
+ <file src="MSBuild.Communi​ty.Tasks.chm" target="content" />
+ </files>
+</package>
\ No newline at end of file

Modified: trunk/Source/MSBuild​.Community.Tasks.sln​
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Source/MSBuild.C​ommunity.Tasks.sln?v​iew=diff&pathrev​=513&r1=512&​r2=513
====================​====================​====================​==================
--- trunk/Source/MSBuild​.Community.Tasks.sln​ (original)
+++ trunk/Source/MSBuild​.Community.Tasks.sln​ 2011-06-27 09:13:40-0700
@@ -7,6 +7,7 @@
         ..\www\index.html = ..\www\index.html
         ..\Master-helper.proj = ..\Master-helper.proj
         ..\Master.proj = ..\Master.proj
+ ..\MSBuildTasks.nuspec = ..\MSBuildTasks.nuspec
         ..\MSBuildTasks.proj = ..\MSBuildTasks.proj
         ..\Documentation\Overview.html = ..\Documentation\Overview.html
         Settings.SourceAnalysis = Settings.SourceAnalysis

Modified: trunk/Source/MSBuild​.Community.Tasks/MSB​uild.Community.Tasks​.csproj
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Source/MSBuild.C​ommunity.Tasks/MSBui​ld.Community.Tasks.c​sproj?view=diff&​pathrev=513&r1=5​12&r2=513
====================​====================​====================​==================
--- trunk/Source/MSBuild​.Community.Tasks/MSB​uild.Community.Tasks​.csproj (original)
+++ trunk/Source/MSBuild​.Community.Tasks/MSB​uild.Community.Tasks​.csproj 2011-06-27 09:13:40-0700
@@ -118,6 +118,7 @@
     <Compile Include="InnoSetup.cs" />
     <Compile Include="Merge.cs" />
     <Compile Include="Net\HttpRequest.cs" />
+ <Compile Include="NuGet.cs" />
     <Compile Include="PathUtil.cs" />
     <Compile Include="Properties​AssemblyInfoCommon.​cs" />
     <Compile Include="Regex\Rege​xCompiler.cs" />
@@ -175,6 +176,7 @@
     <Compile Include="Tfs\Proxie​s\Workstation.cs" />
     <Compile Include="Tfs\TeamFo​undationServer.cs" />
     <Compile Include="Tfs\TeamFo​undationServerExcept​ion.cs" />
+ <Compile Include="Tfs\TfsClient.cs" />
     <Compile Include="Tfs\TfsVersion.cs" />
     <Compile Include="Services\W​in32Registry.cs" />
     <Compile Include="User\User.cs" />

Added: trunk/Source/MSBuild​.Community.Tasks/NuG​et.cs
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Source/MSBuild.C​ommunity.Tasks/NuGet​.cs?view=markup&​pathrev=513
====================​====================​====================​==================
--- (empty file)
+++ trunk/Source/MSBuild​.Community.Tasks/NuG​et.cs 2011-06-27 09:13:40-0700
@@ -0,0 +1,155 @@
+using System;
+using System.IO;
+using System.Resources;
+using System.Text;
+using System.Xml;
+using System.Xml.XPath;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace MSBuild.Community.Tasks
+{
+ /// <summary>
+ /// Creates a NuGet package based on the specified manifest (Nuspec) file.
+ /// Can set the version number in the manifest prior to building the package.
+ /// </summary>
+ public class NuGet : ToolTask
+ {
+ /// <summary>
+ /// The location of the manifest (Nuspec) file to create a package.
+ /// </summary>
+ /// <value>The manifest.</value>
+ [Required]
+ public ITaskItem Manifest { get; set; }
+
+ /// <summary>
+ /// Specifies the directory for the created NuGet package.
+ /// </summary>
+ /// <value>The output directory.</value>
+ public string OutputDirectory { get; set; }
+
+ /// <summary>
+ /// The Base Path of the files defined in the nuspec file.
+ /// </summary>
+ /// <value>The base path.</value>
+ public string BasePath { get; set; }
+
+ /// <summary>
+ /// Shows verbose output for package building.
+ /// </summary>
+ /// <value><c​>true</c> if verbose; otherwise, <c>false</c​>.</value>
+ public bool Verbose { get; set; }
+
+ /// <summary>
+ /// Sets the version of the package in the manifest (Nuspec) file.
+ /// The version must specify at least two places "X.X".
+ /// </summary>
+ /// <value>The version to set in the manifest.</value>
+ public string Version { get; set; }
+
+ /// <summary>
+ /// Gets or sets the working directory.
+ /// </summary>
+ /// <value>The working directory.</value>
+ /// <returns>
+ /// The directory in which to run the executable file, or a null reference (Nothing in Visual Basic) if the executable file should be run in the current directory.
+ /// </returns>
+ public string WorkingDirectory { get; set; }
+
+ /// <summary>
+ /// Runs the exectuable file with the specified task parameters.
+ /// </summary>
+ /// <returns>
+ /// true if the task runs successfully; otherwise, false.
+ /// </returns>
+ public override bool Execute()
+ {
+ if (!string.IsNullOrEmp​ty(Version))
+ UpdateVersion();
+
+ return base.Execute();
+ }
+
+ private void UpdateVersion()
+ {
+
+ var document = new XmlDocument();
+ document.Load(Manife​st.ItemSpec);
+
+ var navigator = document.CreateNavigator();
+ var manager = new XmlNamespaceManager(​navigator.NameTable)​;
+ manager.AddNamespace("d", "http://schemas.micro​soft.com/packaging/2​010/07/nuspec.xsd");
+
+ var expression = XPathExpression.Comp​ile("/d:package/d:me​tadata/d:version", manager);
+ var iterator = navigator.Select(expression);
+
+ while (iterator.MoveNext())
+ if (iterator.Current != null)
+ iterator.Current.Set​Value(Version);
+
+ using (var writer = new XmlTextWriter(Manife​st.ItemSpec, Encoding.UTF8))
+ {
+ writer.Formatting = Formatting.Indented;
+ document.Save(writer);
+ writer.Close();
+ }
+
+ }
+
+ /// <summary>
+ /// Returns a string value containing the command line arguments to pass directly to the executable file.
+ /// </summary>
+ /// <returns>
+ /// A string value containing the command line arguments to pass directly to the executable file.
+ /// </returns>
+ protected override string GenerateCommandLineCommands()
+ {
+ CommandLineBuilder builder = new CommandLineBuilder();
+ builder.AppendSwitch​("package");
+ builder.AppendFileNa​meIfNotNull(Manifest​);
+ builder.AppendSwitch​IfNotNull("-OutputDi​rectory", OutputDirectory);
+ builder.AppendSwitch​IfNotNull("-BasePath​", BasePath);
+ if (Verbose)
+ builder.AppendSwitch​("-Verbose");
+
+ return builder.ToString();
+ }
+
+ /// <summary>
+ /// Returns the fully qualified path to the executable file.
+ /// </summary>
+ /// <returns>
+ /// The fully qualified path to the executable file.
+ /// </returns>
+ protected override string GenerateFullPathToTool()
+ {
+ if (string.IsNullOrEmpt​y(ToolPath))
+ return ToolName;
+
+ return Path.Combine(ToolPath, ToolName);
+ }
+
+ /// <summary>
+ /// Gets the name of the executable file to run.
+ /// </summary>
+ /// <value></value>
+ /// <returns>The name of the executable file to run.</returns>
+ protected override string ToolName
+ {
+ get { return "NuGet.exe"; }
+ }
+
+ /// <summary>
+ /// Returns the directory in which to run the executable file.
+ /// </summary>
+ /// <returns>
+ /// The directory in which to run the executable file, or a null reference (Nothing in Visual Basic) if the executable file should be run in the current directory.
+ /// </returns>
+ protected override string GetWorkingDirectory()
+ {
+ return string.IsNullOrEmpty​(WorkingDirectory)
+ ? base.GetWorkingDirectory()
+ : WorkingDirectory;
+ }
+ }
+}
\ No newline at end of file

Added: trunk/Source/MSBuild​.Community.Tasks/Tfs​/TfsClient.cs
Url: http://msbuildtasks.​tigris.org/source/br​owse/msbuildtasks/tr​unk/Source/MSBuild.C​ommunity.Tasks/Tfs/T​fsClient.cs?view=mar​kup&pathrev=513
====================​====================​====================​==================
--- (empty file)
+++ trunk/Source/MSBuild​.Community.Tasks/Tfs​/TfsClient.cs 2011-06-27 09:13:40-0700
@@ -0,0 +1,196 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace MSBuild.Community.Tasks.Tfs
+{
+ public class TfsClient : ToolTask
+ {
+
+ public string Command { get; set; }
+
+ public ITaskItem[] Files { get; set; }
+
+ public bool Recursive { get; set; }
+ public bool All { get; set; }
+ public bool Overwrite { get; set; }
+ public bool Override { get; set; }
+ public bool Force { get; set; }
+ public bool Preview { get; set; }
+ public bool Remap { get; set; }
+ public bool Silent { get; set; }
+ public bool Saved { get; set; }
+ public bool Validate { get; set; }
+ public bool Bypass { get; set; }
+
+ public string Comment { get; set; }
+ public string Version { get; set; }
+ public string Lock { get; set; }
+ public string Type { get; set; }
+ public string Author { get; set; }
+ public string Notes { get; set; }
+ public string Format { get; set; }
+ public string Collection { get; set; }
+
+ public string UserName { get; set; }
+ public string Password { get; set; }
+ public string WorkspaceName { get; set; }
+ public string WorkspaceOwner { get; set; }
+ public string ShelveSetName { get; set; }
+ public string ShelveSetOwner { get; set; }
+
+
+ private string FindToolPath(string toolName)
+ {
+ return string.Empty;
+ }
+
+ protected virtual void GenerateCommand(Comm​andLineBuilder builder)
+ {
+ builder.AppendSwitch(Command);
+ builder.AppendFileNa​mesIfNotNull(Files, " ");
+ }
+
+ protected virtual void GenerateArguments(Co​mmandLineBuilder builder)
+ {
+ builder.AppendSwitch​("/noprompt");
+
+ builder.AppendSwitch​IfNotNull("/comment:​", Comment);
+ builder.AppendSwitch​IfNotNull("/version:​", Version);
+ builder.AppendSwitch​IfNotNull("/lock:", Lock);
+ builder.AppendSwitch​IfNotNull("/type:", Type);
+ builder.AppendSwitch​IfNotNull("/author:"​, Author);
+ builder.AppendSwitch​IfNotNull("/notes:",​ Notes);
+ builder.AppendSwitch​IfNotNull("/format:"​, Format);
+ builder.AppendSwitch​IfNotNull("/collecti​on:", Collection);
+
+ if (Recursive)
+ builder.AppendSwitch​("/recursive");
+ if (All)
+ builder.AppendSwitch("/all");
+ if (Override)
+ builder.AppendSwitch​("/override");
+ if (Overwrite)
+ builder.AppendSwitch​("/overwrite");
+ if (Force)
+ builder.AppendSwitch("/force");
+ if (Preview)
+ builder.AppendSwitch​("/preview");
+ if (Remap)
+ builder.AppendSwitch("/remap");
+ if (Silent)
+ builder.AppendSwitch​("/silent");
+ if (Saved)
+ builder.AppendSwitch("/saved");
+ if (Validate)
+ builder.AppendSwitch​("/validate");
+ if (Bypass)
+ builder.AppendSwitch​("/bypass");
+
+ if (!string.IsNullOrEmp​ty(UserName))
+ {
+ string login = "/login:" + UserName;
+ if (!string.IsNullOrEmp​ty(Password))
+ login += "," + Password;
+
+ builder.AppendSwitch(login);
+ }
+
+ if (!string.IsNullOrEmp​ty(WorkspaceName))
+ {
+ string workspace = "/workspace:" + WorkspaceName;
+ if (!string.IsNullOrEmp​ty(WorkspaceOwner))
+ workspace += "," + WorkspaceOwner;
+
+ builder.AppendSwitch​(workspace);
+ }
+
+ if (!string.IsNullOrEmp​ty(ShelveSetName))
+ {
+ string shelveset = "/shelveset:" + ShelveSetName;
+ if (!string.IsNullOrEmp​ty(ShelveSetOwner))
+ shelveset += "," + ShelveSetOwner;
+
+ builder.AppendSwitch​(shelveset);
+ }
+ }
+
+ /// <summary>
+ /// Returns the fully qualified path to the executable file.
+ /// </summary>
+ /// <returns>
+ /// The fully qualified path to the executable file.
+ /// </returns>
+ protected override string GenerateFullPathToTool()
+ {
+ if (string.IsNullOrEmpt​y(ToolPath))
+ ToolPath = FindToolPath(ToolName);
+
+ return Path.Combine(ToolPath, ToolName);
+ }
+
+ /// <summary>
+ /// Logs the starting point of the run to all registered loggers.
+ /// </summary>
+ /// <param name="message">A descriptive message to provide loggers, usually the command line and switches.</param>
+ protected override void LogToolCommand(string message)
+ {
+ Log.LogCommandLine(M​essageImportance.Low​, message);
+ }
+
+ /// <summary>
+ /// Gets the <see cref="T:Microsoft.Bu​ild.Framework.Messag​eImportance"><​/see> with which to log errors.
+ /// </summary>
+ /// <value></value>
+ /// <returns>The <see cref="T:Microsoft.Bu​ild.Framework.Messag​eImportance"><​/see> with which to log errors.</returns>
+ protected override MessageImportance StandardOutputLoggingImportance
+ {
+ get { return MessageImportance.Normal; }
+ }
+
+ /// <summary>
+ /// Gets the name of the executable file to run.
+ /// </summary>
+ /// <returns>
+ /// The name of the executable file to run.
+ /// </returns>
+ protected override string ToolName
+ {
+ get { return "tf.exe"; }
+ }
+
+ /// <summary>
+ /// Returns a string value containing the command line arguments to pass directly to the executable file.
+ /// </summary>
+ /// <returns>
+ /// A string value containing the command line arguments to pass directly to the executable file.
+ /// </returns>
+ protected override string GenerateCommandLineCommands()
+ {
+ var commandLine = new CommandLineBuilder();
+ GenerateCommand(commandLine);
+ GenerateArguments(commandLine);
+
+ return commandLine.ToString();
+ }
+
+ /// <summary>
+ /// Indicates whether all task paratmeters are valid.
+ /// </summary>
+ /// <returns>
+ /// true if all task parameters are valid; otherwise, false.
+ /// </returns>
+ protected override bool ValidateParameters()
+ {
+ if (string.IsNullOrEmpty(Command))
+ {
+ Log.LogError(Propert​ies.Resources.Parame​terRequired, "TfsClient", "Command");
+ return false;
+ }
+ return base.ValidateParameters();
+ }
+ }
+}

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r513 - trunk: . Libraries Source Source/MSBuild.Community.Tasks Source/MSBuild.Community.Tasks/Tfs pwelter34 Paul Welter 2011-06-27 09:13:41 PDT
Messages per page: