mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 09:34:49 +09:00
[Codespaces] Make it possible to run wasm samples in the browser (#64277)
With these changes, running the following in the Codespace will open the local browser to a page served from the codespace hosting the WASM sample: ```console cd src/mono/sample/wasm/browser make make run-browser ``` * Set EMSDK_PATH in .devcontainer.json We provision Emscripten as part of the devcontainer prebuild. Set EMSDK_PATH to allow rebuilding the wasm runtime to work without any additional ceremony * Install dotnet-serve into .dotnet-tools-global * [wasm] Don't try to open browser if running in Codespaces * .devcontainer: add global tools dir to PATH * .devcontainer: forward port 8000 This enables running the mono wasm samples in the local browser: * [wasm] samples: also check for dotnet-serve on the path On Codespaces we install dotnet-serve on the PATH but not where `dotnet tool list` can see it * remove onAutoForward: notify - it's the default * Adjust the path of v8 depends if running in a dev container * Check if we're running in any Docker container, not just Codespaces Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
This commit is contained in:
parent
5f72148e03
commit
5a9bcde1d5
4 changed files with 31 additions and 7 deletions
|
@ -4,7 +4,7 @@
|
|||
"name": "C# (.NET)",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"args": {
|
||||
// Update 'VARIANT' to pick a .NET Core version: 2.1, 3.1, 5.0
|
||||
"VARIANT": "5.0",
|
||||
}
|
||||
|
@ -32,11 +32,22 @@
|
|||
|
||||
// Add the locally installed dotnet to the path to ensure that it is activated
|
||||
// This allows developers to just use 'dotnet build' on the command-line, and the local dotnet version will be used.
|
||||
// Add the global tools dir to the PATH so that globally installed tools will work
|
||||
"remoteEnv": {
|
||||
"PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}",
|
||||
"DOTNET_MULTILEVEL_LOOKUP": "0"
|
||||
"PATH": "${containerWorkspaceFolder}/.dotnet:${containerWorkspaceFolder}/.dotnet-tools-global:${containerEnv:PATH}",
|
||||
"DOTNET_MULTILEVEL_LOOKUP": "0",
|
||||
// Path to provisioned Emscripten SDK, for rebuilding the wasm runtime
|
||||
"EMSDK_PATH": "${containerWorkspaceFolder}/src/mono/wasm/emsdk",
|
||||
},
|
||||
|
||||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode"
|
||||
"remoteUser": "vscode",
|
||||
|
||||
// Forward mono samples port
|
||||
"forwardPorts": [8000],
|
||||
"portsAttributes": {
|
||||
"8000": {
|
||||
"label": "mono wasm samples (8000)",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,5 +12,8 @@ make -C src/mono/wasm provision-wasm
|
|||
export EMSDK_PATH=$PWD/src/mono/wasm/emsdk
|
||||
./build.sh mono+libs -os Browser -c release
|
||||
|
||||
# install dotnet-serve for running wasm samples
|
||||
./dotnet.sh tool install dotnet-serve --tool-path ./.dotnet-tools-global
|
||||
|
||||
# save the commit hash of the currently built assemblies, so developers know which version was built
|
||||
git rev-parse HEAD > ./artifacts/prebuild.sha
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue