Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH1699: Add Language to NuGetPackSettings #1703

Merged
merged 1 commit into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 33 additions & 27 deletions src/Cake.Common.Tests/Properties/Resources.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

<!--
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
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>
Expand All @@ -26,36 +26,36 @@
<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
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
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
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
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
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
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
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down Expand Up @@ -301,6 +301,7 @@ Line #3]]&gt;&lt;/releaseNotes&gt;
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;/metadata&gt;
&lt;files&gt;
&lt;file src="Cake.Core.dll" target="lib/net45" /&gt;
Expand Down Expand Up @@ -331,6 +332,7 @@ Line #3]]&gt;&lt;/releaseNotes&gt;
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;dependencies&gt;
&lt;dependency id="Test1" version="1.0.0" /&gt;
&lt;dependency id="Test2" version="[1.0.0]" /&gt;
Expand Down Expand Up @@ -365,6 +367,7 @@ Line #3]]&gt;&lt;/releaseNotes&gt;
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;/metadata&gt;
&lt;files&gt;
&lt;file src="Cake.Core.dll" target="lib/net45" /&gt;
Expand Down Expand Up @@ -395,6 +398,7 @@ Line #3]]&gt;&lt;/releaseNotes&gt;
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;dependencies&gt;
&lt;dependency id="Test1" version="1.0.0" /&gt;
&lt;dependency id="Test2" version="[1.0.0]" /&gt;
Expand Down Expand Up @@ -923,6 +927,7 @@ EndGlobal</value>
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;dependencies&gt;
&lt;group targetFramework="net452"&gt;
&lt;dependency id="Test1" version="1.0.0" /&gt;
Expand Down Expand Up @@ -961,6 +966,7 @@ Line #3]]&gt;&lt;/releaseNotes&gt;
Line #2
Line #3]]&gt;&lt;/releaseNotes&gt;
&lt;tags&gt;Tag1 Tag2 Tag3&lt;/tags&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;dependencies&gt;
&lt;group targetFramework="net452"&gt;
&lt;dependency id="Test1" version="1.0.0" /&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public void Should_Add_Metadata_Element_To_Nuspec_If_Missing()
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";

// When
var result = fixture.Run();
Expand Down Expand Up @@ -336,6 +337,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec()
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";

// When
var result = fixture.Run();
Expand Down Expand Up @@ -368,6 +370,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec_Without_Namespaces()
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";

// When
var result = fixture.Run();
Expand Down Expand Up @@ -399,6 +402,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec_With_Files()
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";
fixture.Settings.Files = new[]
{
new NuSpecContent { Source = "Cake.Core.dll", Target = "lib/net45" },
Expand Down Expand Up @@ -443,6 +447,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec_With_Files_Without_Namespac
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";
fixture.Settings.Files = new[]
{
new NuSpecContent { Source = "Cake.Core.dll", Target = "lib/net45" },
Expand Down Expand Up @@ -519,6 +524,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec_With_Files_And_DependencyTa
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";
fixture.Settings.Files = new[]
{
new NuSpecContent { Source = "Cake.Core.dll", Target = "lib/net45" },
Expand Down Expand Up @@ -563,6 +569,7 @@ public void Should_Replace_Template_Tokens_In_Nuspec_With_Files_And_DependencyTa
fixture.Settings.Copyright = "The copyright";
fixture.Settings.ReleaseNotes = new[] { "Line #1", "Line #2", "Line #3" };
fixture.Settings.Tags = new[] { "Tag1", "Tag2", "Tag3" };
fixture.Settings.Language = "en-us";
fixture.Settings.Files = new[]
{
new NuSpecContent { Source = "Cake.Core.dll", Target = "lib/net45" },
Expand Down
6 changes: 6 additions & 0 deletions src/Cake.Common/Tools/NuGet/Pack/NuGetPackSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,11 @@ public sealed class NuGetPackSettings : ToolSettings
/// <c>true</c> if the temporarily autogenerated NuSpec file should be kept; otherwise <c>false</c>.
/// </value>
public bool KeepTemporaryNuSpecFile { get; set; }

/// <summary>
/// Gets or sets the package language.
/// </summary>
/// <value>The package language.</value>
public string Language { get; set; }
}
}
3 changes: 2 additions & 1 deletion src/Cake.Common/Tools/NuGet/Pack/NuspecTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static NuspecTransformer()
{ "requireLicenseAcceptance", settings => ToString(settings.RequireLicenseAcceptance) },
{ "copyright", settings => ToString(settings.Copyright) },
{ "releaseNotes", settings => ToMultiLineString(settings.ReleaseNotes) },
{ "tags", settings => ToSpaceSeparatedString(settings.Tags) }
{ "tags", settings => ToSpaceSeparatedString(settings.Tags) },
{ "language", settings => ToString(settings.Language) }
};

_cdataElements = new List<string> { "releaseNotes" };
Expand Down