diff options
-rw-r--r-- | build.proj | 1 | ||||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.dll | bin | 103424 -> 104960 bytes | |||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.pdb | bin | 251392 -> 257536 bytes | |||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.targets | 1 | ||||
-rw-r--r-- | nuget/DotNetOpenAuth.nuspec | 16 | ||||
-rw-r--r-- | nuget/content/web.config.transform | 49 | ||||
-rw-r--r-- | nuget/nuget.proj | 65 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj | 1 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln | 17 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/NuGetPack.cs | 108 | ||||
-rw-r--r-- | tools/DotNetOpenAuth.props | 1 | ||||
-rw-r--r-- | tools/NuGet/NuGet.exe | bin | 0 -> 267264 bytes |
12 files changed, 259 insertions, 0 deletions
@@ -7,6 +7,7 @@ <NightlyProjects Include=" samples\tools.proj; tools\drop.proj; + nuget\nuget.proj; " /> <NightlyProjects Include=" samples\samples.proj; diff --git a/lib/DotNetOpenAuth.BuildTasks.dll b/lib/DotNetOpenAuth.BuildTasks.dll Binary files differindex d02c3f9..bb667f9 100644 --- a/lib/DotNetOpenAuth.BuildTasks.dll +++ b/lib/DotNetOpenAuth.BuildTasks.dll diff --git a/lib/DotNetOpenAuth.BuildTasks.pdb b/lib/DotNetOpenAuth.BuildTasks.pdb Binary files differindex 42265ab..bcb8d51 100644 --- a/lib/DotNetOpenAuth.BuildTasks.pdb +++ b/lib/DotNetOpenAuth.BuildTasks.pdb diff --git a/lib/DotNetOpenAuth.BuildTasks.targets b/lib/DotNetOpenAuth.BuildTasks.targets index 6b48632..27ca0ed 100644 --- a/lib/DotNetOpenAuth.BuildTasks.targets +++ b/lib/DotNetOpenAuth.BuildTasks.targets @@ -29,4 +29,5 @@ <UsingTask AssemblyFile="DotNetOpenAuth.BuildTasks.dll" TaskName="HardLinkCopy" /> <UsingTask AssemblyFile="DotNetOpenAuth.BuildTasks.dll" TaskName="PrepareOhlohRelease" /> <UsingTask AssemblyFile="DotNetOpenAuth.BuildTasks.dll" TaskName="AddFilesTo7Zip" /> + <UsingTask AssemblyFile="DotNetOpenAuth.BuildTasks.dll" TaskName="NuGetPack" /> </Project> diff --git a/nuget/DotNetOpenAuth.nuspec b/nuget/DotNetOpenAuth.nuspec new file mode 100644 index 0000000..fcf0465 --- /dev/null +++ b/nuget/DotNetOpenAuth.nuspec @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<package> + <metadata> + <id>DotNetOpenAuth</id> + <version>$version$</version> + <authors>Andrew Arnott</authors> + <owners>Andrew Arnott</owners> + <projectUrl>http://www.dotnetopenauth.net/</projectUrl> + <iconUrl>https://github.com/AArnott/dotnetopenid/raw/v3.4/doc/logo/dnoa-logo_32x32.png</iconUrl> + <licenseUrl>http://www.opensource.org/licenses/ms-pl.html</licenseUrl> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <summary>OpenID, OAuth, & InfoCard library for web sites/services and apps.</summary> + <description>A C# library that adds OpenID 2.0 Provider and Relying Party, OAuth Consumer and Service Provider, and InfoCard Selector support to your web site both programmatically and through convenient drop-in ASP.NET controls.</description> + <language>en-US</language> + </metadata> +</package>
\ No newline at end of file diff --git a/nuget/content/web.config.transform b/nuget/content/web.config.transform new file mode 100644 index 0000000..54fc9e7 --- /dev/null +++ b/nuget/content/web.config.transform @@ -0,0 +1,49 @@ +<configuration> + <configSections> + <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/> + </configSections> + + <uri> + <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), + which is necessary for OpenID urls with unicode characters in the domain/host name. + It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. --> + <idn enabled="All"/> + <iriParsing enabled="true"/> + </uri> + + <system.net> + <defaultProxy enabled="true" /> + <settings> + <!-- This setting causes .NET to check certificate revocation lists (CRL) + before trusting HTTPS certificates. But this setting tends to not + be allowed in shared hosting environments. --> + <!--<servicePointManager checkCertificateRevocationList="true"/>--> + </settings> + </system.net> + + <dotNetOpenAuth> + <!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. --> + <!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ --> + <openid> + <relyingParty> + <security requireSsl="false" /> + <behaviors> + <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible + with OPs that use Attribute Exchange (in various formats). --> + <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" /> + </behaviors> + </relyingParty> + </openid> + <messaging> + <untrustedWebRequest> + <whitelistHosts> + <!-- Uncomment to enable communication with localhost (should generally not activate in production!) --> + <!--<add name="localhost" />--> + </whitelistHosts> + </untrustedWebRequest> + </messaging> + <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --> + <reporting enabled="true" /> + </dotNetOpenAuth> +</configuration>
\ No newline at end of file diff --git a/nuget/nuget.proj b/nuget/nuget.proj new file mode 100644 index 0000000..f8b8e93 --- /dev/null +++ b/nuget/nuget.proj @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " /> + <Import Project="$(MSBuildProjectDirectory)\..\tools\DotNetOpenAuth.automated.props"/> + + <Target Name="Layout" DependsOnTargets="BuildUnifiedProduct;ReSignDelaySignedAssemblies"> + <PropertyGroup> + <NuGetLayoutPath>$(DropsRoot)NuGet\$(BuildVersion)\</NuGetLayoutPath> + </PropertyGroup> + + <MSBuild Projects="$(ProjectRoot)src\DotNetOpenAuth\DotNetOpenAuth.csproj" Targets="DocumentationProjectOutputGroup" BuildInParallel="$(BuildInParallel)"> + <Output TaskParameter="TargetOutputs" ItemName="NuGetSource"/> + </MSBuild> + + <!-- IMPORTANT: These must appear as separate ItemGroups or else batching screws it up. --> + <ItemGroup> + <NuGetSource Include="%(ResignedAssembliesOutputs.Identity)" Condition=" '%(FileName)%(Extension)' == 'DotNetOpenAuth.dll' "/> + <NuGetSource> + <TargetPath>$(NuGetLayoutPath)lib\%(FileName)%(Extension)</TargetPath> + </NuGetSource> + </ItemGroup> + <ItemGroup> + <NuGetContentSource Include="$(ProjectRoot)NuGet\content\**"/> + </ItemGroup> + <ItemGroup> + <NuGetSource Include="@(NuGetContentSource)"> + <TargetPath>$(NuGetLayoutPath)content\%(RecursiveDir)%(FileName)%(Extension)</TargetPath> + </NuGetSource> + + <NuSpecSource Include="DotNetOpenAuth.nuspec"> + <LayoutPath>$(NuGetLayoutPath)</LayoutPath> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + </NuSpecSource> + + <NuSpecTarget Include="@(NuSpecSource->'$(NuGetLayoutPath)%(FileName)%(Extension)')" /> + </ItemGroup> + <ItemGroup> + <NuGetContentsTarget Include="%(NuGetSource.TargetPath)" /> + </ItemGroup> + + <CopyWithTokenSubstitution + SourceFiles="@(NuSpecSource)" + DestinationFiles="@(NuSpecTarget)" + /> + + <Copy + SourceFiles="@(NuGetSource)" + DestinationFiles="@(NuGetContentsTarget)" + SkipUnchangedFiles="true" /> + + <Purge Directories="$(NuGetLayoutPath)" IntendedFiles="@(NuGetContentsTarget);@(NuSpecTarget)" /> + </Target> + + <Target Name="Build" DependsOnTargets="Layout"> + <NuGetPack + NuSpec="%(NuSpecTarget.Identity)" + BaseDirectory="%(NuSpecTarget.LayoutPath)" + OutputPackageDirectory="$(DropsRoot)" + ToolPath="$(NuGetToolPath)" /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " /> +</Project>
\ No newline at end of file diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj index 3b37787..310ee9d 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj @@ -118,6 +118,7 @@ <Compile Include="CheckAdminRights.cs" /> <Compile Include="JsPack.cs" /> <Compile Include="NativeMethods.cs" /> + <Compile Include="NuGetPack.cs" /> <Compile Include="ParseMaster.cs" /> <Compile Include="PathSegment.cs" /> <Compile Include="PrepareOhlohRelease.cs" /> diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln index a144f1c..5c2ffbb 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln @@ -9,12 +9,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\tools\DotNetOpenAuth.automated.targets = ..\..\tools\DotNetOpenAuth.automated.targets ..\..\lib\DotNetOpenAuth.BuildTasks.targets = ..\..\lib\DotNetOpenAuth.BuildTasks.targets ..\..\tools\DotNetOpenAuth.Common.Settings.targets = ..\..\tools\DotNetOpenAuth.Common.Settings.targets + ..\..\nuget\DotNetOpenAuth.nuspec = ..\..\nuget\DotNetOpenAuth.nuspec ..\..\tools\DotNetOpenAuth.props = ..\..\tools\DotNetOpenAuth.props ..\..\tools\DotNetOpenAuth.targets = ..\..\tools\DotNetOpenAuth.targets ..\..\tools\DotNetOpenAuth.Versioning.targets = ..\..\tools\DotNetOpenAuth.Versioning.targets ..\..\tools\drop.proj = ..\..\tools\drop.proj ..\..\EnlistmentInfo.props = ..\..\EnlistmentInfo.props ..\..\EnlistmentInfo.targets = ..\..\EnlistmentInfo.targets + ..\..\nuget\nuget.proj = ..\..\nuget\nuget.proj ..\..\tools\ohloh.proj = ..\..\tools\ohloh.proj ..\..\projecttemplates\projecttemplates.proj = ..\..\projecttemplates\projecttemplates.proj ..\..\samples\Samples.proj = ..\..\samples\Samples.proj @@ -25,6 +27,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.BuildTasks", "DotNetOpenAuth.BuildTasks.csproj", "{AC231A51-EF60-437C-A33F-AF8ADEB8EB74}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{D49E2011-0E1C-4AB5-9887-BD1D42266503}" + ProjectSection(SolutionItems) = preProject + ..\..\nuget\DotNetOpenAuth.nuspec = ..\..\nuget\DotNetOpenAuth.nuspec + ..\..\nuget\nuget.proj = ..\..\nuget\nuget.proj + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{BF3868D6-3BBA-4E40-B180-213370C15494}" + ProjectSection(SolutionItems) = preProject + ..\..\nuget\content\web.config.transform = ..\..\nuget\content\web.config.transform + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,4 +52,8 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D49E2011-0E1C-4AB5-9887-BD1D42266503} = {ABBE14A3-0404-4123-9093-E598C3DD3E9B} + {BF3868D6-3BBA-4E40-B180-213370C15494} = {D49E2011-0E1C-4AB5-9887-BD1D42266503} + EndGlobalSection EndGlobal diff --git a/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs b/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs new file mode 100644 index 0000000..356c51f --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs @@ -0,0 +1,108 @@ +//----------------------------------------------------------------------- +// <copyright file="NuGetPack.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 System.Xml.Linq; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; + + /// <summary> + /// Creates a .nupkg archive from a .nuspec file and content files. + /// </summary> + public class NuGetPack : ToolTask { + /// <summary> + /// Gets or sets the path to the .nuspec file. + /// </summary> + [Required] + public ITaskItem NuSpec { get; set; } + + /// <summary> + /// Gets or sets the base directory, the contents of which gets included in the .nupkg archive. + /// </summary> + public ITaskItem BaseDirectory { get; set; } + + /// <summary> + /// Gets or sets the path to the directory that will contain the generated .nupkg archive. + /// </summary> + public ITaskItem OutputPackageDirectory { get; set; } + + /// <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() { + return this.ToolPath; + } + + /// <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 "NuGet.exe"; } + } + + /// <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 (this.OutputPackageDirectory != null && Path.GetDirectoryName(this.OutputPackageDirectory.ItemSpec).Length > 0) { + Directory.CreateDirectory(Path.GetDirectoryName(this.OutputPackageDirectory.ItemSpec)); + } + + string fullPackagePath = this.DeriveFullPackagePath(); + this.Log.LogMessage("Creating NuGet package '{0}'.", fullPackagePath); + + bool result = base.Execute(); + + if (result) { + this.Log.LogMessage(MessageImportance.High, "Successfully created package '{0}'.", fullPackagePath); + } + + return result; + } + + /// <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 args = new CommandLineBuilder(); + + args.AppendSwitch("pack"); + args.AppendFileNameIfNotNull(this.NuSpec); + args.AppendSwitchIfNotNull("-b ", this.BaseDirectory); + args.AppendSwitchIfNotNull("-o ", this.OutputPackageDirectory); + + return args.ToString(); + } + + /// <summary> + /// Derives the path to the generated .nupkg file. + /// </summary> + /// <returns>A relative path.</returns> + private string DeriveFullPackagePath() { + var spec = XDocument.Load(this.NuSpec.ItemSpec); + var metadata = spec.Element("package").Element("metadata"); + string id = metadata.Element("id").Value; + string version = metadata.Element("version").Value; + string baseDirectory = this.OutputPackageDirectory != null ? this.OutputPackageDirectory.ItemSpec : String.Empty; + return Path.Combine(baseDirectory, String.Format("{0}.{1}.nupkg", id, version)); + } + } +} diff --git a/tools/DotNetOpenAuth.props b/tools/DotNetOpenAuth.props index 698f06d..3e826bc 100644 --- a/tools/DotNetOpenAuth.props +++ b/tools/DotNetOpenAuth.props @@ -12,6 +12,7 @@ <ToolsDir>$(ProjectRoot)tools\</ToolsDir> <ZipLevel>6</ZipLevel> <Zip7ToolPath>$(ToolsDir)7-Zip.x86\</Zip7ToolPath> + <NuGetToolPath>$(ToolsDir)NuGet\</NuGetToolPath> <ZipFormat Condition=" '$(ZipFormat)' == '' ">.7z</ZipFormat> <ClrVersion Condition=" '$(TargetFrameworkVersion)' == 'v4.0' ">4</ClrVersion> <ClrVersion Condition=" '$(TargetFrameworkVersion)' != 'v4.0' ">2</ClrVersion> diff --git a/tools/NuGet/NuGet.exe b/tools/NuGet/NuGet.exe Binary files differnew file mode 100644 index 0000000..907d24d --- /dev/null +++ b/tools/NuGet/NuGet.exe |