diff --git a/docs/content/commands/pack.md b/docs/content/commands/pack.md index d23dce7b5b..226e14b9c3 100644 --- a/docs/content/commands/pack.md +++ b/docs/content/commands/pack.md @@ -79,3 +79,12 @@ by using the `minimum-from-lock-file` parameter the dependencies of the generate [depfile]: dependencies-file.html [reffile]: references-files.html [templatefile]: template-files.html + +### Localized Packages + +When using a `.template` with `type project` any localized satellite dlls are included in the created packages. +The following layout is created: +``` +lib/net45/Foo.dll + /se/Foo.resources.dll +``` \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/PackSpecs.fs b/integrationtests/Paket.IntegrationTests/PackSpecs.fs index 48f85f9718..33568d3375 100644 --- a/integrationtests/Paket.IntegrationTests/PackSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/PackSpecs.fs @@ -349,3 +349,36 @@ let ``#1596 pack works for reflected definition assemblies``() = File.Exists(Path.Combine(outPath, "lib", "net45", "Project2.dll")) |> shouldEqual true File.Delete(templatePath) + +[] +let ``#1816 pack localized happy path`` () = + let scenario = "i001816-pack-localized-happy-path" + let rootPath = scenarioTempPath scenario + let outPath = Path.Combine(rootPath, "out") + let package = Path.Combine(outPath, "LocalizedLib.1.0.0.0.nupkg") + + paket ("pack -v output \"" + outPath) scenario |> ignore + ZipFile.ExtractToDirectory(package, outPath) + + Path.Combine(outPath, "lib", "net45", "LocalizedLib.dll") |> checkFileExists + Path.Combine(outPath, "lib", "net45", "sv", "LocalizedLib.resources.dll") |> checkFileExists + Path.Combine(outPath, "lib", "net45", "sv-FI", "LocalizedLib.resources.dll") |> checkFileExists + + CleanDir rootPath + +[] +let ``#1816 pack localized when satellite dll is missing`` () = + let scenario = "i001816-pack-localized-missing-dll" + let rootPath = scenarioTempPath scenario + let outPath = Path.Combine(rootPath, "out") + let package = Path.Combine(outPath, "LocalizedLib.1.0.0.0.nupkg") + + let result = paket ("pack -v output \"" + outPath) scenario + let expectedMessage = "Did not find satellite assembly for (sv) try building and running pack again." + StringAssert.Contains(expectedMessage, result) + ZipFile.ExtractToDirectory(package, outPath) + + Path.Combine(outPath, "lib", "net45", "LocalizedLib.dll") |> checkFileExists + Path.Combine(outPath, "lib", "net45", "sv-FI", "LocalizedLib.resources.dll") |> checkFileExists + + CleanDir rootPath diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib.sln b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib.sln new file mode 100644 index 0000000000..a84b233aa2 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizedLib", "LocalizedLib\LocalizedLib.csproj", "{F1120474-4821-4FE7-95C1-C71E639664C0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1120474-4821-4FE7-95C1-C71E639664C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Class1.cs b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Class1.cs new file mode 100644 index 0000000000..48508ef3d9 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Class1.cs @@ -0,0 +1,6 @@ +namespace LocalizedLib +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/LocalizedLib.csproj b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/LocalizedLib.csproj new file mode 100644 index 0000000000..e0764eb484 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/LocalizedLib.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {F1120474-4821-4FE7-95C1-C71E639664C0} + Library + Properties + LocalizedLib + LocalizedLib + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 0 + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/AssemblyInfo.cs b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..39a892127f --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LocalizedLib")] +[assembly: AssemblyDescription("Test with satellite dlls")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Author")] +[assembly: AssemblyProduct("LocalizedLib")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f1120474-4821-4fe7-95c1-c71e639664c0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.Designer.cs b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..06c92529ef --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LocalizedLib.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocalizedLib.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Key. + /// + internal static string Key { + get { + return ResourceManager.GetString("Key", resourceCulture); + } + } + } +} diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.resx b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.resx new file mode 100644 index 0000000000..58c1f76475 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Key + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv-FI.resx b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv-FI.resx new file mode 100644 index 0000000000..3ae158b572 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv-FI.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nyckel + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv.resx b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv.resx new file mode 100644 index 0000000000..3ae158b572 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/Properties/Resources.sv.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nyckel + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/LocalizedLib.dll b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/LocalizedLib.dll new file mode 100644 index 0000000000..56b6a4e70a Binary files /dev/null and b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/LocalizedLib.dll differ diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll new file mode 100644 index 0000000000..0cf45ee439 Binary files /dev/null and b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll differ diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv/LocalizedLib.resources.dll b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv/LocalizedLib.resources.dll new file mode 100644 index 0000000000..de2dbc497f Binary files /dev/null and b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/bin/Release/sv/LocalizedLib.resources.dll differ diff --git a/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/paket.template b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/paket.template new file mode 100644 index 0000000000..89dba9f5ba --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-happy-path/before/LocalizedLib/paket.template @@ -0,0 +1,4 @@ +type project +licenseUrl http://opensource.org/licenses/MIT +authors blub +description bla diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib.sln b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib.sln new file mode 100644 index 0000000000..a84b233aa2 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalizedLib", "LocalizedLib\LocalizedLib.csproj", "{F1120474-4821-4FE7-95C1-C71E639664C0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1120474-4821-4FE7-95C1-C71E639664C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1120474-4821-4FE7-95C1-C71E639664C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Class1.cs b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Class1.cs new file mode 100644 index 0000000000..48508ef3d9 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Class1.cs @@ -0,0 +1,6 @@ +namespace LocalizedLib +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/LocalizedLib.csproj b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/LocalizedLib.csproj new file mode 100644 index 0000000000..e0764eb484 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/LocalizedLib.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {F1120474-4821-4FE7-95C1-C71E639664C0} + Library + Properties + LocalizedLib + LocalizedLib + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 0 + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/AssemblyInfo.cs b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..39a892127f --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LocalizedLib")] +[assembly: AssemblyDescription("Test with satellite dlls")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Author")] +[assembly: AssemblyProduct("LocalizedLib")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f1120474-4821-4fe7-95c1-c71e639664c0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.Designer.cs b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..06c92529ef --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LocalizedLib.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocalizedLib.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Key. + /// + internal static string Key { + get { + return ResourceManager.GetString("Key", resourceCulture); + } + } + } +} diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.resx b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.resx new file mode 100644 index 0000000000..58c1f76475 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Key + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv-FI.resx b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv-FI.resx new file mode 100644 index 0000000000..3ae158b572 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv-FI.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nyckel + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv.resx b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv.resx new file mode 100644 index 0000000000..3ae158b572 --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/Properties/Resources.sv.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Nyckel + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/LocalizedLib.dll b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/LocalizedLib.dll new file mode 100644 index 0000000000..56b6a4e70a Binary files /dev/null and b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/LocalizedLib.dll differ diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll new file mode 100644 index 0000000000..0cf45ee439 Binary files /dev/null and b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/bin/Release/sv-FI/LocalizedLib.resources.dll differ diff --git a/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/paket.template b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/paket.template new file mode 100644 index 0000000000..89dba9f5ba --- /dev/null +++ b/integrationtests/scenarios/i001816-pack-localized-missing-dll/before/LocalizedLib/paket.template @@ -0,0 +1,4 @@ +type project +licenseUrl http://opensource.org/licenses/MIT +authors blub +description bla diff --git a/src/Paket.Core/Cultures.fs b/src/Paket.Core/Cultures.fs new file mode 100644 index 0000000000..7cbf2118fd --- /dev/null +++ b/src/Paket.Core/Cultures.fs @@ -0,0 +1,19 @@ +namespace Paket +open System +open System.Collections.Generic +open System.Globalization + +[] +module Cultures = + let private allLanguageNames = + let allLanguageNames = + CultureInfo.GetCultures CultureTypes.AllCultures + |> Array.map (fun c -> c.Name) + |> Array.filter (String.IsNullOrEmpty >> not) + HashSet<_>(allLanguageNames, StringComparer.OrdinalIgnoreCase) + + let isLanguageName text = + if String.IsNullOrWhiteSpace text then + false + else + allLanguageNames.Contains text diff --git a/src/Paket.Core/PackageMetaData.fs b/src/Paket.Core/PackageMetaData.fs index 0bfa9f7b20..3e24fee239 100644 --- a/src/Paket.Core/PackageMetaData.fs +++ b/src/Paket.Core/PackageMetaData.fs @@ -167,17 +167,39 @@ let findDependencies (dependenciesFile : DependenciesFile) config platform (temp deps, p :: files) ([], []) - // Add the assembly + pdb + dll from this project + // Add the assembly + {.dll, .pdb, .xml, /*/.resources.dll} from this project let templateWithOutput = + let projects = + if includeReferencedProjects then + project.GetAllInterProjectDependenciesWithoutProjectTemplates() + |> Seq.toList + else + [ project ] + + let satelliteDlls = + seq { + for project in projects do + let satelliteAssemblyName = Path.GetFileNameWithoutExtension(project.GetAssemblyName()) + ".resources.dll" + let projectDir = Path.GetDirectoryName(Path.GetFullPath(project.FileName)) + let outputDir = Path.Combine(projectDir, project.GetOutputDirectory config platform) + for language in project.FindLocalizedLanguageNames() do + let fileName = Path.Combine(outputDir, language, satelliteAssemblyName) + if File.Exists fileName then + let satelliteTargetDir = Path.Combine(targetDir, language) + yield (FileInfo fileName, satelliteTargetDir) + else + traceWarnfn "Did not find satellite assembly for (%s) try building and running pack again." language + } + + let template = + satelliteDlls + |> Seq.fold (fun template (dllFile, targetDir) -> addFile dllFile.FullName targetDir template) template + + let assemblyNames = + projects + |> List.map (fun proj -> proj.GetAssemblyName()) + let additionalFiles = - let assemblyNames = - if includeReferencedProjects then - project.GetAllInterProjectDependenciesWithoutProjectTemplates() - |> Seq.toList - else - [ project ] - |> List.map (fun proj -> proj.GetAssemblyName()) - assemblyNames |> Seq.collect (fun assemblyFileName -> let assemblyfi = FileInfo(assemblyFileName) diff --git a/src/Paket.Core/Paket.Core.fsproj b/src/Paket.Core/Paket.Core.fsproj index 36930dcb8b..1fc991632f 100644 --- a/src/Paket.Core/Paket.Core.fsproj +++ b/src/Paket.Core/Paket.Core.fsproj @@ -98,6 +98,7 @@ + diff --git a/src/Paket.Core/ProjectFile.fs b/src/Paket.Core/ProjectFile.fs index 0e65eb715f..754e7fb702 100644 --- a/src/Paket.Core/ProjectFile.fs +++ b/src/Paket.Core/ProjectFile.fs @@ -4,9 +4,10 @@ open Paket open Paket.Domain open Paket.Logging open System +open System.Collections.Generic open System.IO +open System.Text.RegularExpressions open System.Xml -open System.Collections.Generic open Paket.Xml open Paket.Requirements @@ -1337,6 +1338,32 @@ type ProjectFile with member this.FindReferencesFile() = this.FindCorrespondingFile Constants.ReferencesFile + member this.FindLocalizedLanguageNames() = + let tryGetAttributeValue name node = + if hasAttribute name node then + Some node.Attributes.[name].Value + else + None + + let tryGetLanguage value = + let pattern = @"\.(?\w+(-\w+)?)\.resx$" + let m = Regex.Match(value, pattern, RegexOptions.ExplicitCapture) + if m.Success then + let value = m.Groups.["language"].Value + if Cultures.isLanguageName value then + Some value + else + None + else + None + + this.ProjectNode + |> getDescendants "EmbeddedResource" + |> List.choose (tryGetAttributeValue "Include") + |> List.choose (tryGetLanguage) + |> List.distinct + |> List.sort + member this.HasPackageInstalled(groupName,package) = match this.FindReferencesFile() with | None -> false diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 341f93bde0..a3c2ee144e 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -30,8 +30,8 @@ Project paket.exe Project - install -v - C:\PROJ\Paket\integrationtests\scenarios\i001779-net20-only-in-net461\temp + pack -v output "C:\Git\ThirdParty\Paket\integrationtests\scenarios\i001816-pack-localized-happy-path\temp\out + C:\Git\ThirdParty\Paket\integrationtests\scenarios\i001816-pack-localized-happy-path\before\ pdbonly diff --git a/tests/Paket.Tests/Paket.Tests.fsproj b/tests/Paket.Tests/Paket.Tests.fsproj index e91812845e..e0e7b10a56 100644 --- a/tests/Paket.Tests/Paket.Tests.fsproj +++ b/tests/Paket.Tests/Paket.Tests.fsproj @@ -306,6 +306,9 @@ Always + + Always + @@ -313,6 +316,7 @@ + diff --git a/tests/Paket.Tests/ProjectFile/LocalizationSpecs.fs b/tests/Paket.Tests/ProjectFile/LocalizationSpecs.fs new file mode 100644 index 0000000000..73a70c6d16 --- /dev/null +++ b/tests/Paket.Tests/ProjectFile/LocalizationSpecs.fs @@ -0,0 +1,30 @@ +module Paket.ProjectFile.LocalizationSpecs + +open Paket +open NUnit.Framework +open FsUnit +open System.Xml +open System.Xml.Linq +open TestHelpers + +[] +let ``finds language names`` () = + ensureDir () + let actual = ProjectFile.TryLoad("./ProjectFile/TestData/LocalizedLib.csprojtest") + .Value + .FindLocalizedLanguageNames() + let expected = + [ + "sv" + "sv-FI" + ] + CollectionAssert.AreEqual(expected, actual) + +[] +let ``returns empty when no localization`` () = + ensureDir () + let actual = ProjectFile.TryLoad("./ProjectFile/TestData/NewSilverlightClassLibrary.csprojtest") + .Value + .FindLocalizedLanguageNames() + CollectionAssert.IsEmpty(actual) + diff --git a/tests/Paket.Tests/ProjectFile/TestData/LocalizedLib.csprojtest b/tests/Paket.Tests/ProjectFile/TestData/LocalizedLib.csprojtest new file mode 100644 index 0000000000..e0764eb484 --- /dev/null +++ b/tests/Paket.Tests/ProjectFile/TestData/LocalizedLib.csprojtest @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {F1120474-4821-4FE7-95C1-C71E639664C0} + Library + Properties + LocalizedLib + LocalizedLib + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 0 + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + \ No newline at end of file