Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
<!-- Prevents the runtime SDK (Microsoft.NET.Sdk.WebAssembly.Browser.targets) from overriding
RunCommand/RunArguments with WasmAppHost when _UseBlazorDevServer is false. -->
<_WebAssemblyUserRunParameters>true</_WebAssemblyUserRunParameters>
<!-- Set RunCommand/RunArguments as static properties so they are visible to VS (F5/Ctrl+F5)
which reads properties directly without running the ComputeRunArguments target. -->
<_GatewayStaticWebAssetsManifest>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', 'staticwebassets.development.json'))</_GatewayStaticWebAssetsManifest>
<_GatewayEndpointsManifest>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)', 'staticwebassets.build.endpoints.json'))</_GatewayEndpointsManifest>
<RunCommand>dotnet</RunCommand>
<RunArguments>&quot;$(_BlazorGatewayDll)&quot; --environment Development --staticWebAssets &quot;$(_GatewayStaticWebAssetsManifest)&quot; --ClientApps:app:EndpointsManifest &quot;$(_GatewayEndpointsManifest)&quot; --ClientApps:app:PathPrefix &quot;&quot;</RunArguments>
</PropertyGroup>

<Target Name="_BlazorGatewayComputeRunArguments" AfterTargets="ComputeRunArguments" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
<PropertyGroup>
<RunCommand>dotnet</RunCommand>
<_GatewayStaticWebAssetsManifest>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(StaticWebAssetDevelopmentManifestPath)'))</_GatewayStaticWebAssetsManifest>
<_GatewayEndpointsManifest>$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(StaticWebAssetEndpointsBuildManifestPath)'))</_GatewayEndpointsManifest>
<RunArguments>&quot;$(_BlazorGatewayDll)&quot; --environment Development --staticWebAssets &quot;$(_GatewayStaticWebAssetsManifest)&quot; --ClientApps:app:EndpointsManifest &quot;$(_GatewayEndpointsManifest)&quot; --ClientApps:app:PathPrefix &quot;&quot;</RunArguments>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
(e.g., set it to the development build output in testassets/Directory.Build.props).
-->
<PropertyGroup>
<_E2ETasksAssembly Condition="'$(_E2ETasksAssembly)' == '' and Exists('$(MSBuildThisFileDirectory)tasks\netstandard2.0\Microsoft.AspNetCore.Components.Testing.Tasks.dll')">$(MSBuildThisFileDirectory)tasks\netstandard2.0\Microsoft.AspNetCore.Components.Testing.Tasks.dll</_E2ETasksAssembly>
<!-- NuGet package layout: buildTransitive/net10.0/ (MSBuildThisFileDirectory) → ../../tasks/ -->
<_E2ETasksAssembly Condition="'$(_E2ETasksAssembly)' == '' and Exists('$(MSBuildThisFileDirectory)../../tasks/netstandard2.0/Microsoft.AspNetCore.Components.Testing.Tasks.dll')">$(MSBuildThisFileDirectory)../../tasks/netstandard2.0/Microsoft.AspNetCore.Components.Testing.Tasks.dll</_E2ETasksAssembly>
</PropertyGroup>

<UsingTask
Expand Down Expand Up @@ -123,6 +124,11 @@
Targets="Publish"
Properties="PublishDir=$([System.IO.Path]::Combine('$(_E2EAppsOutputDir)', 'publish', '%(_E2EAppProjects.Filename)'))/;Configuration=$(Configuration)" />

<!-- Warn loudly if E2E app projects are declared but the task assembly is missing -->
<Warning
Text="E2E app project(s) found (@(_E2EAppProjects)) but the GenerateE2EManifest task assembly could not be located. The e2e-manifest.json will NOT be generated. Ensure the Microsoft.AspNetCore.Components.Testing package is correctly installed."
Condition="'@(_E2EAppProjects)' != '' and '$(_E2ETasksAssembly)' == ''" />

<!-- Generate manifest -->
<GenerateE2EManifest
AppItems="@(_E2EAppProjects)"
Expand Down
15 changes: 0 additions & 15 deletions src/Components/Testing/tasks/E2EManifestJsonContext.cs

This file was deleted.

16 changes: 9 additions & 7 deletions src/Components/Testing/tasks/E2EManifestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,32 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Runtime.Serialization;

namespace Microsoft.AspNetCore.Components.Testing.Tasks;

[DataContract]
internal class E2EManifestModel
{
[JsonPropertyName("apps")]
[DataMember(Name = "apps")]
public Dictionary<string, E2EAppEntryModel> Apps { get; set; } = new();
}

[DataContract]
internal class E2EAppEntryModel
{
[JsonPropertyName("executable")]
[DataMember(Name = "executable")]
public string Executable { get; set; } = "";

[JsonPropertyName("arguments")]
[DataMember(Name = "arguments")]
public string Arguments { get; set; } = "";

[JsonPropertyName("workingDirectory")]
[DataMember(Name = "workingDirectory")]
public string WorkingDirectory { get; set; } = "";

[JsonPropertyName("publicUrl")]
[DataMember(Name = "publicUrl")]
public string PublicUrl { get; set; } = "";

[JsonPropertyName("environmentVariables")]
[DataMember(Name = "environmentVariables")]
public Dictionary<string, string> EnvironmentVariables { get; set; } = new();
}
15 changes: 11 additions & 4 deletions src/Components/Testing/tasks/GenerateE2EManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
using System.Runtime.Serialization.Json;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

Expand Down Expand Up @@ -134,14 +135,20 @@ public override bool Execute()
}
}

var json = JsonSerializer.Serialize(manifest, E2EManifestJsonContext.Default.E2EManifestModel);

var manifestDir = Path.GetDirectoryName(ManifestPath);
if (!string.IsNullOrEmpty(manifestDir))
{
Directory.CreateDirectory(manifestDir);
}
File.WriteAllText(ManifestPath, json);

using var fileStream = File.Create(ManifestPath);
var serializer = new DataContractJsonSerializer(typeof(E2EManifestModel), new DataContractJsonSerializerSettings
{
UseSimpleDictionaryFormat = true,
});
using var writer = JsonReaderWriterFactory.CreateJsonWriter(fileStream, Encoding.UTF8, ownsStream: false, indent: true);
serializer.WriteObject(writer, manifest);

Log.LogMessage(MessageImportance.High, "Generated E2E manifest: {0}", ManifestPath);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<ItemGroup>
<Reference Include="Microsoft.Build.Utilities.Core" PrivateAssets="all" ExcludeAssets="runtime" />
<Reference Include="System.Text.Json" PrivateAssets="all" />
</ItemGroup>

</Project>
Loading