React to dotnet.js having a version number (#19603)
This commit is contained in:
parent
a4cca735ce
commit
b02978e0d8
|
|
@ -121,34 +121,14 @@
|
|||
</_BlazorOutputWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
TODO: Instead of dynamically switching the TargetOutputPath for dotnet.js here, actually
|
||||
change the physical filename inside the M.A.C.W.Runtime package so it includes the package's
|
||||
version (e.g., dotnet.3.2.0-preview3.12345.js). Then we can eliminate the following property
|
||||
and recombine the two item groups _DotNetWasmRuntimeFile and _DotNetWasmJsFile below, simply putting all of
|
||||
$(ComponentsWebAssemblyRuntimePath)* into _BlazorOutputWithTargetPath using their physical names.
|
||||
|
||||
The actual value 3.2.0-preview2 is hardcoded here until we update M.A.C.W.Runtime to do this.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<TemporaryDotNetJsFileVersion>3.2.0-preview2</TemporaryDotNetJsFileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_DotNetWasmRuntimeFile Include="$(ComponentsWebAssemblyRuntimePath)*.wasm" />
|
||||
<_DotNetWasmRuntimeFile Include="$(ComponentsWebAssemblyRuntimePath)*" />
|
||||
<_BlazorOutputWithTargetPath Include="@(_DotNetWasmRuntimeFile)">
|
||||
<TargetOutputPath>$(_BlazorRuntimeWasmOutputPath)%(FileName)%(Extension)</TargetOutputPath>
|
||||
<BootManifestResourceType>runtime</BootManifestResourceType>
|
||||
<BootManifestResourceName>%(FileName)%(Extension)</BootManifestResourceName>
|
||||
</_BlazorOutputWithTargetPath>
|
||||
|
||||
<_DotNetWasmJsFile Include="$(ComponentsWebAssemblyRuntimePath)*.js" />
|
||||
<_BlazorOutputWithTargetPath Include="@(_DotNetWasmJsFile)">
|
||||
<TargetOutputPath>$(_BlazorRuntimeWasmOutputPath)%(FileName).$(TemporaryDotNetJsFileVersion)%(Extension)</TargetOutputPath>
|
||||
<BootManifestResourceType>runtime</BootManifestResourceType>
|
||||
<BootManifestResourceName>%(FileName).$(TemporaryDotNetJsFileVersion)%(Extension)</BootManifestResourceName>
|
||||
</_BlazorOutputWithTargetPath>
|
||||
|
||||
<_BlazorJSFile Include="$(_BlazorJSPath)" />
|
||||
<_BlazorJSFile Include="$(_BlazorJSMapPath)" Condition="Exists('$(_BlazorJSMapPath)')" />
|
||||
<_BlazorOutputWithTargetPath Include="@(_BlazorJSFile)">
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using static Microsoft.AspNetCore.Components.WebAssembly.Build.WebAssemblyRuntimePackage;
|
||||
|
||||
namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
||||
{
|
||||
|
|
@ -23,7 +24,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(buildOutputDirectory, "wwwroot", "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(buildOutputDirectory, "wwwroot", "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, buildOutputDirectory, "wwwroot", "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using static Microsoft.AspNetCore.Components.WebAssembly.Build.WebAssemblyRuntimePackage;
|
||||
|
||||
namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
||||
{
|
||||
|
|
@ -24,7 +25,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -64,7 +65,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -164,7 +165,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -208,7 +209,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
@ -254,7 +255,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
|||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.webassembly.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", "dotnet.wasm");
|
||||
Assert.FileCountEquals(result, 1, Path.Combine(blazorPublishDirectory, "_framework", "wasm"), "dotnet.*.js");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "wasm", DotNetJsFileName);
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "standalone.dll");
|
||||
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Microsoft.AspNetCore.Components.WebAssembly.Build
|
||||
{
|
||||
internal static class WebAssemblyRuntimePackage
|
||||
{
|
||||
public static readonly string ComponentsWebAssemblyRuntimePackageVersion;
|
||||
public static readonly string DotNetJsFileName;
|
||||
|
||||
static WebAssemblyRuntimePackage()
|
||||
{
|
||||
ComponentsWebAssemblyRuntimePackageVersion = typeof(WebAssemblyRuntimePackage)
|
||||
.Assembly
|
||||
.GetCustomAttributes<AssemblyMetadataAttribute>()
|
||||
.FirstOrDefault(f => f.Key == "Testing.MicrosoftAspNetCoreComponentsWebAssemblyRuntimePackageVersion")
|
||||
?.Value
|
||||
?? throw new InvalidOperationException("Testing.MicrosoftAspNetCoreComponentsWebAssemblyRuntimePackageVersion was not found");
|
||||
|
||||
DotNetJsFileName = $"dotnet.{ComponentsWebAssemblyRuntimePackageVersion}.js";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||
|
|
@ -39,6 +39,11 @@
|
|||
<_Parameter1>Testing.RepoRoot</_Parameter1>
|
||||
<_Parameter2>$(RepoRoot)</_Parameter2>
|
||||
</AssemblyAttribute>
|
||||
|
||||
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
|
||||
<_Parameter1>Testing.MicrosoftAspNetCoreComponentsWebAssemblyRuntimePackageVersion</_Parameter1>
|
||||
<_Parameter2>$(MicrosoftAspNetCoreComponentsWebAssemblyRuntimePackageVersion)</_Parameter2>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="RestoreTestAssets" AfterTargets="Restore;Build" Condition="'$(DotNetBuildFromSource)' != 'true'">
|
||||
|
|
|
|||
Loading…
Reference in New Issue