Skip to content

Commit

Permalink
[release/8.0][wasm] Use intended ports when running DevServer (#92906)
Browse files Browse the repository at this point in the history
* [wasm] Ignore empty `$ASPNETCORE_URLS`

* [wasm] DevServer: honor urls specified in the options

* [wasm] CI: Don't trigger non-wbt jobs on wasm-app-host changes

* CI: don't trigger wasm runtime tests on wasm-app-host changes

* [wasm] wasmbrowser - change the default webserver port to 0, to randomly select a port
  • Loading branch information
radical authored Oct 3, 2023
1 parent a7c9419 commit 0eeb6b2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions eng/pipelines/common/evaluate-default-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ jobs:
- src/mono/tools/*
- src/mono/wasi/*
- src/mono/wasm/debugger/*
- src/mono/wasm/host/*
- src/mono/wasm/Wasm.Build.Tests/*
- ${{ parameters._const_paths._wasm_pipelines }}
- ${{ parameters._const_paths._always_exclude }}
Expand All @@ -258,6 +259,7 @@ jobs:
- eng/testing/workloads-testing.targets
- src/mono/mono/component/mini-wasm-debugger.c
- src/mono/wasm/debugger/*
- src/mono/wasm/host/*
- src/mono/wasm/Wasm.Build.Tests/*
- src/mono/nuget/Microsoft.NET.Runtime*
src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/*
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/host/BrowserHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private async Task RunAsync(ILoggerFactory loggerFactory, CancellationToken toke
debugging: _args.CommonConfig.Debugging);
runArgsJson.Save(Path.Combine(_args.CommonConfig.AppPath, "runArgs.json"));

string[] urls = envVars.TryGetValue("ASPNETCORE_URLS", out string? aspnetUrls)
string[] urls = (envVars.TryGetValue("ASPNETCORE_URLS", out string? aspnetUrls) && aspnetUrls.Length > 0)
? aspnetUrls.Split(';', StringSplitOptions.RemoveEmptyEntries)
: new string[] { $"http://127.0.0.1:{_args.CommonConfig.HostProperties.WebServerPort}", "https://127.0.0.1:0" };

Expand Down
3 changes: 2 additions & 1 deletion src/mono/wasm/host/DevServer/DevServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ internal static class DevServer
services.AddSingleton(Options.Create(options));
services.AddSingleton(realUrlsAvailableTcs);
services.AddRouting();
});
})
.UseUrls(options.Urls);


IWebHost? host = builder.Build();
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/host/RuntimeConfigJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal sealed record WasmHostProperties(
int? FirefoxDebuggingPort,
int? ChromeProxyPort,
int? ChromeDebuggingPort,
int WebServerPort = 9000)
int WebServerPort = 0)
{
// using an explicit property because the deserializer doesn't like
// extension data in the record constructor
Expand Down

0 comments on commit 0eeb6b2

Please sign in to comment.