diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-13 23:25:37 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-13 23:25:37 -0800 |
commit | ac8620d66eef2877343aa7047e382de39d6b72df (patch) | |
tree | 2256b6c35ae3c01fad89c5923db1f6e2f0a30ad6 | |
parent | 415ea51a475e35079d2a595b90803f331a1d8ee7 (diff) | |
download | DotNetOpenAuth-ac8620d66eef2877343aa7047e382de39d6b72df.zip DotNetOpenAuth-ac8620d66eef2877343aa7047e382de39d6b72df.tar.gz DotNetOpenAuth-ac8620d66eef2877343aa7047e382de39d6b72df.tar.bz2 |
Beginning of VSIX packaging, and made VSI include version number from build system.
-rw-r--r-- | build.proj | 49 | ||||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.dll | bin | 64000 -> 64000 bytes | |||
-rw-r--r-- | lib/DotNetOpenAuth.BuildTasks.pdb | bin | 159232 -> 159232 bytes | |||
-rw-r--r-- | projecttemplates/DotNetOpenAuth Starter Kits.vscontent | 4 | ||||
-rw-r--r-- | src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs | 61 | ||||
-rw-r--r-- | vsix/[Content_Types].xml | 7 | ||||
-rw-r--r-- | vsix/extension.vsixmanifest | 28 |
7 files changed, 121 insertions, 28 deletions
@@ -7,6 +7,8 @@ <ILMergeOutputAssembly>$(ILMergeOutputAssemblyDirectory)$(ProductName).dll</ILMergeOutputAssembly> <ProjectTemplatesLayoutPath>$(IntermediatePath)projecttemplates\</ProjectTemplatesLayoutPath> <ProjectTemplatesVsi>$(ProjectTemplatesLayoutPath)DotNetOpenAuth Starter Kits.vsi</ProjectTemplatesVsi> + <ExtensionVsixLayoutPath>$(IntermediatePath)Vsix\</ExtensionVsixLayoutPath> + <ExtensionVsix>$(ExtensionVsixLayoutPath)DotNetOpenAuth Starter Kits.vsix</ExtensionVsix> </PropertyGroup> <Import Project="$(ProjectRoot)tools\$(ProductName).Versioning.targets"/> @@ -148,7 +150,7 @@ <MSBuild Projects="@(ProjectTemplates)" /> </Target> - <Target Name="ProjectTemplatesLayout" DependsOnTargets="BuildUnifiedProduct;ReSignDelaySignedAssemblies;BuildProjectTemplates"> + <Target Name="ProjectTemplatesLayout" DependsOnTargets="GetBuildVersion;BuildUnifiedProduct;ReSignDelaySignedAssemblies;BuildProjectTemplates"> <ItemGroup> <ProjectTemplatesSource Include="$(ProjectRoot)projecttemplates\**\*" Exclude=" @@ -182,6 +184,13 @@ <SkipUnchangedFiles Condition="'%(Extension)' != '.csproj'">true</SkipUnchangedFiles> <SkipUnchangedFiles Condition="'%(Extension)' == '.csproj'">false</SkipUnchangedFiles> </_ProjectTemplatesTransformSource> + <_ProjectTemplatesTransformSource Include="@(ProjectTemplatesSource)" Condition=" + '%(Extension)' == '.vscontent' + "> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + <SkipUnchangedFiles>false</SkipUnchangedFiles> + </_ProjectTemplatesTransformSource> <ProjectTemplatesSource Remove="@(_ProjectTemplatesTransformSource)" /> <ProjectTemplatesLayout Include="@(ProjectTemplatesSource->'$(ProjectTemplatesLayoutPath)%(RecursiveDir)%(FileName)%(Extension)')"/> @@ -304,6 +313,44 @@ /> </Target> + <Target Name="VsixLayout" DependsOnTargets="GetBuildVersion"> + <ItemGroup> + <ExtensionVsixSources Include=" + $(ProjectRoot)vsix\[Content_Types].xml; + $(ProjectRoot)LICENSE.txt; + $(ProjectRoot)doc\logo\dnoa-logo.png; + $(ProjectRoot)doc\logo\dnoa-logo_64x64.png; + "> + <SkipUnchangedFiles>true</SkipUnchangedFiles> + </ExtensionVsixSources> + <ExtensionVsixSources Include=" + $(ProjectRoot)vsix\extension.vsixmanifest; + "> + <SkipUnchangedFiles>true</SkipUnchangedFiles> + <BeforeTokens>$version$</BeforeTokens> + <AfterTokens>$(BuildVersion)</AfterTokens> + </ExtensionVsixSources> + <ExtensionVsixContents Include="@(ExtensionVsixSources->'$(ExtensionVsixLayoutPath)%(FileName)%(Extension)')" /> + </ItemGroup> + + <CopyWithTokenSubstitution SourceFiles="@(ExtensionVsixSources)" + DestinationFiles="@(ExtensionVsixContents)" /> + <Purge Directories="$(ExtensionVsixLayoutPath)" + IntendedFiles=" + @(ExtensionVsixContents); + $(ExtensionVsix); + " /> + </Target> + + <Target Name="vsix" DependsOnTargets="VsixLayout"> + <Delete Files="$(ExtensionVsix)" /> + <Zip + Files="@(ExtensionVsixContents)" + ZipFileName="$(ExtensionVsix)" + WorkingDirectory="$(ExtensionVsixLayoutPath)" + /> + </Target> + <Target Name="Documentation" DependsOnTargets="BuildProduct;Chm" Condition="'$(NoDocumentation)' != 'true'"> </Target> diff --git a/lib/DotNetOpenAuth.BuildTasks.dll b/lib/DotNetOpenAuth.BuildTasks.dll Binary files differindex f0b95a0..80a95bf 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 c125ac3..9636457 100644 --- a/lib/DotNetOpenAuth.BuildTasks.pdb +++ b/lib/DotNetOpenAuth.BuildTasks.pdb diff --git a/projecttemplates/DotNetOpenAuth Starter Kits.vscontent b/projecttemplates/DotNetOpenAuth Starter Kits.vscontent index 184c28c..d084bb1 100644 --- a/projecttemplates/DotNetOpenAuth Starter Kits.vscontent +++ b/projecttemplates/DotNetOpenAuth Starter Kits.vscontent @@ -4,7 +4,7 @@ <DisplayName>ASP.NET OpenID-InfoCard RP</DisplayName> <Description>An ASP.NET web forms web site that accepts OpenID and InfoCard logins</Description> <FileContentType>VSTemplate</FileContentType> - <ContentVersion>2.0</ContentVersion> + <ContentVersion>$version$</ContentVersion> <Attributes> <Attribute name="ProjectType" value="Visual C#"/> <Attribute name="ProjectSubType" value="Web"/> @@ -16,7 +16,7 @@ <DisplayName>ASP.NET MVC OpenID-InfoCard RP</DisplayName> <Description>An ASP.NET MVC web site that accepts OpenID and InfoCard logins</Description> <FileContentType>VSTemplate</FileContentType> - <ContentVersion>2.0</ContentVersion> + <ContentVersion>$version$</ContentVersion> <Attributes> <Attribute name="ProjectType" value="Visual C#"/> <Attribute name="ProjectSubType" value="Web"/> diff --git a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs index e17d8f2..38f3b50 100644 --- a/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs +++ b/src/DotNetOpenAuth.BuildTasks/CopyWithTokenSubstitution.cs @@ -58,36 +58,47 @@ namespace DotNetOpenAuth.BuildTasks { string destPath = this.DestinationFiles[i].ItemSpec; bool skipUnchangedFiles = bool.Parse(this.SourceFiles[i].GetMetadata("SkipUnchangedFiles")); - // We deliberably consider newer destination files to be up-to-date rather than - // requiring equality because this task modifies the destination file while copying. - if (skipUnchangedFiles && File.GetLastWriteTimeUtc(sourcePath) < File.GetLastWriteTimeUtc(destPath)) { - Log.LogMessage(MessageImportance.Low, "Skipping \"{0}\" -> \"{1}\" because the destination is up to date.", sourcePath, destPath); - continue; - } + if (string.IsNullOrEmpty(this.SourceFiles[i].GetMetadata("BeforeTokens"))) { + // this is just a standard copy without token substitution + if (skipUnchangedFiles && File.GetLastWriteTimeUtc(sourcePath) == File.GetLastWriteTimeUtc(destPath)) { + Log.LogMessage(MessageImportance.Low, "Skipping \"{0}\" -> \"{1}\" because the destination is up to date.", sourcePath, destPath); + continue; + } - Log.LogMessage(MessageImportance.Normal, "Transforming \"{0}\" -> \"{1}\"", sourcePath, destPath); + Log.LogMessage(MessageImportance.Normal, "Copying \"{0}\" -> \"{1}\"", sourcePath, destPath); + File.Copy(sourcePath, destPath, true); + } else { + // We deliberably consider newer destination files to be up-to-date rather than + // requiring equality because this task modifies the destination file while copying. + if (skipUnchangedFiles && File.GetLastWriteTimeUtc(sourcePath) < File.GetLastWriteTimeUtc(destPath)) { + Log.LogMessage(MessageImportance.Low, "Skipping \"{0}\" -> \"{1}\" because the destination is up to date.", sourcePath, destPath); + continue; + } - string[] beforeTokens = this.SourceFiles[i].GetMetadata("BeforeTokens").Split(';'); - string[] afterTokens = this.SourceFiles[i].GetMetadata("AfterTokens").Split(';'); - if (beforeTokens.Length != afterTokens.Length) { - Log.LogError("Unequal number of before and after tokens. Before: \"{0}\". After \"{1}\".", beforeTokens, afterTokens); - return false; - } + Log.LogMessage(MessageImportance.Normal, "Transforming \"{0}\" -> \"{1}\"", sourcePath, destPath); - using (StreamReader sr = File.OpenText(sourcePath)) { - if (!Directory.Exists(Path.GetDirectoryName(destPath))) { - Directory.CreateDirectory(Path.GetDirectoryName(destPath)); + string[] beforeTokens = this.SourceFiles[i].GetMetadata("BeforeTokens").Split(';'); + string[] afterTokens = this.SourceFiles[i].GetMetadata("AfterTokens").Split(';'); + if (beforeTokens.Length != afterTokens.Length) { + Log.LogError("Unequal number of before and after tokens. Before: \"{0}\". After \"{1}\".", beforeTokens, afterTokens); + return false; } - using (StreamWriter sw = File.CreateText(destPath)) { - StringBuilder line = new StringBuilder(); - while (!sr.EndOfStream) { - line.Length = 0; - line.Append(sr.ReadLine()); - for (int j = 0; j < beforeTokens.Length; j++) { - line.Replace(beforeTokens[j], afterTokens[j]); - } - sw.WriteLine(line); + using (StreamReader sr = File.OpenText(sourcePath)) { + if (!Directory.Exists(Path.GetDirectoryName(destPath))) { + Directory.CreateDirectory(Path.GetDirectoryName(destPath)); + } + using (StreamWriter sw = File.CreateText(destPath)) { + StringBuilder line = new StringBuilder(); + while (!sr.EndOfStream) { + line.Length = 0; + line.Append(sr.ReadLine()); + for (int j = 0; j < beforeTokens.Length; j++) { + line.Replace(beforeTokens[j], afterTokens[j]); + } + + sw.WriteLine(line); + } } } } diff --git a/vsix/[Content_Types].xml b/vsix/[Content_Types].xml new file mode 100644 index 0000000..d9bec60 --- /dev/null +++ b/vsix/[Content_Types].xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> + <Default Extension="png" ContentType="application/octet-stream" /> + <Default Extension="txt" ContentType="text/plain" /> + <Default Extension="vsixmanifest" ContentType="text/xml" /> + <Default Extension="zip" ContentType="application/zip" /> +</Types>
\ No newline at end of file diff --git a/vsix/extension.vsixmanifest b/vsix/extension.vsixmanifest new file mode 100644 index 0000000..0fbd2aa --- /dev/null +++ b/vsix/extension.vsixmanifest @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010"> + <Identifier Id="DotNetOpenAuth.d2122791-8de4-4d3b-a414-7563c9a8cd6e"> + <Name>DotNetOpenAuth Project Templates</Name> + <Author>Andrew Arnott</Author> + <Version>$version$</Version> + <Description>An ASP.NET web forms web site that accepts OpenID and InfoCard logins</Description> + <Locale>1033</Locale> + <License>LICENSE.txt</License> + <GettingStartedGuide>http://www.dotnetopenauth.net/ProjectTemplateGettingStarted</GettingStartedGuide> + <Icon>VSIXProject_small.png</Icon> + <PreviewImage>VSIXProject_large.png</PreviewImage> + <InstalledByMsi>false</InstalledByMsi> + <SupportedProducts> + <VisualStudio Version="10.0"> + <Edition>VSTS</Edition> + <Edition>VSTD</Edition> + <Edition>Pro</Edition> + </VisualStudio> + </SupportedProducts> + <SupportedFrameworkRuntimeEdition MinVersion="3.5" MaxVersion="3.5" /> + </Identifier> + <References /> + <Content> + <ProjectTemplate>WebFormsRelyingParty</ProjectTemplate> + <ProjectTemplate>MvcRelyingParty</ProjectTemplate> + </Content> +</Vsix> |