summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks')
-rw-r--r--src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj1
-rw-r--r--src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln2
-rw-r--r--src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs18
-rw-r--r--src/DotNetOpenAuth.BuildTasks/Publicize.cs97
4 files changed, 111 insertions, 7 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
index 0db99e9..02244a8 100644
--- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
+++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj
@@ -96,6 +96,7 @@
<Compile Include="CheckAdminRights.cs" />
<Compile Include="JsPack.cs" />
<Compile Include="ParseMaster.cs" />
+ <Compile Include="Publicize.cs" />
<Compile Include="Purge.cs" />
<Compile Include="ReSignDelaySignedAssemblies.cs" />
<Compile Include="SetEnvironmentVariable.cs" />
diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
index fca41e8..0d0900b 100644
--- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
+++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
@@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\..\build.proj = ..\..\build.proj
..\..\lib\DotNetOpenAuth.BuildTasks.targets = ..\..\lib\DotNetOpenAuth.BuildTasks.targets
..\..\tools\DotNetOpenAuth.Common.Settings.targets = ..\..\tools\DotNetOpenAuth.Common.Settings.targets
+ ..\..\tools\DotNetOpenAuth.props = ..\..\tools\DotNetOpenAuth.props
+ ..\..\tools\DotNetOpenAuth.targets = ..\..\tools\DotNetOpenAuth.targets
..\..\tools\DotNetOpenAuth.Versioning.targets = ..\..\tools\DotNetOpenAuth.Versioning.targets
EndProjectSection
EndProject
diff --git a/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs b/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs
index 92b0235..a6088c9 100644
--- a/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs
+++ b/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs
@@ -7,12 +7,12 @@
namespace DotNetOpenAuth.BuildTasks {
using System;
using System.Collections.Generic;
+ using System.IO;
using System.Linq;
using System.Text;
- using Microsoft.Build.Utilities;
- using Microsoft.Build.Framework;
- using System.IO;
using Microsoft.Build.BuildEngine;
+ using Microsoft.Build.Framework;
+ using Microsoft.Build.Utilities;
/// <summary>
/// Removes imports that only apply when a shipping tool sample builds as part of
@@ -22,6 +22,8 @@ namespace DotNetOpenAuth.BuildTasks {
[Required]
public ITaskItem[] Projects { get; set; }
+ public string[] RemoveImportsStartingWith { get; set; }
+
/// <summary>
/// Executes this instance.
/// </summary>
@@ -34,10 +36,12 @@ namespace DotNetOpenAuth.BuildTasks {
Uri projectUri = new Uri(projectTaskItem.GetMetadata("FullPath"));
project.Load(projectTaskItem.ItemSpec, ProjectLoadSettings.IgnoreMissingImports);
- project.Imports.Cast<Import>()
- .Where(import => import.ProjectPath.StartsWith(@"..\..\tools\", StringComparison.OrdinalIgnoreCase))
- .ToList()
- .ForEach(import => project.Imports.RemoveImport(import));
+ if (this.RemoveImportsStartingWith != null && this.RemoveImportsStartingWith.Length > 0) {
+ project.Imports.Cast<Import>()
+ .Where(import => this.RemoveImportsStartingWith.Any(start => import.ProjectPath.StartsWith(start, StringComparison.OrdinalIgnoreCase)))
+ .ToList()
+ .ForEach(import => project.Imports.RemoveImport(import));
+ }
project.Save(projectTaskItem.ItemSpec);
}
diff --git a/src/DotNetOpenAuth.BuildTasks/Publicize.cs b/src/DotNetOpenAuth.BuildTasks/Publicize.cs
new file mode 100644
index 0000000..f1781a7
--- /dev/null
+++ b/src/DotNetOpenAuth.BuildTasks/Publicize.cs
@@ -0,0 +1,97 @@
+//-----------------------------------------------------------------------
+// <copyright file="Publicize.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.BuildTasks {
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Text;
+ using Microsoft.Build.BuildEngine;
+ using Microsoft.Build.Utilities;
+ using Microsoft.Build.Framework;
+
+ public class Publicize : ToolTask {
+ [Required]
+ public string MSBuildExtensionsPath { get; set; }
+
+ [Required]
+ public ITaskItem Assembly { get; set; }
+
+ public bool DelaySign { get; set; }
+
+ public string KeyFile { get; set; }
+
+ public bool SkipUnchangedFiles { get; set; }
+
+ [Output]
+ public ITaskItem AccessorAssembly { get; set; }
+
+ /// <summary>
+ /// Generates the full path to tool.
+ /// </summary>
+ /// <returns>An absolute path.</returns>
+ protected override string GenerateFullPathToTool() {
+ string toolPath = Path.Combine(this.MSBuildExtensionsPath, @"Microsoft\VisualStudio\v9.0\TeamTest\Publicize.exe");
+ return toolPath;
+ }
+
+ /// <summary>
+ /// Gets the name of the tool.
+ /// </summary>
+ /// <value>The name of the tool.</value>
+ protected override string ToolName {
+ get { return "Publicize.exe"; }
+ }
+
+ /// <summary>
+ /// Validates the parameters.
+ /// </summary>
+ protected override bool ValidateParameters() {
+ if (!base.ValidateParameters()) {
+ return false;
+ }
+
+ if (this.DelaySign && string.IsNullOrEmpty(this.KeyFile)) {
+ this.Log.LogError("DelaySign=true, but no KeyFile given.");
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Generates the command line commands.
+ /// </summary>
+ protected override string GenerateCommandLineCommands() {
+ CommandLineBuilder builder = new CommandLineBuilder();
+
+ if (this.DelaySign) {
+ builder.AppendSwitch("/delaysign");
+ }
+
+ builder.AppendSwitchIfNotNull("/keyfile:", this.KeyFile);
+
+ builder.AppendFileNameIfNotNull(this.Assembly);
+
+ return builder.ToString();
+ }
+
+ public override bool Execute() {
+ this.AccessorAssembly = new TaskItem(this.Assembly);
+ this.AccessorAssembly.ItemSpec = Path.Combine(
+ Path.GetDirectoryName(this.AccessorAssembly.ItemSpec),
+ Path.GetFileNameWithoutExtension(this.AccessorAssembly.ItemSpec) + "_Accessor") + Path.GetExtension(this.AccessorAssembly.ItemSpec);
+
+ if (this.SkipUnchangedFiles && File.GetLastWriteTimeUtc(this.Assembly.ItemSpec) < File.GetLastWriteTimeUtc(this.AccessorAssembly.ItemSpec)) {
+ Log.LogMessage(MessageImportance.Low, "Skipping public accessor generation for {0} because {1} is up to date.", this.Assembly.ItemSpec, this.AccessorAssembly.ItemSpec);
+ return true;
+ }
+
+ return base.Execute();
+ }
+ }
+}