diff options
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks')
29 files changed, 224 insertions, 91 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs b/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs index 8bf3e16..970adb0 100644 --- a/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs +++ b/src/DotNetOpenAuth.BuildTasks/AddFilesTo7Zip.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="AddFilesTo7Zip.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="AddFilesTo7Zip.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/AddProjectItems.cs b/src/DotNetOpenAuth.BuildTasks/AddProjectItems.cs index 0b84398..625f6fc 100644 --- a/src/DotNetOpenAuth.BuildTasks/AddProjectItems.cs +++ b/src/DotNetOpenAuth.BuildTasks/AddProjectItems.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="AddProjectItems.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="AddProjectItems.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs b/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs index fb42ade..a25701d 100644 --- a/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs +++ b/src/DotNetOpenAuth.BuildTasks/ChangeProjectReferenceToAssemblyReference.cs @@ -26,7 +26,7 @@ public ITaskItem[] ProjectReferences { get; set; } /// <summary> - /// The assembly references to add. + /// The assembly references to replace removed project references with. /// </summary> [Required] public ITaskItem[] References { get; set; } @@ -34,6 +34,9 @@ public override bool Execute() { if (this.ProjectReferences.Length != this.References.Length) { this.Log.LogError("ProjectReferences and References arrays do not have matching lengths."); + this.Log.LogError("ProjectReferences contents ({0} elements): {1}", this.ProjectReferences.Length, String.Join<ITaskItem>(";", this.ProjectReferences)); + this.Log.LogError("References contents ({0} elements): {1}", this.References.Length, String.Join<ITaskItem>(";", this.References)); + return false; } foreach (var project in Projects) { @@ -50,8 +53,12 @@ doc.RemoveItem(matchingReference.Remove); if (matchingReference.Add.ItemSpec != "REMOVE") { this.Log.LogMessage("Adding assembly reference to \"{0}\" to \"{1}\".", matchingReference.Add.ItemSpec, project.ItemSpec); - var newReference = doc.AddNewItem("Reference", Path.GetFileNameWithoutExtension(matchingReference.Add.ItemSpec), true); - newReference.SetMetadata("HintPath", matchingReference.Add.ItemSpec); + + string newItemSpec = Path.GetFileNameWithoutExtension(matchingReference.Add.ItemSpec); + if (!doc.GetEvaluatedItemsByName("Reference").OfType<BuildItem>().Any(bi => String.Equals(bi.Include, newItemSpec, StringComparison.OrdinalIgnoreCase))) { + var newReference = doc.AddNewItem("Reference", newItemSpec, true); + newReference.SetMetadata("HintPath", matchingReference.Add.ItemSpec); + } } } diff --git a/src/DotNetOpenAuth.BuildTasks/CheckAdminRights.cs b/src/DotNetOpenAuth.BuildTasks/CheckAdminRights.cs index 9cfd35d..c63ac11 100644 --- a/src/DotNetOpenAuth.BuildTasks/CheckAdminRights.cs +++ b/src/DotNetOpenAuth.BuildTasks/CheckAdminRights.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="CheckAdminRights.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="CheckAdminRights.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs index 5b097ab..8a2f5d7 100644 --- a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs +++ b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="CopyWithTokenSubstitution.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="CopyWithTokenSubstitution.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/CreateWebApplication.cs b/src/DotNetOpenAuth.BuildTasks/CreateWebApplication.cs index 4980898..229f726 100644 --- a/src/DotNetOpenAuth.BuildTasks/CreateWebApplication.cs +++ b/src/DotNetOpenAuth.BuildTasks/CreateWebApplication.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="CreateWebApplication.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="CreateWebApplication.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/DeleteWebApplication.cs b/src/DotNetOpenAuth.BuildTasks/DeleteWebApplication.cs index 930a8c4..6847222 100644 --- a/src/DotNetOpenAuth.BuildTasks/DeleteWebApplication.cs +++ b/src/DotNetOpenAuth.BuildTasks/DeleteWebApplication.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="DeleteWebApplication.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="DeleteWebApplication.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/DiscoverProjectTemplates.cs b/src/DotNetOpenAuth.BuildTasks/DiscoverProjectTemplates.cs index f49c9b1..8e2930e 100644 --- a/src/DotNetOpenAuth.BuildTasks/DiscoverProjectTemplates.cs +++ b/src/DotNetOpenAuth.BuildTasks/DiscoverProjectTemplates.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="DiscoverProjectTemplates.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="DiscoverProjectTemplates.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj index 310ee9d..f7d7256 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj @@ -103,6 +103,7 @@ <Compile Include="ChangeProjectReferenceToAssemblyReference.cs" /> <Compile Include="CompareFiles.cs" /> <Compile Include="ChangeAssemblyReference.cs" /> + <Compile Include="RegexFileReplace.cs" /> <Compile Include="CopyWithTokenSubstitution.cs" /> <Compile Include="CreateWebApplication.cs" /> <Compile Include="DeleteWebApplication.cs" /> diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln index 5c2ffbb..f749f1b 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln @@ -1,6 +1,6 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ABBE14A3-0404-4123-9093-E598C3DD3E9B}" ProjectSection(SolutionItems) = preProject ..\..\build.proj = ..\..\build.proj @@ -10,13 +10,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\lib\DotNetOpenAuth.BuildTasks.targets = ..\..\lib\DotNetOpenAuth.BuildTasks.targets ..\..\tools\DotNetOpenAuth.Common.Settings.targets = ..\..\tools\DotNetOpenAuth.Common.Settings.targets ..\..\nuget\DotNetOpenAuth.nuspec = ..\..\nuget\DotNetOpenAuth.nuspec + ..\DotNetOpenAuth\DotNetOpenAuth.proj = ..\DotNetOpenAuth\DotNetOpenAuth.proj ..\..\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 @@ -29,14 +29,35 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.BuildTasks", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{D49E2011-0E1C-4AB5-9887-BD1D42266503}" ProjectSection(SolutionItems) = preProject + ..\..\nuget\DotNetOpenAuth.AspNet.nuspec = ..\..\nuget\DotNetOpenAuth.AspNet.nuspec + ..\..\nuget\DotNetOpenAuth.Core.nuspec = ..\..\nuget\DotNetOpenAuth.Core.nuspec + ..\..\nuget\DotNetOpenAuth.Core.UI.nuspec = ..\..\nuget\DotNetOpenAuth.Core.UI.nuspec + ..\..\nuget\DotNetOpenAuth.InfoCard.nuspec = ..\..\nuget\DotNetOpenAuth.InfoCard.nuspec + ..\..\nuget\DotNetOpenAuth.InfoCard.UI.nuspec = ..\..\nuget\DotNetOpenAuth.InfoCard.UI.nuspec ..\..\nuget\DotNetOpenAuth.nuspec = ..\..\nuget\DotNetOpenAuth.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth.Common.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth.Common.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth.Consumer.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth.Consumer.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth.Core.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth.Core.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth.ServiceProvider.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth.ServiceProvider.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.AuthorizationServer.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.AuthorizationServer.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.Client.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.Client.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.Client.UI.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.Client.UI.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.ClientAuthorization.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.ClientAuthorization.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.Core.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.Core.nuspec + ..\..\nuget\DotNetOpenAuth.OAuth2.ResourceServer.nuspec = ..\..\nuget\DotNetOpenAuth.OAuth2.ResourceServer.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.Core.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.Core.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.Core.UI.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.Core.UI.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.Provider.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.Provider.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.Provider.UI.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.Provider.UI.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.RelyingParty.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.RelyingParty.nuspec + ..\..\nuget\DotNetOpenAuth.OpenId.RelyingParty.UI.nuspec = ..\..\nuget\DotNetOpenAuth.OpenId.RelyingParty.UI.nuspec + ..\..\nuget\DotNetOpenAuth.OpenIdInfoCard.UI.nuspec = ..\..\nuget\DotNetOpenAuth.OpenIdInfoCard.UI.nuspec + ..\..\nuget\DotNetOpenAuth.OpenIdOAuth.nuspec = ..\..\nuget\DotNetOpenAuth.OpenIdOAuth.nuspec + ..\..\nuget\DotNetOpenAuth.Ultimate.nuspec = ..\..\nuget\DotNetOpenAuth.Ultimate.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 diff --git a/src/DotNetOpenAuth.BuildTasks/DowngradeProjects.cs b/src/DotNetOpenAuth.BuildTasks/DowngradeProjects.cs index 2f09583..0b2109a 100644 --- a/src/DotNetOpenAuth.BuildTasks/DowngradeProjects.cs +++ b/src/DotNetOpenAuth.BuildTasks/DowngradeProjects.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="DowngradeProjects.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="DowngradeProjects.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -68,7 +68,7 @@ namespace DotNetOpenAuth.BuildTasks { case ProjectClassification.VS2010Project: this.Log.LogMessage(MessageImportance.Low, "Downgrading project \"{0}\".", taskItem.ItemSpec); var project = new Project(); - project.Load(taskItem.ItemSpec); + project.Load(taskItem.ItemSpec, ProjectLoadSettings.IgnoreMissingImports); project.DefaultToolsVersion = "3.5"; if (this.DowngradeMvc2ToMvc1) { diff --git a/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs b/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs index babaab3..394379a 100644 --- a/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs +++ b/src/DotNetOpenAuth.BuildTasks/FixupReferenceHintPaths.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="FixupReferenceHintPaths.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="FixupReferenceHintPaths.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs b/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs index 6c71740..b2b9694 100644 --- a/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs +++ b/src/DotNetOpenAuth.BuildTasks/FixupShippingToolSamples.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="FixupShippingToolSamples.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="FixupShippingToolSamples.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs index 9818885..05976ea 100644 --- a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs +++ b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs @@ -29,12 +29,42 @@ namespace DotNetOpenAuth.BuildTasks { public string SimpleVersion { get; private set; } /// <summary> + /// Gets or sets the major.minor version string. + /// </summary> + /// <value> + /// The x.y string (no build number or revision number). + /// </value> + [Output] + public string MajorMinorVersion { get; set; } + + /// <summary> + /// Gets or sets the prerelease version, or empty if this is a final release. + /// </summary> + /// <value> + /// The prerelease version. + /// </value> + [Output] + public string PrereleaseVersion { get; set; } + + /// <summary> + /// Gets or sets the version string to use for NuGet packages containing OAuth 2 components. + /// </summary> + [Output] + public string OAuth2PackagesVersion { get; set; } + + /// <summary> /// Gets the Git revision control commit id for HEAD (the current source code version). /// </summary> [Output] public string GitCommitId { get; private set; } /// <summary> + /// Gets the build number (JDate) for this version. + /// </summary> + [Output] + public int BuildNumber { get; private set; } + + /// <summary> /// The file that contains the version base (Major.Minor.Build) to use. /// </summary> [Required] @@ -47,12 +77,18 @@ namespace DotNetOpenAuth.BuildTasks { public override bool Execute() { try { - Version typedVersion = ReadVersionFromFile(); - SimpleVersion = typedVersion.ToString(); + Version typedVersion; + string prerelease, oauth2PackagesVersion; + this.ReadVersionFromFile(out typedVersion, out prerelease, out oauth2PackagesVersion); + this.PrereleaseVersion = prerelease; + this.OAuth2PackagesVersion = oauth2PackagesVersion; + this.SimpleVersion = typedVersion.ToString(); + this.MajorMinorVersion = new Version(typedVersion.Major, typedVersion.Minor).ToString(); + this.BuildNumber = this.CalculateJDate(DateTime.Now); + + var fullVersion = new Version(typedVersion.Major, typedVersion.Minor, typedVersion.Build, this.BuildNumber); + this.Version = fullVersion.ToString(); - var fullVersion = new Version(typedVersion.Major, typedVersion.Minor, typedVersion.Build, CalculateJDate(DateTime.Now)); - Version = fullVersion.ToString(); - this.GitCommitId = GetGitHeadCommitId(); } catch (ArgumentOutOfRangeException ex) { Log.LogErrorFromException(ex); @@ -120,10 +156,21 @@ namespace DotNetOpenAuth.BuildTasks { return commitId.Trim(); } - private Version ReadVersionFromFile() { + private void ReadVersionFromFile(out Version typedVersion, out string prereleaseVersion, out string oauth2PackagesVersion) { string[] lines = File.ReadAllLines(VersionFile); string versionLine = lines[0]; - return new Version(versionLine); + prereleaseVersion = lines.Length >= 2 ? lines[1] : null; + oauth2PackagesVersion = lines.Length >= 3 ? lines[2] : null; + if (!String.IsNullOrEmpty(prereleaseVersion)) { + if (!prereleaseVersion.StartsWith("-")) { + // SemVer requires that prerelease suffixes begin with a hyphen, so add one if it's missing. + prereleaseVersion = "-" + prereleaseVersion; + } + + this.VerifyValidPrereleaseVersion(prereleaseVersion); + } + + typedVersion = new Version(versionLine); } private int CalculateJDate(DateTime date) { @@ -133,5 +180,17 @@ namespace DotNetOpenAuth.BuildTasks { int jdate = yearLastDigit * 1000 + dayOfYear; return jdate; } + + private void VerifyValidPrereleaseVersion(string prerelease) { + if (prerelease[0] != '-') { + throw new ArgumentOutOfRangeException("The prerelease string must begin with a hyphen."); + } + + for (int i = 1; i < prerelease.Length; i++) { + if (!char.IsLetterOrDigit(prerelease[i])) { + throw new ArgumentOutOfRangeException("The prerelease string must be alphanumeric."); + } + } + } } } diff --git a/src/DotNetOpenAuth.BuildTasks/HardLinkCopy.cs b/src/DotNetOpenAuth.BuildTasks/HardLinkCopy.cs index fa7ca06..eb6e7c5 100644 --- a/src/DotNetOpenAuth.BuildTasks/HardLinkCopy.cs +++ b/src/DotNetOpenAuth.BuildTasks/HardLinkCopy.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="HardLinkCopy.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="HardLinkCopy.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/JsPack.cs b/src/DotNetOpenAuth.BuildTasks/JsPack.cs index fa8c7f0..9db7b63 100644 --- a/src/DotNetOpenAuth.BuildTasks/JsPack.cs +++ b/src/DotNetOpenAuth.BuildTasks/JsPack.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="JsPack.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="JsPack.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs index d162cd6..0288957 100644 --- a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs +++ b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="MergeProjectWithVSTemplate.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="MergeProjectWithVSTemplate.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs b/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs index 356c51f..0e41e35 100644 --- a/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs +++ b/src/DotNetOpenAuth.BuildTasks/NuGetPack.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="NuGetPack.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="NuGetPack.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -35,6 +35,16 @@ namespace DotNetOpenAuth.BuildTasks { public ITaskItem OutputPackageDirectory { get; set; } /// <summary> + /// Gets or sets the semicolon delimited list of properties to supply to the NuGet Pack command to perform token substitution. + /// </summary> + public string Properties { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to generate a symbols nuget package. + /// </summary> + public bool Symbols { get; set; } + + /// <summary> /// Returns the fully qualified path to the executable file. /// </summary> /// <returns> @@ -63,15 +73,7 @@ namespace DotNetOpenAuth.BuildTasks { 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; } @@ -86,23 +88,14 @@ namespace DotNetOpenAuth.BuildTasks { args.AppendSwitch("pack"); args.AppendFileNameIfNotNull(this.NuSpec); - args.AppendSwitchIfNotNull("-b ", this.BaseDirectory); - args.AppendSwitchIfNotNull("-o ", this.OutputPackageDirectory); + args.AppendSwitchIfNotNull("-BasePath ", this.BaseDirectory); + args.AppendSwitchIfNotNull("-OutputDirectory ", this.OutputPackageDirectory); + args.AppendSwitchIfNotNull("-Properties ", this.Properties); + if (this.Symbols) { + args.AppendSwitch("-Symbols"); + } 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/src/DotNetOpenAuth.BuildTasks/PathSegment.cs b/src/DotNetOpenAuth.BuildTasks/PathSegment.cs index 1f17b5e..f7a72b6 100644 --- a/src/DotNetOpenAuth.BuildTasks/PathSegment.cs +++ b/src/DotNetOpenAuth.BuildTasks/PathSegment.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="PathSegment.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="PathSegment.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -292,12 +292,9 @@ namespace DotNetOpenAuth.BuildTasks { if (match == null) { match = new PathSegment(segments[segmentIndex], this); this.Children.Add(match); - if (segments.Length == segmentIndex + 1) { - return match; - } } - return match.Add(segments, segmentIndex + 1); + return segments.Length == segmentIndex + 1 ? match : match.Add(segments, segmentIndex + 1); } private PathSegment FindByOriginalPath(string[] segments, int segmentIndex) { diff --git a/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs b/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs index fe13824..68e75ef 100644 --- a/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs +++ b/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="PrepareOhlohRelease.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="PrepareOhlohRelease.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.BuildTasks/Properties/AssemblyInfo.cs index 6fdcc21..e8c6484 100644 --- a/src/DotNetOpenAuth.BuildTasks/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.BuildTasks/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomMsBuildTasks")] -[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyCopyright("Copyright © 2011 Outercurve Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/DotNetOpenAuth.BuildTasks/Publicize.cs b/src/DotNetOpenAuth.BuildTasks/Publicize.cs index f1781a7..af50d06 100644 --- a/src/DotNetOpenAuth.BuildTasks/Publicize.cs +++ b/src/DotNetOpenAuth.BuildTasks/Publicize.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="Publicize.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="Publicize.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/Purge.cs b/src/DotNetOpenAuth.BuildTasks/Purge.cs index cf1a214..e6522c0 100644 --- a/src/DotNetOpenAuth.BuildTasks/Purge.cs +++ b/src/DotNetOpenAuth.BuildTasks/Purge.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="Purge.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="Purge.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs b/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs index 2bcc160..0d9dba8 100644 --- a/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs +++ b/src/DotNetOpenAuth.BuildTasks/ReSignDelaySignedAssemblies.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="ReSignDelaySignedAssemblies.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="ReSignDelaySignedAssemblies.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/RegexFileReplace.cs b/src/DotNetOpenAuth.BuildTasks/RegexFileReplace.cs new file mode 100644 index 0000000..8f97644 --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/RegexFileReplace.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------- +// <copyright file="RegexFileReplace.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.BuildTasks { + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Reflection; + using System.Text; + using Microsoft.Build.BuildEngine; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; + using System.Text.RegularExpressions; + + public class RegexFileReplace : Task { + /// <summary> + /// Gets or sets the set of files to search. + /// </summary> + [Required] + public ITaskItem[] Files { get; set; } + + /// <summary> + /// Gets or sets the files to save the changed files to. This may be the same as the input files to make the change in place. + /// </summary> + public ITaskItem[] OutputFiles { get; set; } + + public string Pattern { get; set; } + + public string Replacement { get; set; } + + /// <summary> + /// Executes this instance. + /// </summary> + public override bool Execute() { + if (this.OutputFiles == null || this.OutputFiles.Length == 0) { + this.OutputFiles = this.Files; + } + + foreach (var file in this.Files) { + string[] lines = File.ReadAllLines(file.ItemSpec); + for (int i = 0; i < lines.Length; i++) { + lines[i] = Regex.Replace(lines[i], this.Pattern, this.Replacement); + } + + File.WriteAllLines(file.ItemSpec, lines); + } + + return !this.Log.HasLoggedErrors; + } + } +} diff --git a/src/DotNetOpenAuth.BuildTasks/SignatureVerification.cs b/src/DotNetOpenAuth.BuildTasks/SignatureVerification.cs index 2e69926..86c36b1 100644 --- a/src/DotNetOpenAuth.BuildTasks/SignatureVerification.cs +++ b/src/DotNetOpenAuth.BuildTasks/SignatureVerification.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="SignatureVerification.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="SignatureVerification.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs b/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs index 29896fe..76fa562 100644 --- a/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs +++ b/src/DotNetOpenAuth.BuildTasks/SnToolTask.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="SnToolTask.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="SnToolTask.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/Trim.cs b/src/DotNetOpenAuth.BuildTasks/Trim.cs index 972b87d..1f48a79 100644 --- a/src/DotNetOpenAuth.BuildTasks/Trim.cs +++ b/src/DotNetOpenAuth.BuildTasks/Trim.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="Trim.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="Trim.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- diff --git a/src/DotNetOpenAuth.BuildTasks/Utilities.cs b/src/DotNetOpenAuth.BuildTasks/Utilities.cs index 80e1733..4140727 100644 --- a/src/DotNetOpenAuth.BuildTasks/Utilities.cs +++ b/src/DotNetOpenAuth.BuildTasks/Utilities.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- -// <copyright file="Utilities.cs" company="Andrew Arnott"> -// Copyright (c) Andrew Arnott. All rights reserved. +// <copyright file="Utilities.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. // </copyright> //----------------------------------------------------------------------- |