-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[wasm][coreclr] Add scripts to generate the helpers #124006
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
Merged
radekdoulik
merged 2 commits into
dotnet:main
from
radekdoulik:clr-wasm-generator-scripts
Feb 6, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| @echo off | ||
| setlocal enabledelayedexpansion | ||
|
|
||
| :: Default configuration | ||
| set "configuration=Debug" | ||
| set "scan_path_override=" | ||
|
|
||
| set "usage=Usage: %~nx0 [options]" | ||
| set "usage=!usage!^ | ||
|
|
||
| ^ | ||
|
|
||
| Options:^ | ||
|
|
||
| -c, --configuration ^<Checked^|Debug^|Release^> Build configuration (default: Debug)^ | ||
|
|
||
| -s, --scan-path ^<path^> Override the default scan path^ | ||
|
|
||
| -h, --help Show this help message" | ||
|
|
||
| :parse_args | ||
| if "%~1"=="" goto :done_args | ||
| if /i "%~1"=="-c" goto :set_configuration | ||
| if /i "%~1"=="--configuration" goto :set_configuration | ||
| if /i "%~1"=="-s" goto :set_scan_path | ||
| if /i "%~1"=="--scan-path" goto :set_scan_path | ||
| if /i "%~1"=="-h" goto :show_help | ||
| if /i "%~1"=="--help" goto :show_help | ||
|
|
||
| echo Unknown option: %~1 | ||
| echo !usage! | ||
| exit /b 1 | ||
|
|
||
| :set_configuration | ||
| set "configuration=%~2" | ||
| shift | ||
| shift | ||
| goto :parse_args | ||
|
|
||
| :set_scan_path | ||
| set "scan_path_override=%~2" | ||
| shift | ||
| shift | ||
| goto :parse_args | ||
|
|
||
| :show_help | ||
| echo !usage! | ||
| exit /b 0 | ||
|
|
||
| :done_args | ||
|
|
||
| :: Validate configuration to prevent injection | ||
| if /i not "%configuration%"=="Debug" if /i not "%configuration%"=="Release" if /i not "%configuration%"=="Checked" ( | ||
| echo Error: Invalid configuration "%configuration%". Must be Debug, Release, or Checked. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| :: Get the repo root (script is in src/tasks/WasmAppBuilder) | ||
| set "script_dir=%~dp0" | ||
| pushd "%script_dir%..\..\..\" | ||
| set "repo_root=%CD%" | ||
| popd | ||
|
|
||
| echo Configuration: %configuration% | ||
| echo Repo root: %repo_root% | ||
|
|
||
| if not "%scan_path_override%"=="" ( | ||
| set "scan_path=%scan_path_override%" | ||
| ) else ( | ||
| set "scan_path=%repo_root%\artifacts\bin\testhost\net11.0-browser-%configuration%-wasm\shared\Microsoft.NETCore.App\11.0.0\" | ||
| ) | ||
|
|
||
| if not exist "%scan_path%" ( | ||
| echo Error: Scan path does not exist: %scan_path% | ||
| echo Please build the runtime first using: .\build.cmd clr+libs -os browser -c %configuration% | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| cd /d "%repo_root%" | ||
| echo Scan path: %scan_path% | ||
|
|
||
| :: Run the generator - invoke directly without building a command string | ||
| echo Running generator... | ||
| echo .\dotnet.cmd build /t:RunGenerator /p:RuntimeFlavor=CoreCLR "/p:GeneratorOutputPath=%repo_root%\src\coreclr\vm\wasm\" "/p:AssembliesScanPath=%scan_path%" src\tasks\WasmAppBuilder\WasmAppBuilder.csproj | ||
| .\dotnet.cmd build /t:RunGenerator /p:RuntimeFlavor=CoreCLR "/p:GeneratorOutputPath=%repo_root%\src\coreclr\vm\wasm\" "/p:AssembliesScanPath=%scan_path%" src\tasks\WasmAppBuilder\WasmAppBuilder.csproj | ||
|
|
||
| if errorlevel 1 ( | ||
| echo Generator failed! | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| echo Done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Default configuration | ||
| configuration="Debug" | ||
| scan_path_override="" | ||
|
|
||
| usage="Usage: $0 [options] | ||
|
|
||
| Options: | ||
| -c, --configuration <Checked|Debug|Release> Build configuration (default: Debug) | ||
| -s, --scan-path <path> Override the default scan path | ||
| -h, --help Show this help message" | ||
|
|
||
| # Parse arguments | ||
| while [[ $# -gt 0 ]]; do | ||
| case "$1" in | ||
| -c|--configuration) | ||
| configuration="$2" | ||
| shift 2 | ||
| ;; | ||
| -s|--scan-path) | ||
| scan_path_override="$2" | ||
| shift 2 | ||
| ;; | ||
| -h|--help) | ||
| echo "$usage" | ||
| exit 0 | ||
| ;; | ||
| *) | ||
| echo "Unknown option: $1" | ||
| echo "$usage" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| # Validate configuration to prevent injection (case-insensitive) | ||
| config_lower="$(echo "$configuration" | tr '[:upper:]' '[:lower:]')" | ||
| case "$config_lower" in | ||
| debug|release|checked) | ||
| ;; | ||
| *) | ||
| echo "Error: Invalid configuration \"$configuration\". Must be Debug, Release, or Checked." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Get the repo root (script is in src/tasks/WasmAppBuilder) | ||
| script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| repo_root="$(cd "$script_dir/../../.." && pwd)" | ||
|
|
||
| echo "Configuration: $configuration" | ||
| echo "Repo root: $repo_root" | ||
|
|
||
| if [[ -n "$scan_path_override" ]]; then | ||
| scan_path="$scan_path_override" | ||
| else | ||
| scan_path="$repo_root/artifacts/bin/testhost/net11.0-browser-$configuration-wasm/shared/Microsoft.NETCore.App/11.0.0/" | ||
| fi | ||
|
|
||
| if [[ ! -d "$scan_path" ]]; then | ||
| echo "Error: Scan path does not exist: $scan_path" | ||
| echo "Please build the runtime first using: ./build.sh clr+libs -os browser -c $configuration" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd "$repo_root" | ||
| echo "Scan path: $scan_path" | ||
|
|
||
| # Run the generator - invoke directly without building a command string | ||
| echo "Running generator..." | ||
| echo "./dotnet.sh build /t:RunGenerator /p:RuntimeFlavor=CoreCLR /p:GeneratorOutputPath=$repo_root/src/coreclr/vm/wasm/ /p:AssembliesScanPath=$scan_path src/tasks/WasmAppBuilder/WasmAppBuilder.csproj" | ||
| ./dotnet.sh build /t:RunGenerator /p:RuntimeFlavor=CoreCLR "/p:GeneratorOutputPath=$repo_root/src/coreclr/vm/wasm/" "/p:AssembliesScanPath=$scan_path" src/tasks/WasmAppBuilder/WasmAppBuilder.csproj | ||
|
|
||
| echo "Done!" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.