Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] Add application environment to boot config #113164

Merged
merged 10 commits into from
Mar 10, 2025

Conversation

maraf
Copy link
Member

@maraf maraf commented Mar 5, 2025

  • Add MSBuild property to define application environment.
  • Prefer value defined by JavaScript API over the value in boot config.
  • Unrelated: Use unicode character in Wasm.Build.Tests path only on CI by default, because it complicates copy-pasting paths from terminal locally

Contributes to dotnet/aspnetcore#59456

@maraf maraf changed the title [browser] Read application environment during build & publish from MSBuild pro [browser] Add application environment to boot config Mar 6, 2025
@maraf maraf marked this pull request as ready for review March 10, 2025 11:25
@Copilot Copilot bot review requested due to automatic review settings March 10, 2025 11:25
@maraf maraf requested a review from javiercn March 10, 2025 11:25

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces functionality for defining and overriding the application environment across boot configuration, MSBuild, and JavaScript API. Key changes include adding a new MSBuild property and associated task changes, updating the JavaScript boot configuration loader to prefer the user-defined environment, and extending tests to cover the new behavior.

Reviewed Changes

File Description
src/mono/wasm/Wasm.Build.Tests/AppSettingsTests.cs Updates tests to validate environment selection based on publish/build and overrides from MSBuild/JavaScript.
src/mono/browser/runtime/loader/config.ts Updates boot config loading logic to prefer a user-defined application environment from the JavaScript API.
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs Adds the applicationEnvironment property to the boot config data.
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js Adjusts the call to set the application environment based on query parameters.
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/GenerateWasmBootJson.cs Integrates the new MSBuild ApplicationEnvironment property into the boot JSON generation.
src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTestsBase.cs Refactors the test asset copying method to better handle unicode path handling on local systems.
src/mono/wasm/testassets/WasmBasicTestApp/README.md Updates the referenced test assets path in the documentation.

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

@maraf
Copy link
Member Author

maraf commented Mar 10, 2025

/ba-g OutOfMemoryException is unrelated

@maraf maraf merged commit cc80345 into dotnet:main Mar 10, 2025
31 of 34 checks passed
@maraf maraf deleted the BrowserApplicationEnvironmentBuild branch March 10, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants