diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-11 10:52:13 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-11 10:52:13 -0700 |
commit | 730e1a51e6e7c85a05d26dec0d041aecb8529f51 (patch) | |
tree | a38bbcbfa63cce9fb69bc97983ca826b14ec8dd0 | |
parent | 45519ce569b708076a26b99d34e150608273ca24 (diff) | |
download | DotNetOpenAuth-730e1a51e6e7c85a05d26dec0d041aecb8529f51.zip DotNetOpenAuth-730e1a51e6e7c85a05d26dec0d041aecb8529f51.tar.gz DotNetOpenAuth-730e1a51e6e7c85a05d26dec0d041aecb8529f51.tar.bz2 |
A new ohloh.proj project builds the Ohloh instruct file and upload script now. Woot.
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.dll | bin | 91648 -> 98816 bytes | |||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.pdb | bin | 196096 -> 241152 bytes | |||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.targets | 1 | ||||
-rw-r--r-- | samples/tools.proj | 8 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj | 1 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln | 1 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs | 17 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs | 138 | ||||
-rw-r--r-- | tools/DotNetOpenAuth.Versioning.targets | 1 | ||||
-rw-r--r-- | tools/drop.proj | 10 | ||||
-rw-r--r-- | tools/ohloh.proj | 33 | ||||
-rw-r--r-- | vsi/vsi.proj | 5 | ||||
-rw-r--r-- | vsix/vsix.proj | 4 |
13 files changed, 213 insertions, 6 deletions
diff --git a/lib/DotNetOpenAuth.BuildTasks.dll b/lib/DotNetOpenAuth.BuildTasks.dll Binary files differindex b3c6244..7dcbcf2 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 676ff46..417bd24 100644 --- a/lib/DotNetOpenAuth.BuildTasks.pdb +++ b/lib/DotNetOpenAuth.BuildTasks.pdb diff --git a/lib/DotNetOpenAuth.BuildTasks.targets b/lib/DotNetOpenAuth.BuildTasks.targets index 56cff0d..2a4c14d 100644 --- a/lib/DotNetOpenAuth.BuildTasks.targets +++ b/lib/DotNetOpenAuth.BuildTasks.targets @@ -30,5 +30,6 @@ <UsingTask AssemblyFile="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.dll" TaskName="Publicize" /> <UsingTask AssemblyFile="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.dll" TaskName="DowngradeProjects" /> <UsingTask AssemblyFile="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.dll" TaskName="HardLinkCopy" /> + <UsingTask AssemblyFile="$(ProjectRoot)\lib\DotNetOpenAuth.BuildTasks.dll" TaskName="PrepareOhlohRelease" /> </Project> diff --git a/samples/tools.proj b/samples/tools.proj index 74f6457..94da8c8 100644 --- a/samples/tools.proj +++ b/samples/tools.proj @@ -37,10 +37,16 @@ <Purge Directories="$(ToolsDirectory)" IntendedFiles="@(AllToolTargets)" /> </Target> - <Target Name="Build" DependsOnTargets="Layout"> + <Target Name="Build" DependsOnTargets="Layout" Returns="@(RedistributableFiles)"> <PropertyGroup> <ToolsZip>$(ToolsDirectoryNoSlash).zip</ToolsZip> </PropertyGroup> + <ItemGroup> + <RedistributableFiles Include="$(ToolsZip)"> + <Package>DotNetOpenAuth-Tools</Package> + <Platform>.NET $(TargetFrameworkVersion)</Platform> + </RedistributableFiles> + </ItemGroup> <Zip ZipFileName="$(ToolsZip)" Files="@(AllToolTargets)" diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj index 615f652..7993ed5 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.csproj @@ -121,6 +121,7 @@ <Compile Include="NativeMethods.cs" /> <Compile Include="ParseMaster.cs" /> <Compile Include="PathSegment.cs" /> + <Compile Include="PrepareOhlohRelease.cs" /> <Compile Include="Publicize.cs" /> <Compile Include="Purge.cs" /> <Compile Include="ReSignDelaySignedAssemblies.cs" /> diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln index f3e3982..dbc8e60 100644 --- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln +++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\tools\DotNetOpenAuth.targets = ..\..\tools\DotNetOpenAuth.targets ..\..\tools\DotNetOpenAuth.Versioning.targets = ..\..\tools\DotNetOpenAuth.Versioning.targets ..\..\tools\drop.proj = ..\..\tools\drop.proj + ..\..\tools\ohloh.proj = ..\..\tools\ohloh.proj ..\..\projecttemplates\projecttemplates.proj = ..\..\projecttemplates\projecttemplates.proj ..\..\samples\Samples.proj = ..\..\samples\Samples.proj ..\..\samples\tools.proj = ..\..\samples\tools.proj diff --git a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs index 1d60ca4..dfb3468 100644 --- a/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs +++ b/src/DotNetOpenAuth.BuildTasks/GetBuildVersion.cs @@ -10,6 +10,11 @@ using Microsoft.Build.Utilities; namespace DotNetOpenAuth.BuildTasks { public class GetBuildVersion : Task { + /// <summary> + /// Initializes a new instance of the <see cref="GetBuildVersion"/> class. + /// </summary> + public GetBuildVersion() { + } /// <summary> /// Gets the version string to use in the compiled assemblies. @@ -18,6 +23,12 @@ namespace DotNetOpenAuth.BuildTasks { public string Version { get; private set; } /// <summary> + /// Gets the version string to use in the official release name (lacks revision number). + /// </summary> + [Output] + public string SimpleVersion { get; private set; } + + /// <summary> /// Gets the Git revision control commit id for HEAD (the current source code version). /// </summary> [Output] @@ -37,9 +48,11 @@ namespace DotNetOpenAuth.BuildTasks { public override bool Execute() { try { Version typedVersion = ReadVersionFromFile(); - typedVersion = new Version(typedVersion.Major, typedVersion.Minor, typedVersion.Build, CalculateJDate(DateTime.Now)); - Version = typedVersion.ToString(); + SimpleVersion = typedVersion.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); diff --git a/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs b/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs new file mode 100644 index 0000000..fe13824 --- /dev/null +++ b/src/DotNetOpenAuth.BuildTasks/PrepareOhlohRelease.cs @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------- +// <copyright file="PrepareOhlohRelease.cs" company="Andrew Arnott"> +// Copyright (c) Andrew Arnott. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.BuildTasks { + using System; + using System.Collections.Generic; + using System.Globalization; + using System.IO; + using System.Linq; + using System.Text; + using System.Text.RegularExpressions; + using System.Xml; + using System.Xml.Linq; + using Microsoft.Build.Framework; + using Microsoft.Build.Utilities; + + /// <summary> + /// Creates an Ohloh.net upload instruct XLM file and bash script that uses it. + /// </summary> + public class PrepareOhlohRelease : Task { + /// <summary> + /// Initializes a new instance of the <see cref="PrepareOhlohUpload"/> class. + /// </summary> + public PrepareOhlohRelease() { + } + + [Required] + public string Release { get; set; } + + public string ReleaseNotes { get; set; } + + [Required] + public string InstructFile { get; set; } + + [Required] + public string UploadScript { get; set; } + + [Required] + public string OhlohUser { get; set; } + + [Required] + public string OhlohProject { get; set; } + + [Required] + public ITaskItem[] RedistributableFiles { get; set; } + + public override bool Execute() { + this.WriteInstructFile(); + this.WriteUploadScript(); + + return !this.Log.HasLoggedErrors; + } + + private void WriteInstructFile() { + var packages = from redist in this.RedistributableFiles + let file = new { Path = redist.ItemSpec, Package = redist.GetMetadata("Package"), Platform = redist.GetMetadata("Platform"), Icon = redist.GetMetadata("Icon") } + group file by file.Package into package + select new XElement( + "package", + new XAttribute("name", package.Key), + new XElement( + "releases", + new XElement( + "release", + new XAttribute("name", this.Release), + new XAttribute("date", XmlConvert.ToString(DateTime.Now)), + new XElement("notes", this.ReleaseNotes), + new XElement( + "files", + package.Select( + f => new XElement( + "file", + new XAttribute("name", Path.GetFileName(f.Path)), + new XAttribute("date", XmlConvert.ToString(DateTime.Now)), + new XAttribute("platform", f.Platform), + new XAttribute("icon", f.Icon) + ) + ) + ) + ) + ) + ); + + var instructXml = new XElement("packages", packages); + + var writerSettings = new XmlWriterSettings { + OmitXmlDeclaration = true, + Indent = true, + IndentChars = "\t", + }; + using (var writer = XmlWriter.Create(this.InstructFile, writerSettings)) { + instructXml.Save(writer); + } + + this.Log.LogMessage("Ohloh instruct file written to: \"{0}\"", this.InstructFile); + + } + + private void WriteUploadScript() { + int longestPath = Math.Max( + GetLinuxPath(Path.GetFullPath(this.InstructFile)).Length, + this.RedistributableFiles.Max(f => GetLinuxPath(f.GetMetadata("FullPath")).Length)); + + using (StreamWriter writer = new StreamWriter(this.UploadScript)) { + writer.WriteLine("#!/bin/bash"); + writer.WriteLine(); + foreach (var file in this.RedistributableFiles) { + writer.WriteLine("scp {0,-" + longestPath + "} {1}@upload.ohloh.net:{2}/files", GetLinuxPath(file.GetMetadata("FullPath")), this.OhlohUser, this.OhlohProject); + } + + writer.WriteLine(); + writer.WriteLine("scp {0,-" + longestPath + "} {1}@upload.ohloh.net:{2}/instructs", GetLinuxPath(Path.GetFullPath(this.InstructFile)), this.OhlohUser, this.OhlohProject); + writer.WriteLine(); + writer.WriteLine("# Download the instruct log by executing this command:"); + writer.WriteLine("# scp {0}@upload.ohloh.net:{1}/logs/upload.log .", this.OhlohUser, this.OhlohProject); + } + + this.Log.LogMessage("Ohloh upload script written to: \"{0}\".", this.UploadScript); + } + + private static string GetLinuxPath(string windowsPath) { + if (String.IsNullOrEmpty(windowsPath)) { + throw new ArgumentNullException("windowsPath"); + } + + string linuxPath = Regex.Replace( + windowsPath, + @"^([A-Za-z])\:", + m => "/" + m.Groups[1].Value) + .Replace('\\', '/') + .Replace(" ", "\\ "); + return linuxPath; + } + } +} diff --git a/tools/DotNetOpenAuth.Versioning.targets b/tools/DotNetOpenAuth.Versioning.targets index ff8ab4b..cbcb76d 100644 --- a/tools/DotNetOpenAuth.Versioning.targets +++ b/tools/DotNetOpenAuth.Versioning.targets @@ -15,6 +15,7 @@ VersionFile="$(ProjectRoot)src\version.txt" GitRepoRoot="$(ProjectRoot)"> <Output TaskParameter="Version" PropertyName="BuildVersion" /> + <Output TaskParameter="SimpleVersion" PropertyName="BuildVersionSimple" /> <Output TaskParameter="GitCommitId" PropertyName="AssemblyInformationalVersion" /> </GetBuildVersion> <PropertyGroup> diff --git a/tools/drop.proj b/tools/drop.proj index 317aba6..68e19ba 100644 --- a/tools/drop.proj +++ b/tools/drop.proj @@ -22,6 +22,9 @@ <DropSpecsDirectory>$(DropDirectory)Specs\</DropSpecsDirectory> </PropertyGroup> <ItemGroup> + <RedistributableFiles Include="@(DropLayoutDependencies)"> + <Package>DotNetOpenAuth project templates</Package> + </RedistributableFiles> <ExtensionVsix Include="@(DropLayoutDependencies)" Condition=" '%(DropLayoutDependencies.MSBuildSourceProjectFile)' == '$(ProjectRoot)vsix\vsix.proj' " /> <ProjectTemplatesVsi Include="@(DropLayoutDependencies)" Condition=" '%(DropLayoutDependencies.MSBuildSourceProjectFile)' == '$(ProjectRoot)vsi\vsi.proj' " /> <DropDirectories Include=" @@ -139,10 +142,15 @@ /> </Target> - <Target Name="Build" DependsOnTargets="Layout"> + <Target Name="Build" DependsOnTargets="Layout" Returns="@(RedistributableFiles)"> <PropertyGroup> <DropZip>$(DropDirectoryNoSlash).zip</DropZip> </PropertyGroup> + <ItemGroup> + <RedistributableFiles Include="$(DropZip)"> + <Package>DotNetOpenAuth</Package> + </RedistributableFiles> + </ItemGroup> <Zip Files="@(AllDropTargets)" ZipFileName="$(DropZip)" WorkingDirectory="$(DropsRoot)" ZipLevel="$(ZipLevel)" /> </Target> diff --git a/tools/ohloh.proj b/tools/ohloh.proj new file mode 100644 index 0000000..f1c41a6 --- /dev/null +++ b/tools/ohloh.proj @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildProjectDirectory)\DotNetOpenAuth.automated.props"/> + + <Target Name="Build"> + <MSBuild BuildInParallel="$(BuildInParallel)" + Projects=" + $(ProjectRoot)samples\tools.proj; + $(ProjectRoot)tools\drop.proj; + "> + <Output TaskParameter="TargetOutputs" ItemName="RedistributableFiles"/> + </MSBuild> + + <ItemGroup> + <RedistributableFiles> + <Icon Condition=" '%(RedistributableFiles.Icon)' == '' ">windows</Icon> + <Platform Condition=" '%(RedistributableFiles.Platform)' == '' ">Visual Studio 2010, .NET $(TargetFrameworkVersion)</Platform> + </RedistributableFiles> + </ItemGroup> + + <PrepareOhlohRelease + Release="$(BuildVersionSimple)" + InstructFile="$(IntermediatePath)OhlohInstruct.xml" + UploadScript="$(IntermediatePath)OhlohUpload.sh" + OhlohUser="aarnott" + OhlohProject="dotnetopenauth" + RedistributableFiles="@(RedistributableFiles)" + Condition=" '%(RedistributableFiles.VSGallery)' != 'true' " + /> + </Target> + + <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.automated.targets"/> +</Project>
\ No newline at end of file diff --git a/vsi/vsi.proj b/vsi/vsi.proj index be0c73b..d46fadc 100644 --- a/vsi/vsi.proj +++ b/vsi/vsi.proj @@ -11,7 +11,7 @@ <ProjectTemplates Include="$(ProjectRoot)projecttemplates\**\*.*proj" /> </ItemGroup> - <Target Name="Build" Returns="$(ProjectTemplatesVsi)"> + <Target Name="Build" Returns="@(RedistributableFiles)"> <MSBuild Projects="..\projecttemplates\projecttemplates.proj" Targets="Zip2008" BuildInParallel="$(BuildInParallel)"> <Output TaskParameter="TargetOutputs" ItemName="ProjectTemplate2008ZipSource"/> </MSBuild> @@ -20,6 +20,9 @@ <ProjectTemplatesVsi>$(DropDirectoryNoSlash).vsi</ProjectTemplatesVsi> </PropertyGroup> <ItemGroup> + <RedistributableFiles Include="$(ProjectTemplatesVsi)"> + <Platform>Visual Studio 2008, .NET $(TargetFrameworkVersion)</Platform> + </RedistributableFiles> <VsiTransformSource Include="*.vscontent"> <BeforeTokens>$version$</BeforeTokens> <AfterTokens>$(BuildVersion)</AfterTokens> diff --git a/vsix/vsix.proj b/vsix/vsix.proj index dcd0e85..636bff9 100644 --- a/vsix/vsix.proj +++ b/vsix/vsix.proj @@ -109,7 +109,9 @@ <GeneratedVsix Include="$(ExtensionVsix)"> <IncludeInDrop>true</IncludeInDrop> </GeneratedVsix> - <GeneratedVsix Include="%(VSGalleryVsixTargets.VSGalleryVsix)" /> + <GeneratedVsix Include="%(VSGalleryVsixTargets.VSGalleryVsix)"> + <VSGallery>true</VSGallery> + </GeneratedVsix> </ItemGroup> <Zip |