[Codespaces] Make it possible to run wasm samples in the browser (#64277)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Thu, 27 Jan 2022 02:00:00 +0000 (21:00 -0500)
committerGitHub <noreply@github.com>
Thu, 27 Jan 2022 02:00:00 +0000 (21:00 -0500)
commit5a9bcde1d52b8b5a6c7b70883704bcb349c54c12
tree1ef8c5694b18efec438a058121265aab95d8d5ca
parent5f72148e033b887ede8436fcdefdbec6cda83190
[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>
.devcontainer/devcontainer.json
.devcontainer/scripts/onCreateCommand.sh
.gitignore
src/mono/sample/wasm/wasm.mk