mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-09 09:34:49 +09:00
[wasm] Extract src/mono/browser
from src/mono/wasm
(#95940)
* [wasm] Extract src/mono/browser from src/mono/wasm, and update to track changes * [wasm] Makefile - update to remove some unrelated targets * [wasm] Rename wasm.proj to browser.proj - feedback from @ maraf * Add the renamed browser.proj * address review feedback from @ maraf * review feedback from @ pavelsavara * address review feedback from @ maraf
This commit is contained in:
parent
c282395b63
commit
a36a860f74
384 changed files with 464 additions and 241 deletions
|
@ -15,7 +15,7 @@ case "$opt" in
|
|||
wasm)
|
||||
# prebuild for WASM, so it is ready for wasm development
|
||||
make -C src/mono/wasm provision-wasm
|
||||
export EMSDK_PATH=$PWD/src/mono/wasm/emsdk
|
||||
export EMSDK_PATH=$PWD/src/mono/browser/emsdk
|
||||
./build.sh mono+libs -os browser -c Release
|
||||
|
||||
# install dotnet-serve for running wasm samples
|
||||
|
|
|
@ -152,6 +152,9 @@
|
|||
<IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
|
||||
<MibcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'mibc'))</MibcOptimizationDataDir>
|
||||
<DocsDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'docs'))</DocsDir>
|
||||
<BrowserProjectRoot>$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'browser'))</BrowserProjectRoot>
|
||||
<WasmProjectRoot>$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm'))</WasmProjectRoot>
|
||||
<WasiProjectRoot>$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasi'))</WasiProjectRoot>
|
||||
|
||||
<AppleAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AppleAppBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)'))</AppleAppBuilderDir>
|
||||
<AndroidAppBuilderDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'AndroidAppBuilder', '$(TasksConfiguration)', '$(NetCoreAppToolCurrent)', 'publish'))</AndroidAppBuilderDir>
|
||||
|
@ -183,7 +186,7 @@
|
|||
<WasmtimeDir Condition="'$(WasmtimeDir)' == '' and '$(WASMTIME_PATH)' != '' and Exists($(WASMTIME_PATH))">$(WASMTIME_PATH)</WasmtimeDir>
|
||||
<WasmtimeDir Condition="'$(WasmtimeDir)' == ''">$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
|
||||
<InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
|
||||
<WasmCommonTargetsPath>$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'build'))</WasmCommonTargetsPath>
|
||||
<WasmCommonTargetsPath>$([MSBuild]::NormalizeDirectory($(WasmProjectRoot), 'build'))</WasmCommonTargetsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="CalculatePortableBuild">
|
||||
|
|
|
@ -473,11 +473,11 @@
|
|||
|
||||
<ItemGroup Condition="$(_subset.Contains('+mono.wasmruntime+'))">
|
||||
<ProjectToBuild Include="$(LibrariesProjectRoot)\System.Runtime.InteropServices.JavaScript\src\System.Runtime.InteropServices.JavaScript.csproj" Category="mono" />
|
||||
<ProjectToBuild Include="$(MonoProjectRoot)wasm\wasm.proj" Category="mono" />
|
||||
<ProjectToBuild Include="$(BrowserProjectRoot)browser.proj" Category="mono" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(_subset.Contains('+mono.wasiruntime+'))">
|
||||
<ProjectToBuild Include="$(MonoProjectRoot)wasi\wasi.proj" Category="mono" />
|
||||
<ProjectToBuild Include="$(WasiProjectRoot)wasi.proj" Category="mono" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$(_subset.Contains('+libs.pretest+'))">
|
||||
|
|
|
@ -45,12 +45,12 @@ if /i "%__Arch%" == "wasm" (
|
|||
)
|
||||
if /i "%__Os%" == "browser" (
|
||||
if "%EMSDK_PATH%" == "" (
|
||||
if not exist "%__repoRoot%\src\mono\wasm\emsdk" (
|
||||
if not exist "%__repoRoot%\src\mono\browser\emsdk" (
|
||||
echo Error: Should set EMSDK_PATH environment variable pointing to emsdk root.
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set "EMSDK_PATH=%__repoRoot%\src\mono\wasm\emsdk"
|
||||
set "EMSDK_PATH=%__repoRoot%\src\mono\browser\emsdk"
|
||||
)
|
||||
:: replace backslash with forward slash and append last slash
|
||||
set "EMSDK_PATH=!EMSDK_PATH:\=/!"
|
||||
|
|
|
@ -10,6 +10,7 @@ parameters:
|
|||
eng/testing/ChromeVersions.props
|
||||
eng/testing/WasmRunner*
|
||||
eng/testing/WasiRunner*
|
||||
eng/testing/scenarios/BuildWasiAppsJobsList.txt
|
||||
eng/testing/scenarios/BuildWasmAppsJobsList.txt
|
||||
eng/testing/tests.browser.targets
|
||||
eng/testing/tests.was*.targets
|
||||
|
@ -26,6 +27,7 @@ parameters:
|
|||
src/mono/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/*
|
||||
src/mono/nuget/Microsoft.NET.Workload*
|
||||
src/mono/sample/wasm/*
|
||||
src/mono/browser/*
|
||||
src/mono/wasi/*
|
||||
src/mono/wasm/*
|
||||
src/mono/mono/mini/interp/jiterpreter*
|
||||
|
@ -203,6 +205,7 @@ jobs:
|
|||
include:
|
||||
- eng/Version.Details.xml
|
||||
- eng/Versions.props
|
||||
- eng/testing/scenarios/BuildWasiAppsJobsList.txt
|
||||
- eng/testing/scenarios/BuildWasmAppsJobsList.txt
|
||||
- eng/testing/tests.browser.targets
|
||||
- eng/testing/tests.was*.targets
|
||||
|
@ -223,10 +226,11 @@ jobs:
|
|||
- src/mono/nuget/Microsoft.NET.Runtime.wasm.Sample.Mono/*
|
||||
- src/mono/nuget/Microsoft.NET.Workload*
|
||||
- src/mono/nuget/Microsoft.NETCore.BrowserDebugHost.Transport/*
|
||||
- src/mono/browser/build/*
|
||||
- src/mono/browser/emscripten-version.txt
|
||||
- src/mono/browser/runtime/*
|
||||
- src/mono/wasm/build/*
|
||||
- src/mono/wasm/emscripten-version.txt
|
||||
- src/mono/wasm/host/*
|
||||
- src/mono/wasm/runtime/*
|
||||
- src/mono/wasm/templates/*
|
||||
- src/mono/wasm/testassets/*
|
||||
- src/mono/wasm/Wasm.Build.Tests/*
|
||||
|
@ -249,8 +253,8 @@ jobs:
|
|||
- src/libraries/System.Runtime.InteropServices/*
|
||||
- src/libraries/System.Runtime.InteropServices.JavaScript/*
|
||||
- src/mono/mono/*
|
||||
- src/mono/wasm/debugger/*
|
||||
- src/mono/wasm/runtime/*
|
||||
- src/mono/browser/debugger/*
|
||||
- src/mono/browser/runtime/*
|
||||
- ${{ parameters._const_paths._wasm_src_native }}
|
||||
- ${{ parameters._const_paths._wasm_pipelines }}
|
||||
exclude:
|
||||
|
@ -289,10 +293,11 @@ jobs:
|
|||
# other paths that should also trigger wasm jobs
|
||||
- src/mono/*
|
||||
exclude:
|
||||
- eng/testing/scenarios/BuildWasiAppsJobsList.txt
|
||||
- eng/testing/scenarios/BuildWasmAppsJobsList.txt
|
||||
- eng/testing/workloads-testing.targets
|
||||
- src/mono/mono/component/mini-wasm-debugger.c
|
||||
- src/mono/wasm/debugger/*
|
||||
- src/mono/browser/debugger/*
|
||||
- src/mono/wasm/host/*
|
||||
- src/mono/wasm/templates/*
|
||||
- src/mono/wasm/testassets/*
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
<!-- wasm specific -->
|
||||
<MonoAOTCompilerDir>{MonoAOTCompilerDir}</MonoAOTCompilerDir>
|
||||
<MonoProjectRoot>{MonoProjectRoot}</MonoProjectRoot>
|
||||
<BrowserProjectRoot>{BrowserProjectRoot}</BrowserProjectRoot>
|
||||
<WasmProjectRoot>{WasmProjectRoot}</WasmProjectRoot>
|
||||
<WasiProjectRoot>{WasiProjectRoot}</WasiProjectRoot>
|
||||
<MonoAOTCompilerTasksAssemblyPath>{MonoAOTCompilerTasksAssemblyPath}</MonoAOTCompilerTasksAssemblyPath>
|
||||
<WasmAppBuilderTasksAssemblyPath>{WasmAppBuilderTasksAssemblyPath}</WasmAppBuilderTasksAssemblyPath>
|
||||
<MonoTargetsTasksAssemblyPath>{MonoTargetsTasksAssemblyPath}</MonoTargetsTasksAssemblyPath>
|
||||
|
|
|
@ -103,6 +103,9 @@
|
|||
.Replace('{RepositoryEngineeringDir}', '$(RepositoryEngineeringDir)')
|
||||
.Replace('{MonoAOTCompilerDir}', '$(MonoAOTCompilerDir)')
|
||||
.Replace('{MonoProjectRoot}', '$(MonoProjectRoot)')
|
||||
.Replace('{BrowserProjectRoot}', '$(BrowserProjectRoot)')
|
||||
.Replace('{WasmProjectRoot}', '$(WasmProjectRoot)')
|
||||
.Replace('{WasiProjectRoot}', '$(WasiProjectRoot)')
|
||||
.Replace('{MonoAOTCompilerTasksAssemblyPath}', '$(MonoAOTCompilerTasksAssemblyPath)')
|
||||
.Replace('{MonoTargetsTasksAssemblyPath}', '$(MonoTargetsTasksAssemblyPath)')
|
||||
.Replace('{WasmAppBuilderTasksAssemblyPath}', '$(WasmAppBuilderTasksAssemblyPath)')
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<IsBrowserWasmProject Condition="'$(IsBrowserWasmProject)' == ''">true</IsBrowserWasmProject>
|
||||
|
||||
<!-- set this when provisioning emsdk on CI -->
|
||||
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>
|
||||
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(BrowserProjectRoot), 'emsdk'))</EMSDK_PATH>
|
||||
|
||||
<!--
|
||||
- For regular library tests, it will use the symbols file from the runtime pack.
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
So, set those parameters explicitly here.
|
||||
-->
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MonoProjectRoot)\wasm\build\ILLink.Substitutions.LegacyJsInterop.xml"</_ExtraTrimmerArgs>
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableLegacyJsInterop)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.LegacyJsInterop.xml"</_ExtraTrimmerArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
@ -150,9 +150,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<!-- Don't include InTree.props here, because the test projects themselves can set the target* properties -->
|
||||
<Import Project="$(MonoProjectRoot)\wasm\build\BrowserWasmApp.props"
|
||||
<Import Project="$(BrowserProjectRoot)build\BrowserWasmApp.props"
|
||||
Condition="'$(BuildAOTTestsOn)' == 'local'" />
|
||||
<Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets"
|
||||
<Import Project="$(BrowserProjectRoot)build\WasmApp.InTree.targets"
|
||||
Condition="'$(BuildAOTTestsOn)' == 'local'" />
|
||||
|
||||
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
|
||||
|
|
|
@ -73,9 +73,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<!-- Don't include InTree.props here, because the test projects themselves can set the target* properties -->
|
||||
<Import Project="$(MonoProjectRoot)\wasi\build\WasiApp.props"
|
||||
<Import Project="$(WasiProjectRoot)build\WasiApp.props"
|
||||
Condition="'$(BuildAOTTestsOn)' == 'local'" />
|
||||
<Import Project="$(MonoProjectRoot)\wasi\build\WasiApp.InTree.targets"
|
||||
<Import Project="$(WasiProjectRoot)build\WasiApp.InTree.targets"
|
||||
Condition="'$(BuildAOTTestsOn)' == 'local'" />
|
||||
|
||||
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
|
||||
<PropertyGroup>
|
||||
<IsWasmProject Condition="'$(IsWasmProject)' == ''">true</IsWasmProject>
|
||||
<WasmSharedPath>$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'shared'))</WasmSharedPath>
|
||||
<WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle>
|
||||
<ArchiveTests Condition="'$(WasmBuildingForNestedPublish)' == 'true'">false</ArchiveTests>
|
||||
<BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets>
|
||||
|
@ -34,6 +33,9 @@
|
|||
<XUnitUseRandomizedTestOrderer Condition="'$(XUnitUseRandomizedTestOrderer)' == '' and '$(IsTestProject)' == 'true'">true</XUnitUseRandomizedTestOrderer>
|
||||
<WasmXHarnessTestsTimeout Condition="'$(WasmXHarnessTestsTimeout)' == ''">00:30:00</WasmXHarnessTestsTimeout>
|
||||
<RunWorkingDirectory>$(BundleDir)</RunWorkingDirectory>
|
||||
|
||||
<WasmCommonTargetsPath Condition="Exists('$(MSBuildThisFileDirectory)WasmApp.Common.props')">$(MSBuildThisFileDirectory)</WasmCommonTargetsPath>
|
||||
<WasmCommonTargetsPath Condition="'$(WasmCommonTargetsPath)' == ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'build'))</WasmCommonTargetsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(EnableAggressiveTrimming)' == 'true'">
|
||||
|
@ -62,8 +64,8 @@
|
|||
|
||||
So, set those parameters explicitly here.
|
||||
-->
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MonoProjectRoot)\wasm\build\ILLink.Substitutions.WasmIntrinsics.xml"</_ExtraTrimmerArgs>
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(MonoProjectRoot)\wasm\build\ILLink.Substitutions.NoWasmIntrinsics.xml"</_ExtraTrimmerArgs>
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'true' and '$(RunAOTCompilation)' == 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.WasmIntrinsics.xml"</_ExtraTrimmerArgs>
|
||||
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'true'">$(_ExtraTrimmerArgs) --substitutions "$(BrowserProjectRoot)build\ILLink.Substitutions.NoWasmIntrinsics.xml"</_ExtraTrimmerArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -108,9 +110,9 @@
|
|||
<BundleFiles Include="@(WasmAssembliesToBundle)" TargetDir="publish\%(WasmAssembliesToBundle.RecursiveDir)" />
|
||||
<BundleFiles Include="$(RuntimeConfigFilePath)" TargetDir="publish" />
|
||||
|
||||
<BundleFiles Include="$(WasmSharedPath)data\aot-tests\*" TargetDir="publish" />
|
||||
<BundleFiles Include="$(WasmProjectRoot)data\aot-tests\*" TargetDir="publish" />
|
||||
<!-- FIXME: what would be the correct place to do this? -->
|
||||
<BundleFiles Include="$(MonoProjectRoot)src\mono\wasm\build\WasmApp.Common*" TargetDir="publish" />
|
||||
<BundleFiles Include="$(WasmProjectRoot)build\WasmApp.Common*" TargetDir="publish" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(DebuggerSupport)' == 'true'">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<_WasmtimeVersionFile>$(MonoProjectRoot)wasi/wasmtime-version.txt</_WasmtimeVersionFile>
|
||||
<_WasmtimeVersionFile>$(WasiProjectRoot)wasmtime-version.txt</_WasmtimeVersionFile>
|
||||
<_WasmtimeStampPath>$(WasmtimeDir)\.stamp-wasmtime-version.txt</_WasmtimeStampPath>
|
||||
<InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
|
||||
</PropertyGroup>
|
||||
|
@ -30,6 +30,6 @@
|
|||
<MakeDir Directories="$(WasmtimeDir)" />
|
||||
<Exec Command="powershell -command "Expand-Archive $(_DownloadedFile) . ; Move-Item wasmtime-v$(WasmtimeVersion)-x86_64-windows/*.* . "" WorkingDirectory="$(WasmtimeDir)" Condition="'$(HostOS)' == 'windows'"/>
|
||||
<Exec Command="tar -Jx --strip-components=1 -f $(_DownloadedFile)" WorkingDirectory="$(WasmtimeDir)" Condition="'$(HostOS)' != 'windows'"/>
|
||||
<Copy SourceFiles="$(MonoProjectRoot)wasi/wasmtime-version.txt" DestinationFiles="$(_WasmtimeStampPath)" SkipUnchangedFiles="true" />
|
||||
<Copy SourceFiles="$(WasiProjectRoot)wasmtime-version.txt" DestinationFiles="$(_WasmtimeStampPath)" SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
<Import Project="$(MSBuildThisFileDirectory)sendtohelix-wasm.targets" />
|
||||
|
||||
<PropertyGroup>
|
||||
<WasmBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'build'))</WasmBuildTargetsDir>
|
||||
<WasmSharedDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'shared'))</WasmSharedDir>
|
||||
<_ShippingPackagesPath>$([MSBuild]::NormalizeDirectory($(ArtifactsDir), 'packages', $(Configuration), 'Shipping'))</_ShippingPackagesPath>
|
||||
<WorkItemPrefix Condition="'$(WorkItemPrefix)' == '' and '$(Scenario)' != ''">$(Scenario)-</WorkItemPrefix>
|
||||
|
||||
|
@ -51,7 +49,7 @@
|
|||
<EnableDefaultBuildHelixWorkItems>false</EnableDefaultBuildHelixWorkItems>
|
||||
|
||||
<!-- on unix CI has emscripten provisioned in $(EMSDK_PATH) as `/usr/local/emscripten`. -->
|
||||
<EMSDK_PATH Condition="$([MSBuild]::IsOSPlatform('WINDOWS')) and '$(EMSDK_PATH)' == ''">$(RepoRoot)src\mono\wasm\emsdk\</EMSDK_PATH>
|
||||
<EMSDK_PATH Condition="$([MSBuild]::IsOSPlatform('WINDOWS')) and '$(EMSDK_PATH)' == ''">$(RepoRoot)src\mono\browser\emsdk\</EMSDK_PATH>
|
||||
<EmSdkDirForHelixPayload>$(HelixDependenciesStagingPath)\emsdk</EmSdkDirForHelixPayload>
|
||||
<DebuggerHost Condition="'$(DebuggerHost)' == ''">chrome</DebuggerHost>
|
||||
|
||||
|
@ -203,8 +201,8 @@
|
|||
<HelixCorrelationPayload Include="$(WasmAppBuilderDir)" Destination="build/WasmAppBuilder" />
|
||||
<HelixCorrelationPayload Include="$(MonoAOTCompilerDir)" Destination="build/MonoAOTCompiler" />
|
||||
<HelixCorrelationPayload Include="$(MicrosoftNetCoreAppRuntimePackDir)" Destination="build/microsoft.netcore.app.runtime.browser-wasm" />
|
||||
<HelixCorrelationPayload Include="$(WasmBuildTargetsDir)" Destination="build/wasm" />
|
||||
<HelixCorrelationPayload Include="$(WasmSharedDir)" Destination="build/wasm-shared" />
|
||||
<HelixCorrelationPayload Include="$(BrowserBuildTargetsDir)" Destination="build/wasm" />
|
||||
<HelixCorrelationPayload Include="$(WasmBuildTargetsDir)" Destination="build/wasm-shared" />
|
||||
<HelixCorrelationPayload Include="$(MonoAotCrossDir)" Destination="build/cross" />
|
||||
<HelixCorrelationPayload Include="$(MonoTargetsTasksDir)" Destination="build/MonoTargetsTasks" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
|
||||
<WASI_SDK_PATH Condition="'$(WASI_SDK_PATH)' == ''">$(RepoRoot)src\mono\wasi\wasi-sdk\</WASI_SDK_PATH>
|
||||
<WasiBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasi', 'build'))</WasiBuildTargetsDir>
|
||||
<WasmBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'build'))</WasmBuildTargetsDir>
|
||||
<WasmSharedDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'shared'))</WasmSharedDir>
|
||||
<WasiSdkDirForHelixPayload>$(HelixDependenciesStagingPath)\wasi-sdk</WasiSdkDirForHelixPayload>
|
||||
<WasmtimeDirForHelixPayload>$(HelixDependenciesStagingPath)\wasmtime</WasmtimeDirForHelixPayload>
|
||||
|
||||
|
@ -113,7 +111,7 @@
|
|||
<HelixCorrelationPayload Include="$(MicrosoftNetCoreAppRuntimePackDir)" Destination="build/microsoft.netcore.app.runtime.wasi-wasm" />
|
||||
|
||||
<HelixCorrelationPayload Include="$(WasiBuildTargetsDir)" Destination="build/wasm" />
|
||||
<HelixCorrelationPayload Include="$(WasmBuildTargetsDir)" Destination="build/wasm" />
|
||||
<HelixCorrelationPayload Include="$(WasmBuildTargetsDir)" Destination="build/wasm-shared" />
|
||||
<HelixCorrelationPayload Include="$(WasmAppBuilderDir)" Destination="build/WasmAppBuilder" />
|
||||
<HelixCorrelationPayload Include="$(MonoAOTCompilerDir)" Destination="build/MonoAOTCompiler" />
|
||||
<HelixCorrelationPayload Include="$(MonoAotCrossDir)" Destination="build/cross" />
|
||||
|
@ -121,7 +119,6 @@
|
|||
|
||||
<HelixCorrelationPayload Include="$(_ShippingPackagesPath)" Destination="built-nugets" Condition="'$(NeedsBuiltNugets)' == 'true'" />
|
||||
<HelixCorrelationPayload Include="$(WasiSdkDirForHelixPayload)" Destination="build/wasi-sdk" Condition="'$(NeedsWasiSdk)' == 'true'" />
|
||||
<HelixCorrelationPayload Include="$(WasmSharedDir)" Destination="build/wasm-shared" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<PropertyGroup>
|
||||
<_workItemTimeout Condition="'$(Scenario)' == 'BuildWasmApps' and '$(_workItemTimeout)' == ''">01:30:00</_workItemTimeout>
|
||||
<_workItemTimeout Condition="'$(NeedsToBuildWasmAppsOnHelix)' == 'true'">01:00:00</_workItemTimeout>
|
||||
|
||||
<BrowserBuildTargetsDir>$([MSBuild]::NormalizeDirectory($(BrowserProjectRoot), 'build'))</BrowserBuildTargetsDir>
|
||||
<WasmBuildTargetsDir>$([MSBuild]::NormalizeDirectory($(WasmProjectRoot), 'build'))</WasmBuildTargetsDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(Scenario)' == 'BuildWasmApps'">
|
||||
|
|
|
@ -669,21 +669,21 @@
|
|||
<ProjectReference Include="@(NativeAotTestAppProjects)" />
|
||||
|
||||
<!-- wasm.build.tests are run on _WasmBuildTests job on CI, and with library tests locally. -->
|
||||
<ProjectReference Include="$(RepoRoot)\src\mono\wasm\Wasm.Build.Tests\*.Tests.csproj"
|
||||
<ProjectReference Include="$(WasmProjectRoot)Wasm.Build.Tests\*.Tests.csproj"
|
||||
Exclude="@(ProjectExclusions)"
|
||||
Condition="'$(TargetOS)' == 'browser' and
|
||||
(('$(ContinuousIntegrationBuild)' == 'true' and '$(TestWasmBuildTests)' == 'true') or
|
||||
('$(ContinuousIntegrationBuild)' != 'true' and '$(TestAssemblies)' == 'true'))"
|
||||
BuildInParallel="false" />
|
||||
|
||||
<ProjectReference Include="$(RepoRoot)\src\mono\wasi\Wasi.Build.Tests\*.Tests.csproj"
|
||||
<ProjectReference Include="$(WasiProjectRoot)\Wasi.Build.Tests\*.Tests.csproj"
|
||||
Exclude="@(ProjectExclusions)"
|
||||
Condition="'$(TargetOS)' == 'wasi' and
|
||||
(('$(ContinuousIntegrationBuild)' == 'true' and '$(TestWasmBuildTests)' == 'true') or
|
||||
('$(ContinuousIntegrationBuild)' != 'true' and '$(TestAssemblies)' == 'true'))"
|
||||
BuildInParallel="false" />
|
||||
|
||||
<ProjectReference Include="$(RepoRoot)\src\mono\wasm\debugger\Wasm.Debugger.Tests\*.Tests.csproj"
|
||||
<ProjectReference Include="$(BrowserProjectRoot)debugger\Wasm.Debugger.Tests\*.Tests.csproj"
|
||||
Exclude="@(ProjectExclusions)"
|
||||
Condition="'$(TargetOS)' == 'browser' and
|
||||
(('$(ContinuousIntegrationBuild)' == 'true' and '$(TestWasmDebuggerTests)' == 'true') or
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<!-- Directory to provision and use emscripten if EMSDK_PATH env variable is not set -->
|
||||
<PropertyGroup Condition="'$(TargetsBrowser)' == 'true'">
|
||||
<ProvisionEmscriptenDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasm', 'emsdk'))</ProvisionEmscriptenDir>
|
||||
<ProvisionEmscriptenDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'browser', 'emsdk'))</ProvisionEmscriptenDir>
|
||||
<ShouldProvisionEmscripten Condition="'$(EMSDK_PATH)' == '' and !Exists('$(ProvisionEmscriptenDir)')">true</ShouldProvisionEmscripten>
|
||||
<EMSDK_PATH Condition="Exists('$(ProvisionEmscriptenDir)') and '$(EMSDK_PATH)' == ''">$(ProvisionEmscriptenDir.Replace('\', '/'))</EMSDK_PATH>
|
||||
</PropertyGroup>
|
||||
|
|
170
src/mono/browser/Makefile
Normal file
170
src/mono/browser/Makefile
Normal file
|
@ -0,0 +1,170 @@
|
|||
TOP=$(realpath $(CURDIR)/../../..)
|
||||
-include Make.config
|
||||
|
||||
escape_quote = $(subst ",\",$(1))
|
||||
|
||||
ifneq ($(V),)
|
||||
MSBUILD_ARGS+=/p:MonoVerboseBuild=true
|
||||
MSBUILD_ARGS+=-bl
|
||||
endif
|
||||
|
||||
MSBUILD_ARGS+=/p:KeepNativeSymbols=true
|
||||
|
||||
DOTNET=$(TOP)/dotnet.sh
|
||||
JSVU=$(HOME)/.jsvu
|
||||
CHROMEDRIVER?=$(HOME)/.chromedriver
|
||||
GECKODRIVER?=$(HOME)/.geckodriver
|
||||
|
||||
EMSDK_PATH?=$(TOP)/src/mono/browser/emsdk
|
||||
CONFIG?=Release
|
||||
BINDIR?=$(TOP)/artifacts/bin
|
||||
OBJDIR?=$(TOP)/artifacts/obj
|
||||
_MSBUILD_WASM_BUILD_ARGS=/p:TargetOS=browser /p:TargetArchitecture=wasm /p:Configuration=$(CONFIG)
|
||||
XHARNESS_BROWSER?=chrome
|
||||
HELIX_TARGET_QUEUE?=Ubuntu.1804.Amd64.Open
|
||||
|
||||
LOG_PATH=$(TOP)/artifacts/log/$(CONFIG)
|
||||
|
||||
all: build-all
|
||||
|
||||
#
|
||||
# EMSCRIPTEN SETUP
|
||||
#
|
||||
# If EMSDK_PATH is not set by the caller, download and setup a local emsdk install.
|
||||
#
|
||||
|
||||
EMSCRIPTEN_VERSION := $(shell cat $(TOP)/src/mono/browser/emscripten-version.txt)
|
||||
EMSDK_LOCAL_PATH=emsdk
|
||||
EMCC=source $(EMSDK_PATH)/emsdk_env.sh 2>/dev/null && emcc
|
||||
|
||||
.stamp-wasm-install-and-select-$(EMSCRIPTEN_VERSION):
|
||||
rm -rf $(EMSDK_LOCAL_PATH)
|
||||
git clone https://github.com/emscripten-core/emsdk.git $(EMSDK_LOCAL_PATH)
|
||||
cd $(EMSDK_LOCAL_PATH) && ./emsdk install $(EMSCRIPTEN_VERSION)
|
||||
cd $(EMSDK_LOCAL_PATH) && ./emsdk activate $(EMSCRIPTEN_VERSION)
|
||||
python3 ./sanitize.py $(EMSDK_PATH)
|
||||
touch $@
|
||||
|
||||
provision-wasm: .stamp-wasm-install-and-select-$(EMSCRIPTEN_VERSION)
|
||||
@echo "----------------------------------------------------------"
|
||||
@echo "Installed emsdk into EMSDK_PATH=$(TOP)/src/mono/browser/emsdk"
|
||||
|
||||
MONO_OBJ_DIR=$(OBJDIR)/mono/browser.wasm.$(CONFIG)
|
||||
BUILDS_OBJ_DIR=$(MONO_OBJ_DIR)/wasm
|
||||
|
||||
clean-emsdk:
|
||||
$(RM) -rf $(EMSDK_LOCAL_PATH)
|
||||
|
||||
#
|
||||
# Helper targets
|
||||
#
|
||||
|
||||
.PHONY: runtime
|
||||
.PHONY: build
|
||||
|
||||
build:
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono+libs.pretest -os browser -c $(CONFIG) --binaryLog /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
build-all:
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono+libs -os browser -c $(CONFIG) --binaryLog /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
runtime:
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono.runtime+mono.wasmruntime+libs.native+libs.pretest -os browser -c $(CONFIG) /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
# Rebuild only the mono runtime+cross compiler, don't build dotnet.wasm
|
||||
mono-runtime:
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono.runtime+libs.native+libs.pretest -os browser -c $(CONFIG) /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
corlib:
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono.corelib+mono.wasmruntime+libs.pretest -os browser -c $(CONFIG) /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
test-runner:
|
||||
$(DOTNET) build $(TOP)/src/libraries/Common/tests/WasmTestRunner /p:Configuration=$(CONFIG) $(MSBUILD_ARGS)
|
||||
|
||||
app-builder:
|
||||
$(DOTNET) build $(TOP)/src/tasks/WasmAppBuilder
|
||||
|
||||
build-tasks:
|
||||
$(DOTNET) build $(TOP)/src/tasks/tasks.proj /p:Configuration=$(CONFIG) $(MSBUILD_ARGS)
|
||||
|
||||
build-packages:
|
||||
rm -f $(TOP)/artifacts/packages/$(CONFIG)/Shipping/*.nupkg
|
||||
EMSDK_PATH=$(EMSDK_PATH) $(TOP)/build.sh mono.packages+mono.manifests+packs.product -os browser -c $(CONFIG) --binaryLog /p:ContinueOnError=false /p:StopOnFirstFailure=true $(MSBUILD_ARGS)
|
||||
|
||||
clean:
|
||||
$(RM) -rf $(BUILDS_OBJ_DIR)
|
||||
|
||||
run-tests-v8-%:
|
||||
EMSDK_PATH=$(EMSDK_PATH) PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test $(_MSBUILD_WASM_BUILD_ARGS) /p:JSEngine=V8 $(MSBUILD_ARGS)
|
||||
run-tests-sm-%:
|
||||
EMSDK_PATH=$(EMSDK_PATH) PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test $(_MSBUILD_WASM_BUILD_ARGS) /p:JSEngine=SpiderMonkey $(MSBUILD_ARGS)
|
||||
run-tests-jsc-%:
|
||||
EMSDK_PATH=$(EMSDK_PATH) PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test $(_MSBUILD_WASM_BUILD_ARGS) /p:JSEngine=JavaScriptCore $(MSBUILD_ARGS)
|
||||
|
||||
run-tests-%:
|
||||
EMSDK_PATH=$(EMSDK_PATH) PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
|
||||
|
||||
run-build-tests:
|
||||
PATH="$(JSVU):$(PATH)" $(DOTNET) build $(TOP)/src/mono/wasm/Wasm.Build.Tests/ /t:Test /bl:$(LOG_PATH)/Wasm.Build.Tests.binlog $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
|
||||
|
||||
run-browser-tests-%:
|
||||
PATH="$(GECKODRIVER):$(CHROMEDRIVER):$(PATH)" XHARNESS_COMMAND="test-browser --browser=$(XHARNESS_BROWSER)" $(DOTNET) build $(TOP)/src/libraries/$*/tests/ /t:Test $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
|
||||
|
||||
build-runtime-tests:
|
||||
$(TOP)/src/tests/build.sh -mono os browser wasm $(CONFIG) $(MSBUILD_ARGS)
|
||||
|
||||
build-debugger-tests-helix:
|
||||
$(DOTNET) build -restore -bl:$(LOG_PATH)/Wasm.Debugger.Tests.binlog \
|
||||
/p:ContinuousIntegrationBuild=true /p:ArchiveTests=true \
|
||||
$(TOP)/src/mono/browser/debugger/Wasm.Debugger.Tests/Wasm.Debugger.Tests.csproj \
|
||||
$(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
|
||||
|
||||
submit-debugger-tests-helix: build-debugger-tests-helix
|
||||
EMSDK_PATH=$(EMSDK_PATH) BUILD_REASON=wasm-test SYSTEM_TEAMPROJECT=public BUILD_REPOSITORY_NAME=dotnet/runtime BUILD_SOURCEBRANCH=main \
|
||||
$(TOP)/eng/common/msbuild.sh --ci -restore $(TOP)/src/libraries/sendtohelix.proj \
|
||||
/p:TestRunNamePrefixSuffix=WasmDebugger /p:HelixBuild=`date "+%Y%m%d.%H%M"` /p:Creator=`whoami` \
|
||||
/bl:$(LOG_PATH)/SendToHelix.binlog -p:HelixTargetQueue=$(HELIX_TARGET_QUEUE) \
|
||||
/p:RuntimeFlavor=mono /p:TargetRuntimeIdentifier= /p:MonoForceInterpreter= /p:TestScope=innerloop \
|
||||
/p:_Scenarios=wasmdebuggertests \
|
||||
$(_MSBUILD_WASM_BUILD_ARGS) \
|
||||
$(MSBUILD_ARGS)
|
||||
|
||||
submit-wbt-helix:
|
||||
PATH="$(JSVU):$(PATH)" \
|
||||
$(DOTNET) build $(TOP)/src/mono/wasm/Wasm.Build.Tests/ /v:m /p:ArchiveTests=true /t:ArchiveTests $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS) && \
|
||||
EMSDK_PATH=$(EMSDK_PATH) BUILD_REASON=wasm-test SYSTEM_TEAMPROJECT=public BUILD_REPOSITORY_NAME=dotnet/runtime BUILD_SOURCEBRANCH=main \
|
||||
$(TOP)/eng/common/msbuild.sh --ci -restore $(TOP)/src/libraries/sendtohelix.proj \
|
||||
/p:TestRunNamePrefixSuffix=WasmBuildTests /p:HelixBuild=`date "+%Y%m%d.%H%M"` /p:Creator=`whoami` \
|
||||
/bl:$(LOG_PATH)/SendToHelix.binlog -v:m -p:HelixTargetQueue=$(HELIX_TARGET_QUEUE) \
|
||||
/p:RuntimeFlavor=mono /p:TargetRuntimeIdentifier= /p:MonoForceInterpreter= /p:TestScope=innerloop \
|
||||
/p:_Scenarios=buildwasmapps \
|
||||
$(_MSBUILD_WASM_BUILD_ARGS) \
|
||||
$(MSBUILD_ARGS)
|
||||
|
||||
submit-tests-helix:
|
||||
echo "\n** This will submit all the available test zip files to helix **\n"
|
||||
EMSDK_PATH=$(EMSDK_PATH) BUILD_REASON=wasm-test SYSTEM_TEAMPROJECT=public BUILD_REPOSITORY_NAME=dotnet/runtime BUILD_SOURCEBRANCH=main \
|
||||
$(TOP)/eng/common/msbuild.sh --ci -restore $(TOP)/src/libraries/sendtohelix.proj \
|
||||
/p:TestRunNamePrefixSuffix=WasmTests /p:HelixBuild=`date "+%Y%m%d.%H%M"` /p:Creator=`whoami` \
|
||||
/bl:$(LOG_PATH)/SendToHelix.binlog -v:n -p:HelixTargetQueue=$(HELIX_TARGET_QUEUE) \
|
||||
/p:RuntimeFlavor=mono /p:TargetRuntimeIdentifier= /p:MonoForceInterpreter= /p:TestScope=innerloop \
|
||||
$(_MSBUILD_WASM_BUILD_ARGS) \
|
||||
$(MSBUILD_ARGS)
|
||||
|
||||
run-debugger-tests:
|
||||
rm -f $(TOP)/artifacts/bin/DebuggerTestSuite/x64/Debug/*log; \
|
||||
if [ ! -z "$(TEST_FILTER)" ]; then \
|
||||
$(DOTNET) test $(TOP)/src/mono/browser/debugger/DebuggerTestSuite $(MSBUILD_ARGS) "-l:trx;LogFileName=DebuggerTestsResults.xml" --results-directory $(LOG_PATH) --filter "category!=failing&FullyQualifiedName$(TEST_FILTER)" $(TEST_ARGS); \
|
||||
else \
|
||||
$(DOTNET) test $(TOP)/src/mono/browser/debugger/DebuggerTestSuite $(MSBUILD_ARGS) "-l:trx;LogFileName=DebuggerTestsResults.xml" --results-directory $(LOG_PATH) --filter "category!=failing" $(TEST_ARGS); \
|
||||
fi
|
||||
|
||||
build-dbg-proxy:
|
||||
$(DOTNET) build $(TOP)/src/mono/browser/debugger/BrowserDebugHost $(MSBUILD_ARGS)
|
||||
build-dbg-testsuite:
|
||||
$(DOTNET) build $(TOP)/src/mono/browser/debugger/DebuggerTestSuite $(MSBUILD_ARGS)
|
||||
build-app-host:
|
||||
$(DOTNET) build $(TOP)/src/mono/wasm/host $(_MSBUILD_WASM_BUILD_ARGS) $(MSBUILD_ARGS)
|
||||
|
||||
patch-deterministic:
|
||||
cd emsdk/upstream/emscripten/ && patch -p1 < ../../../runtime/deterministic.diff
|
|
@ -512,29 +512,29 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="InstallNpmPackages"
|
||||
Inputs="$(MonoProjectRoot)wasm/runtime/package.json"
|
||||
Outputs="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp"
|
||||
Inputs="$(BrowserProjectRoot)runtime/package.json"
|
||||
Outputs="$(BrowserProjectRoot)runtime/node_modules/.npm-stamp"
|
||||
>
|
||||
<!-- install typescript and rollup -->
|
||||
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/>
|
||||
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
|
||||
<!-- npm install is faster on dev machine as it doesn't wipe node_modules folder -->
|
||||
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' != 'true'" Command="npm install" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/>
|
||||
<RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' != 'true'" Command="npm install" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
|
||||
|
||||
<!-- Delete malformed package.json used for tests, it confuses Component Governance tooling -->
|
||||
<Delete Files="$(MonoProjectRoot)wasm/runtime/node_modules/resolve/test/resolver/malformed_package_json/package.json" ContinueOnError="true" />
|
||||
<Delete Files="$(BrowserProjectRoot)runtime/node_modules/resolve/test/resolver/malformed_package_json/package.json" ContinueOnError="true" />
|
||||
|
||||
<Touch Files="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" AlwaysCreate="true" />
|
||||
<Touch Files="$(BrowserProjectRoot)runtime/node_modules/.npm-stamp" AlwaysCreate="true" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/**/*.ts"
|
||||
Exclude="$(MonoProjectRoot)wasm/runtime/dotnet.d.ts;$(MonoProjectRoot)wasm/runtime/dotnet-legacy.d.ts;$(MonoProjectRoot)wasm/runtime/diagnostics-mock.d.ts;$(MonoProjectRoot)wasm/runtime/node_modules/**/*.ts" />
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/**/tsconfig.*"
|
||||
Exclude="$(MonoProjectRoot)wasm/runtime/node_modules/**/tsconfig.*" />
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/workers/**/*.js"/>
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtimetypes/*.d.ts"/>
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.json"/>
|
||||
<_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.js"/>
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtime/**/*.ts"
|
||||
Exclude="$(BrowserProjectRoot)runtime/dotnet.d.ts;$(BrowserProjectRoot)runtime/dotnet-legacy.d.ts;$(BrowserProjectRoot)runtime/diagnostics-mock.d.ts;$(BrowserProjectRoot)runtime/node_modules/**/*.ts" />
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtime/**/tsconfig.*"
|
||||
Exclude="$(BrowserProjectRoot)runtime/node_modules/**/tsconfig.*" />
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtime/workers/**/*.js"/>
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtimetypes/*.d.ts"/>
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtime/*.json"/>
|
||||
<_RollupInputs Include="$(BrowserProjectRoot)runtime/*.js"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="SetMonoRollupEnvironment" DependsOnTargets="GetProductVersions">
|
||||
|
@ -578,7 +578,7 @@
|
|||
<Target Name="GenerateMintopsTS"
|
||||
Inputs="$(MonoProjectRoot)wasm\runtime\genmintops.py;$(MonoProjectRoot)mono\mini\interp\mintops.def;$(MonoProjectRoot)mono\mini\interp\interp-simd-intrins.def"
|
||||
Outputs="$(NativeGeneratedFilesDir)mintops.ts">
|
||||
<Exec Command="$(PythonCmd) $(MonoProjectRoot)wasm/runtime/genmintops.py $(MonoProjectRoot)mono/mini/interp/mintops.def $(MonoProjectRoot)mono/mini/interp/interp-simd-intrins.def $(NativeGeneratedFilesDir)mintops.ts" />
|
||||
<Exec Command="$(PythonCmd) $(BrowserProjectRoot)runtime/genmintops.py $(MonoProjectRoot)mono/mini/interp/mintops.def $(MonoProjectRoot)mono/mini/interp/interp-simd-intrins.def $(NativeGeneratedFilesDir)mintops.ts" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildWithRollup"
|
||||
|
@ -587,10 +587,10 @@
|
|||
DependsOnTargets="WriteRollupEnvToFile;GenerateMintopsTS"
|
||||
>
|
||||
<!-- code style check -->
|
||||
<RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/>
|
||||
<RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
|
||||
|
||||
<!-- compile typescript -->
|
||||
<RunWithEmSdkEnv Command="npm run rollup -- --environment $(MonoRollupEnvironment)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/>
|
||||
<RunWithEmSdkEnv Command="npm run rollup -- --environment $(MonoRollupEnvironment)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(BrowserProjectRoot)runtime/"/>
|
||||
|
||||
<Copy SourceFiles="runtime/package.json;"
|
||||
DestinationFolder="$(NativeBinDir)"
|
156
src/mono/browser/build/README.md
Normal file
156
src/mono/browser/build/README.md
Normal file
|
@ -0,0 +1,156 @@
|
|||
# Wasm app build
|
||||
|
||||
This usually consists of taking the built assemblies, and related files, and generating an app bundle.
|
||||
|
||||
Wasm app build can run in two scenarios:
|
||||
|
||||
1. After build, eg. when running the app in VS, or `dotnet build foo.csproj`
|
||||
2. For Publish, eg, when publishing the app to a folder, or Azure
|
||||
|
||||
A dotnet wasm app has some native wasm files (`dotnet.wasm`, and `dotnet.js`). How these files are obtained, or generated:
|
||||
|
||||
1. Build
|
||||
- a. with no native libraries referenced (AOT setting is ignored here)
|
||||
- files from the runtime pack are used as-is
|
||||
- b. with native libraries referenced
|
||||
- dotnet.wasm is relinked with the native libraries
|
||||
2. Publish
|
||||
- dotnet.wasm is relinked with the native libraries, and updated pinvoke/icalls from the trimmed assemblies
|
||||
- if `RunAOTCompilation=true`, then the relinking includes AOT'ed assemblies
|
||||
|
||||
## `Build`
|
||||
|
||||
Implementation:
|
||||
|
||||
- Target `WasmBuildApp`
|
||||
- runs after `Build` by default
|
||||
- which can be disabled by `$(DisableAutoWasmBuildApp)`
|
||||
- or the run-after target can be set via `$(WasmBuildAppAfterThisTarget)`
|
||||
|
||||
- To run a custom target
|
||||
- *before* any of the wasm build targets, use `$(WasmBuildAppDependsOn)`, and prepend your target name to that
|
||||
- *after* any of the wasm build targets, use `AfterTargets="WasmBuildApp"` on that target
|
||||
- Avoid depending on this target, because it is available only when the workload is installed. Use `$(WasmNativeWorkload)` to check if it is installed.
|
||||
|
||||
- When `Module.disableDotnet6Compatibility` is set it would not pollute global namespace.
|
||||
|
||||
## `Publish`
|
||||
|
||||
Implementation:
|
||||
|
||||
- This part runs as a nested build using a `MSBuild` task, which means that the project gets reevaluated. So, if there were any changes made to items/properties in targets before this, then they won't be visible in the nested build.
|
||||
- By default `WasmTriggerPublishApp` runs after the `Publish` target, and that triggers the nested build
|
||||
- The nested build runs `WasmNestedPublishApp`, which causes `Build`, and `Publish` targets to be run
|
||||
- Because this causes `Build` to be run again, if you have any targets that get triggered by that, then they will be running twice.
|
||||
- But the original *build* run, and this *publish* run can be differentiated using `$(WasmBuildingForNestedPublish)`
|
||||
|
||||
- `WasmTriggerPublishApp` essentially just invokes the nested publish
|
||||
- This runs after `Publish`
|
||||
- which can be disabled by `$(DisableAutoWasmPublishApp)`
|
||||
- or the run-after target can be set via `$(WasmTriggerPublishAppAfterThisTarget)`
|
||||
|
||||
- To influence the wasm build for publish, use `WasmNestedPublishApp`
|
||||
- To run a custom target before it, use `$(WasmNestedPublishAppDependsOn)`
|
||||
- to run a custom target *after* it, use `AfterTargets="WasmNestedPublishApp"`
|
||||
|
||||
- If you want to *dependsOn* on this, then use `DependsOnTargets="WasmTriggerPublishApp"`
|
||||
|
||||
# `WasmApp.{props,targets}`, and `WasmApp.InTree.{props,targets}`
|
||||
|
||||
- Any project that wants to use this, can import the props+targets, and set up the
|
||||
various properties before the target `WasmBuildApp` gets executed.
|
||||
- the recommended way to do this is to prepend the target to `$(WasmAppBuildDependsOn)`
|
||||
|
||||
- Any wasm projects within the `dotnet/runtime` repo should use the `WasmApp.InTree.{props,targets}` files
|
||||
- These files have relevant properties/targets to work with a local build
|
||||
- Generally, the props file can be imported at the top, and the targets file at the bottom of a project file.
|
||||
|
||||
- `WasmBuildApp` target is not run by default. The importing project will have
|
||||
to do that.
|
||||
|
||||
- By default, the `WasmLoadAssembliesAndReferences` task is not run, and
|
||||
the specified `@(WasmAssembliesToBundle)` are directly passed to
|
||||
`WasmAppBuilder`.
|
||||
- If the project needs assembly dependencies to be resolved, then
|
||||
set `$(WasmResolveAssembliesBeforeBuild) == true`.
|
||||
- Should you need to run the AOT toolset, ensure `$(RunAOTCompilation) == true`
|
||||
and set `$(WasmAOTDir)` to the directory that you want to AOT. Make sure that both
|
||||
`@(WasmAssembliesToBundle)` and `$(WasmAOTDir)` are absolute paths.
|
||||
|
||||
- Assemblies to be bundled with the app are set via
|
||||
`@(WasmAssembliesToBundle)` (which optionally will have dependencies
|
||||
resolved)
|
||||
|
||||
The various task inputs correspond to properties as:
|
||||
|
||||
```
|
||||
AssemblySearchPaths : @(WasmAssemblySearchPaths)
|
||||
|
||||
Assemblies : @(WasmAssembliesToBundle)
|
||||
|
||||
AppDir : $(WasmAppDir)
|
||||
MainAssembly : $(WasmMainAssemblyPath)
|
||||
InvariantGlobalization : $(WasmInvariantGlobalization)
|
||||
SatelliteAssemblies : @(WasmSatelliteAssemblies)
|
||||
FilesToIncludeInFileSystem : @(WasmFilesToIncludeInFileSystem)
|
||||
DebugLevel : $(WasmDebugLevel)
|
||||
ExtraFilesToDeploy : @(WasmExtraFilesToDeploy)
|
||||
|
||||
MicrosoftNetCoreAppRuntimePackDir : $(MicrosoftNetCoreAppRuntimePackRidDir)
|
||||
```
|
||||
|
||||
- `run-v8.sh` script is emitted to `$(WasmRunV8ScriptPath)` which defaults to `$(WasmAppDir)`.
|
||||
- To control it's generation use `$(WasmGenerateRunV8Script)` (false by default)
|
||||
|
||||
This should be a step towards eventually having this build as a sdk.
|
||||
|
||||
Refer to `WasmApp.targets` for more information about the properties/items used as inputs to the process.
|
||||
|
||||
## Updating dependencies needed for building wasm apps
|
||||
|
||||
For example, if the wasm targets are using a new task, then references to that
|
||||
need to be updated in a few places. Essentially, look for existing references
|
||||
to `MonoAOTCompiler`, or `WasmAppBuilder` in the relevant files, and duplicate
|
||||
them for the new task assembly.
|
||||
|
||||
1. The task assembly dir, and its path need to be in two properties:
|
||||
```xml
|
||||
<MonoTargetsTasksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoTargetsTasks', 'Debug', '$(NetCoreAppToolCurrent)'))</MonoTargetsTasksDir>
|
||||
<MonoTargetsTasksAssemblyPath>$([MSBuild]::NormalizePath('$(MonoTargetsTasksDir)', 'MonoTargetsTasks.dll'))</MonoTargetsTasksAssemblyPath>
|
||||
```
|
||||
|
||||
And this needs to be set in:
|
||||
- `Directory.Build.props`
|
||||
- `src/mono/wasm/build/WasmApp.LocalBuild.props`
|
||||
- `src/mono/wasm/build/WasmApp.LocalBuild.targets`
|
||||
- `src/tests/Common/wasm-test-runner/WasmTestRunner.proj`
|
||||
|
||||
2. The new dependency (eg. task assembly) needs to be sent to helix as a payload, see `src/libraries/sendtohelixhelp.proj`. Use `MonoAOTCompiler` as an example.
|
||||
|
||||
3. Make changes similar to the one for existing dependent tasks in
|
||||
- `eng/testing/linker/trimmingTests.targets`,
|
||||
- `src/tests/Common/wasm-test-runner/WasmTestRunner.proj`
|
||||
- `src/tests/Directory.Build.targets`
|
||||
|
||||
## Profiling build performance
|
||||
|
||||
If encountering build performance issues, you can use the rollup `--perf` option and the typescript compiler `--generateCpuProfile` option to get build profile data, like so:
|
||||
|
||||
```../emsdk/node/14.18.2_64bit/bin/npm run rollup --perf -- --perf --environment Configuration:Release,NativeBinDir:./rollup-test-data,ProductVersion:12.3.4```
|
||||
|
||||
```node node_modules/typescript/lib/tsc.js --generateCpuProfile dotnet-tsc.cpuprofile -p tsconfig.json ```
|
||||
|
||||
The .cpuprofile file generated by node can be opened in the Performance tab of Chrome or Edge's devtools.
|
||||
|
||||
## Blazor
|
||||
|
||||
You can test local build of runtime in blazor by overriding location where blazor resolves runtime pack from
|
||||
|
||||
*BlazorWasm.csproj*
|
||||
```xml
|
||||
<Target Name="UpdateRuntimePack" AfterTargets="ResolveFrameworkReferences">
|
||||
<ItemGroup>
|
||||
<ResolvedRuntimePack PackageDirectory="{RUNTIME_REPO_ROOT}\artifacts\bin\microsoft.netcore.app.runtime.browser-wasm\Debug" Condition="'%(ResolvedRuntimePack.FrameworkName)' == 'Microsoft.NETCore.App'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
```
|
|
@ -11,7 +11,7 @@
|
|||
<Platform>AnyCPU</Platform>
|
||||
<EnableTargetingPackDownload>false</EnableTargetingPackDownload>
|
||||
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
|
||||
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'wasm', 'emsdk'))</EMSDK_PATH>
|
||||
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(MonoProjectRoot), 'browser', 'emsdk'))</EMSDK_PATH>
|
||||
<RunAOTCompilation Condition="'$(RunAOTCompilation)' == ''">false</RunAOTCompilation>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<RunAnalyzers>false</RunAnalyzers>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue