Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav K <prkrishn@hotmail.com>2020-04-17 02:52:07 +0300
committerGitHub <noreply@github.com>2020-04-17 02:52:07 +0300
commit50a2527ca97f955ea0390b88a61530e9e3837ee3 (patch)
tree090fcf92726615cccb3be3e837a2c468dca7f9e5
parent840d80632630c7121abbd4b24890a3e93f3bfc7a (diff)
Copy I18N assemblies when running without the linker (#20878)
* Copy I18N assemblies when running without the linker Fixes https://github.com/dotnet/aspnetcore/issues/20517
-rw-r--r--src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.props2
-rw-r--r--src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets10
-rw-r--r--src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs49
3 files changed, 59 insertions, 2 deletions
diff --git a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.props b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.props
index 84031fb5e8..45223bca93 100644
--- a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.props
+++ b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.props
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
- <MonoLinkerI18NAssemblies>none</MonoLinkerI18NAssemblies> <!-- See Mono linker docs - allows comma-separated values from: none,all,cjk,mideast,other,rare,west -->
+ <BlazorWebAssemblyI18NAssemblies>none</BlazorWebAssemblyI18NAssemblies> <!-- See Mono linker docs - allows comma-separated values from: none,all,cjk,mideast,other,rare,west -->
<AdditionalMonoLinkerOptions>--disable-opt unreachablebodies --verbose --strip-security true --exclude-feature com -v false -c link -u link -b true</AdditionalMonoLinkerOptions>
<_BlazorJsPath Condition="'$(_BlazorJsPath)' == ''">$(MSBuildThisFileDirectory)..\tools\blazor\blazor.webassembly.js</_BlazorJsPath>
diff --git a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
index ddb7556f0b..8c16457068 100644
--- a/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
+++ b/src/Components/WebAssembly/Build/src/targets/Blazor.MonoRuntime.targets
@@ -265,7 +265,7 @@
Condition="'$(BuildingInsideVisualStudio)' != 'true' OR '$(DeployOnBuild)' != 'true'">
<PropertyGroup>
- <_BlazorLinkerAdditionalOptions>-l $(MonoLinkerI18NAssemblies) $(AdditionalMonoLinkerOptions)</_BlazorLinkerAdditionalOptions>
+ <_BlazorLinkerAdditionalOptions>-l $(BlazorWebAssemblyI18NAssemblies) $(AdditionalMonoLinkerOptions)</_BlazorLinkerAdditionalOptions>
</PropertyGroup>
<ItemGroup>
@@ -333,6 +333,14 @@
<Output TaskParameter="Dependencies" ItemName="_BlazorResolvedAssemblyUnlinked" />
</ResolveBlazorRuntimeDependencies>
+ <ItemGroup Condition="'$(BlazorWebAssemblyI18NAssemblies)' != 'none'">
+ <!--
+ Unless the user has asked for no-assemblies, copy all I18N assemblies to the build output.
+ We do not want to decipher the linker's format for passing in I18N options in our build targets
+ -->
+ <_BlazorResolvedAssemblyUnlinked Include="$(ComponentsWebAssemblyBaseClassLibraryPath)I18N*.dll" />
+ </ItemGroup>
+
<!--
Workaround for https://github.com/dotnet/aspnetcore/issues/19926. Using the files from their initial locations
as-is causes RazorSDK to remove files from a hosted app's publish directory. This is because files being removed
diff --git a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
index eea25e266c..aeb6c50982 100644
--- a/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
+++ b/src/Components/WebAssembly/Build/test/BuildIntegrationTests/BuildIntegrationTest.cs
@@ -276,6 +276,55 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.Contains("ja/standalone.resources.dll", satelliteResources["ja"].Keys);
}
+
+ [Fact]
+ public async Task Build_WithI8NOption_CopiesI8NAssembliesWithoutLinkerEnabled()
+ {
+ // Arrange
+ using var project = ProjectDirectory.Create("standalone", additionalProjects: new[] { "razorclasslibrary" });
+ project.Configuration = "Debug";
+ project.AddProjectFileContent(
+@"
+<PropertyGroup>
+ <BlazorWebAssemblyI18NAssemblies>other</BlazorWebAssemblyI18NAssemblies>
+</PropertyGroup>");
+
+ var result = await MSBuildProcessManager.DotnetMSBuild(project);
+
+ Assert.BuildPassed(result);
+
+ var buildOutputDirectory = project.BuildOutputDirectory;
+
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.Other.dll");
+ // When running without linker, we copy all I18N assemblies. Look for one additional
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.West.dll");
+ }
+
+ [Fact]
+ public async Task Build_WithI8NOption_CopiesI8NAssembliesWithLinkerEnabled()
+ {
+ // Arrange
+ using var project = ProjectDirectory.Create("standalone", additionalProjects: new[] { "razorclasslibrary" });
+ project.Configuration = "Debug";
+ project.AddProjectFileContent(
+@"
+<PropertyGroup>
+ <BlazorWebAssemblyEnableLinking>true</BlazorWebAssemblyEnableLinking>
+ <BlazorWebAssemblyI18NAssemblies>other</BlazorWebAssemblyI18NAssemblies>
+</PropertyGroup>");
+
+ var result = await MSBuildProcessManager.DotnetMSBuild(project);
+
+ Assert.BuildPassed(result);
+
+ var buildOutputDirectory = project.BuildOutputDirectory;
+
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.dll");
+ Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.Other.dll");
+ Assert.FileDoesNotExist(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "I18N.West.dll");
+ }
+
private static GenerateBlazorBootJson.BootJsonData ReadBootJsonData(MSBuildResult result, string path)
{
return JsonSerializer.Deserialize<GenerateBlazorBootJson.BootJsonData>(