Skip to content

Commit

Permalink
To remove, we must first add
Browse files Browse the repository at this point in the history
- part of #93
- copy `WebEncoders` into Common repo
- add hacks to work around dotnet/cli#3831 and NuGet/Home#3118
  • Loading branch information
dougbu committed Jul 12, 2016
1 parent 12c31c8 commit 9a241a0
Show file tree
Hide file tree
Showing 9 changed files with 807 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Common.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FEAA3936-5906-4383-B750-F07FE1B156C5}"
EndProject
Expand Down Expand Up @@ -44,6 +44,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.StackT
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClassLibraryWithPortablePdbs", "test\ClassLibraryWithPortablePdbs\ClassLibraryWithPortablePdbs.xproj", "{A2ABDB54-1E32-4BEE-81A1-C0353802A0C0}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.WebEncoders.Sources", "src\Microsoft.Extensions.WebEncoders.Sources\Microsoft.Extensions.WebEncoders.Sources.xproj", "{C60445B0-452F-4321-9E66-847BCB4DEEC8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -126,6 +128,10 @@ Global
{A2ABDB54-1E32-4BEE-81A1-C0353802A0C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2ABDB54-1E32-4BEE-81A1-C0353802A0C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2ABDB54-1E32-4BEE-81A1-C0353802A0C0}.Release|Any CPU.Build.0 = Release|Any CPU
{C60445B0-452F-4321-9E66-847BCB4DEEC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C60445B0-452F-4321-9E66-847BCB4DEEC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C60445B0-452F-4321-9E66-847BCB4DEEC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C60445B0-452F-4321-9E66-847BCB4DEEC8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -150,5 +156,6 @@ Global
{D9A0A539-4A22-4151-90B2-1D6AA4CD493D} = {FEAA3936-5906-4383-B750-F07FE1B156C5}
{B245CE2A-F918-4116-9D5C-4C21527D0AC5} = {FEAA3936-5906-4383-B750-F07FE1B156C5}
{A2ABDB54-1E32-4BEE-81A1-C0353802A0C0} = {6878D8F1-6DCE-4677-AA1A-4D14BA6D2D60}
{C60445B0-452F-4321-9E66-847BCB4DEEC8} = {FEAA3936-5906-4383-B750-F07FE1B156C5}
EndGlobalSection
EndGlobal
81 changes: 81 additions & 0 deletions makefile.shade
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
use namespace="System.IO"
use namespace="System.IO.Compression"
use namespace="System.Linq"

default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}'
default ENCODERS_PACKAGE_NAME='Microsoft.Extensions.WebEncoders.Sources'

var VERSION='0.1'
var FULL_VERSION='0.1'
use-standard-lifecycle
k-standard-goals

#repack-encoders target='compile' if='Directory.Exists("src")'
@{
// Target is a workaround for dotnet/cli#3831.
// Add contentFiles section to the NuGet spec for the WebEncoders.Source package.
var projectNupkg = Files
.Include(Path.Combine(BUILD_DIR_LOCAL, ENCODERS_PACKAGE_NAME + ".1.*.nupkg")) // Assuming the package version starts with 1.
.Where(path => !path.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
.OrderByDescending(f => f) // On local builds multiple nupkgs are generated.
.First();

Log.Info("Repacking Nupkg: " + projectNupkg);

var extractToDirectory = projectNupkg + "-temp";
ZipFile.ExtractToDirectory(projectNupkg, extractToDirectory);

File.Delete(Path.Combine(extractToDirectory, "[Content_Types].xml"));

// Copy any/any content to any/netstandard1.0. This is a workaround for NuGet/Home#3118.
// Does not handle directories under contentFiles/any/any.
var sourceDirectory = Path.Combine(extractToDirectory, "contentFiles", "any", "any");
if (Directory.Exists(sourceDirectory))
{
var targetDirectory = Path.Combine(extractToDirectory, "contentFiles", "any", "netstandard1.0");
if (!Directory.Exists(targetDirectory))
{
Directory.CreateDirectory(targetDirectory);
}

foreach (var file in Directory.GetFiles(sourceDirectory))
{
var fileName = Path.GetFileName(file);
var targetFile = Path.Combine(targetDirectory, fileName);
File.Copy(file, targetFile, overwrite: false);
}
}

// Update the .nuspec file.
var nuspecFile = Files.Include(Path.Combine(extractToDirectory, "*.nuspec")).First();
var nuspec = new List<string>(File.ReadAllLines(nuspecFile));
var endOfMetadata = nuspec.FindIndex(l => l.Contains("</metadata>"));
var content = new[]
{
" <contentFiles>",
" <files include=\"**/*.resx\" buildAction=\"EmbeddedResource\" />",
" </contentFiles>",
};
nuspec.InsertRange(endOfMetadata, content);

File.WriteAllLines(nuspecFile, nuspec);

// Repack.
var nugetExePath = Environment.GetEnvironmentVariable("KOREBUILD_NUGET_EXE");
if (string.IsNullOrEmpty(nugetExePath))
{
nugetExePath = Path.Combine(BASE_DIR_LOCAL, ".build", "nuget.exe");
}
ExecClr(nugetExePath, "pack " + nuspecFile + " -OutputDirectory " + BUILD_DIR_LOCAL);

try
{
// Delete temporary directory we used to repack.
Directory.Delete(extractToDirectory, true);
}
catch
{
// Don't care if we couldn't delete the temp directory.
}
}
123 changes: 123 additions & 0 deletions src/Microsoft.Extensions.WebEncoders.Sources/EncoderResources.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="WebEncoders_InvalidCountOffsetOrLength" xml:space="preserve">
<value>Invalid {0}, {1} or {2} length.</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c60445b0-452f-4321-9e66-847bcb4deec8</ProjectGuid>
<RootNamespace>Microsoft.Extensions.WebEncoders.Sources</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9a241a0

Please sign in to comment.