diff options
Diffstat (limited to 'src')
6 files changed, 125 insertions, 32 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(); + } + } +} diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj index 1a05349..a8d7acd 100644 --- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj +++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> + <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..\</ProjectRoot> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + </PropertyGroup> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" /> + <PropertyGroup> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{4376ECC9-C346-4A99-B13C-FA93C0FBD2C9}</ProjectGuid> @@ -37,7 +41,6 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -71,7 +74,6 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> - <OutputPath>..\..\bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -102,12 +104,8 @@ <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> - <PropertyGroup> - <SignAssembly>true</SignAssembly> - </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' "> <DebugSymbols>true</DebugSymbols> - <OutputPath>..\..\bin\CodeAnalysis\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> @@ -375,6 +373,6 @@ <Install>true</Install> </BootstrapperPackage> </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" /> -</Project>
\ No newline at end of file + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" /> +</Project> diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index f093c4d..4f18cc5 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> + <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..\</ProjectRoot> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + </PropertyGroup> + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.props" /> + <PropertyGroup> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{3191B653-F76D-4C1A-9A5A-347BC3AAAAB7}</ProjectGuid> @@ -38,17 +42,16 @@ http://opensource.org/licenses/ms-pl.html <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> <ApplicationIcon>DotNetOpenAuth.ico</ApplicationIcon> + <DocumentationFile>$(OutputPath)DotNetOpenAuth.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <DocumentationFile>..\..\bin\Debug\DotNetOpenAuth.xml</DocumentationFile> <RunCodeAnalysis>false</RunCodeAnalysis> <CodeAnalysisRules> </CodeAnalysisRules> @@ -85,12 +88,10 @@ http://opensource.org/licenses/ms-pl.html <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> - <OutputPath>..\..\bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <DocumentationFile>..\..\bin\Release\DotNetOpenAuth.xml</DocumentationFile> <RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRules> </CodeAnalysisRules> @@ -125,14 +126,11 @@ http://opensource.org/licenses/ms-pl.html <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup> - <SignAssembly>true</SignAssembly> <DefineConstants Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">$(DefineConstants);CLR4</DefineConstants> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' "> <DebugSymbols>true</DebugSymbols> - <OutputPath>..\..\bin\CodeAnalysis\</OutputPath> <DefineConstants>$(DefineConstants);CONTRACTS_FULL;DEBUG;TRACE</DefineConstants> - <DocumentationFile>..\..\bin\CodeAnalysis\DotNetOpenAuth.xml</DocumentationFile> <DebugType>full</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> <CodeAnalysisRules> @@ -729,12 +727,5 @@ http://opensource.org/licenses/ms-pl.html <Content Include="DotNetOpenAuth.ico" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <Import Project="..\..\tools\DotNetOpenAuth.Versioning.targets" /> - <Import Project="..\..\tools\JavascriptPacker.targets" /> - <PropertyGroup> - <CompileDependsOn>$(CompileDependsOn);CheckForCodeContracts</CompileDependsOn> - </PropertyGroup> - <Target Name="CheckForCodeContracts"> - <Error Condition=" '$(CodeContractsImported)' != 'true' " Text="This project requires Code Contracts. Please install from: http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx" /> - </Target> -</Project>
\ No newline at end of file + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.targets" /> +</Project> |