summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-12-21 22:34:45 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2010-12-21 22:34:45 -0800
commitc62c2653be002ab3f51a1be659e898364470ffdf (patch)
tree93fdaebca9693f272822864fb6f5f60ab1b60b13 /src/DotNetOpenAuth.BuildTasks
parent9c622e22cc18728dd648f59807c833161ec1d694 (diff)
downloadDotNetOpenAuth-c62c2653be002ab3f51a1be659e898364470ffdf.zip
DotNetOpenAuth-c62c2653be002ab3f51a1be659e898364470ffdf.tar.gz
DotNetOpenAuth-c62c2653be002ab3f51a1be659e898364470ffdf.tar.bz2
The nightly build now creates deployable archives of docs and samples in the .7z format.
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks')
-rw-r--r--src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs101
-rw-r--r--src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj1
-rw-r--r--src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs2
3 files changed, 103 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs b/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs
new file mode 100644
index 0000000..b21512d
--- /dev/null
+++ b/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs
@@ -0,0 +1,101 @@
+//-----------------------------------------------------------------------
+// <copyright file="AddFilesTo7Zip.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.BuildTasks {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using Microsoft.Build.Utilities;
+ using Microsoft.Build.Framework;
+
+ public class AddFilesTo7Zip : ToolTask {
+ [Required]
+ public ITaskItem ZipFileName { get; set; }
+
+ [Required]
+ public ITaskItem[] Files { get; set; }
+
+ public string WorkingDirectory { get; set; }
+
+ /// <summary>
+ /// Gets the name of the tool.
+ /// </summary>
+ /// <value>
+ /// The name of the tool.
+ /// </value>
+ protected override string ToolName {
+ get { return "7za.exe"; }
+ }
+
+ /// <summary>
+ /// Generates the full path to tool.
+ /// </summary>
+ /// <returns></returns>
+ protected override string GenerateFullPathToTool() {
+ return this.ToolPath;
+ }
+
+ protected override string GenerateCommandLineCommands() {
+ var args = new CommandLineBuilder();
+
+ args.AppendSwitch("a");
+ args.AppendSwitch("--");
+
+ args.AppendFileNameIfNotNull(this.ZipFileName);
+
+ return args.ToString();
+ }
+
+ /// <summary>
+ /// Gets the response file switch.
+ /// </summary>
+ /// <param name="responseFilePath">The response file path.</param>
+ protected override string GetResponseFileSwitch(string responseFilePath) {
+ return "@" + responseFilePath;
+ }
+
+ /// <summary>
+ /// Gets the response file encoding.
+ /// </summary>
+ /// <value>
+ /// The response file encoding.
+ /// </value>
+ protected override Encoding ResponseFileEncoding {
+ get { return Encoding.UTF8; }
+ }
+
+ /// <summary>
+ /// Generates the response file commands.
+ /// </summary>
+ protected override string GenerateResponseFileCommands()
+ {
+ var args = new CommandLineBuilder();
+ args.AppendFileNamesIfNotNull(this.Files.Select(GetWorkingDirectoryRelativePath).ToArray(), Environment.NewLine);
+ return args.ToString();
+ }
+
+ /// <summary>
+ /// Gets the working directory.
+ /// </summary>
+ protected override string GetWorkingDirectory() {
+ if (!String.IsNullOrEmpty(this.WorkingDirectory)) {
+ return this.WorkingDirectory;
+ } else {
+ return base.GetWorkingDirectory();
+ }
+ }
+
+ private string GetWorkingDirectoryRelativePath(ITaskItem taskItem)
+ {
+ if (taskItem.ItemSpec.StartsWith(this.WorkingDirectory, StringComparison.OrdinalIgnoreCase)) {
+ return taskItem.ItemSpec.Substring(this.WorkingDirectory.Length);
+ } else {
+ return taskItem.ItemSpec;
+ }
+ }
+ }
+}
diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
index 179c825..484082c 100644
--- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
+++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
@@ -101,6 +101,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="AddFilesTo7Zip.cs" />
<Compile Include="AddProjectItems.cs" />
<Compile Include="ChangeProjectReferenceToAssemblyReference.cs" />
<Compile Include="CompareFiles.cs" />
diff --git a/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs b/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs
index a0ba386..2bcc160 100644
--- a/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs
+++ b/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs
@@ -32,7 +32,7 @@ namespace DotNetOpenAuth.BuildTasks {
////if (this.Assemblies.Length != 1) {
//// throw new NotSupportedException("Exactly 1 assembly for signing is supported.");
////}
- CommandLineBuilder args = new CommandLineBuilder();
+ var args = new CommandLineBuilder();
args.AppendSwitch("-q");
if (this.KeyFile != null) {