Skip to content

Commit

Permalink
[wasi] Select mono components (#100407)
Browse files Browse the repository at this point in the history
* Don't link icu for InvariantGlobalization=true

* Don't link debugger for publish

* Revert "Don't link icu for InvariantGlobalization=true"

This reverts commit d62a165.

# Conflicts:
#	src/mono/wasi/build/WasiApp.targets

* Drop in-tree setup. Solve the rest of the components

* Incorporate WasmDebugLevel

* Hook MonoSelectRuntimeComponents. Unify component selection

* Fix merge damage

* Conditional mono targets
  • Loading branch information
maraf committed Apr 18, 2024
1 parent 37acea2 commit b194416
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
8 changes: 0 additions & 8 deletions src/mono/wasi/build/WasiApp.InTree.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,4 @@
<TrimMode>partial</TrimMode>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>
<!-- This is temporary hack for https://github.com/dotnet/runtime/issues/61294 -->
<ItemGroup>
<_MonoRuntimeComponentDontLink Include="libmono-component-debugger-stub-static.a" />
<!-- FIXME: This will exclude the diagnostics component if tracing is not on and threads are not on. Which means that if you turn on threading, you will get diagnostics. Is this what we want? -->
<_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" Condition="'$(FeatureWasmPerfTracing)' != 'true' and $(FeatureWasmManagedThreads) != 'true'"/>
<_MonoRuntimeComponentDontLink Include="libmono-component-hot_reload-stub-static.a" />
<_MonoRuntimeComponentDontLink Include="libmono-component-marshal-ilgen-stub-static.a" />
</ItemGroup>
</Project>
21 changes: 17 additions & 4 deletions src/mono/wasi/build/WasiApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
_WasmGenerateNodeScripts;
</WasmGenerateAppBundleDependsOn>

<WasiWriteRspForLinkingDependsOn>
$(WasiWriteRspForLinkingDependsOn);
_WasmSelectRuntimeComponentsForLinking;
_WasiGetWasiOutputFileName;
</WasiWriteRspForLinkingDependsOn>
<WasiWriteRspForLinkingDependsOn Condition="'$(UsingWasiRuntimeWorkload)' == 'true'">
$(WasiWriteRspForLinkingDependsOn);
_MonoSelectRuntimeComponents;
</WasiWriteRspForLinkingDependsOn>

<SelfContained Condition="'$(IsWasiProject)' == 'true'">true</SelfContained>

<!-- Temporarily `false`, till sdk gets a fix for supporting the new file -->
Expand Down Expand Up @@ -261,7 +271,7 @@
</Target>

<Target Name="_WasiWriteRspForLinking"
DependsOnTargets="_WasmSelectRuntimeComponentsForLinking;_WasiGetWasiOutputFileName"
DependsOnTargets="$(WasiWriteRspForLinkingDependsOn)"
BeforeTargets="_WasmWriteRspForLinking"
Returns="@(_WasmLinkStepArgs)">

Expand Down Expand Up @@ -296,12 +306,15 @@
<_WasmSIMDLibToExclude Condition="'$(WasmEnableSIMD)' == 'true'">libmono-wasm-nosimd.a</_WasmSIMDLibToExclude>
</PropertyGroup>

<ItemGroup>
<_MonoRuntimeComponentDontLink Include="wasm-bundled-timezones.a" Condition="'$(InvariantTimezone)' == 'true'"/>
<_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" Condition="'$(UsingWasiRuntimeWorkload)' != 'true'" /> <!-- Just for in-tree build + CI -->
</ItemGroup>

<ItemGroup>
<!-- order matters -->
<_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
<!--<_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />-->
<_MonoRuntimeComponentDontLink Include="libmono-component-diagnostics_tracing-static.a" />
<_MonoRuntimeComponentDontLink Include="wasm-bundled-timezones.a" Condition="'$(InvariantTimezone)' == 'true'"/>

<_WasmNativeFileForLinking
Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)*.a"
Expand Down Expand Up @@ -440,4 +453,4 @@ wasi.start(instance);
</Target>

<!--<Target Name="_WasmCalculateInitialHeapSize" />-->
</Project>
</Project>
15 changes: 11 additions & 4 deletions src/mono/wasm/build/WasmApp.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,16 @@
<ItemGroup>
<UpToDateCheckInput Include="@(NativeFileReference)" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug' and '@(_MonoComponent->Count())' == 0">
<_MonoComponent Include="hot_reload;debugger" />

<PropertyGroup>
<_WasmDebuggerSupport Condition="'$(WasmDebugLevel)' != '' and '$(WasmDebugLevel)' != '0'">true</_WasmDebuggerSupport>
<_WasmDebuggerSupport Condition="'$(WasmDebugLevel)' != '' and '$(WasmDebugLevel)' == '0'">false</_WasmDebuggerSupport>
<_WasmDebuggerSupport Condition="'$(_WasmDebuggerSupport)' == '' and '$(WasmBuildingForNestedPublish)' == 'true'">false</_WasmDebuggerSupport> <!-- publish -->
<_WasmDebuggerSupport Condition="'$(_WasmDebuggerSupport)' == ''">true</_WasmDebuggerSupport>
</PropertyGroup>
<ItemGroup Condition="'$(_WasmDebuggerSupport)' == 'true'">
<_MonoComponent Include="debugger" />
<_MonoComponent Include="hot_reload" />
</ItemGroup>
<!-- PUBLISH -->

Expand Down Expand Up @@ -590,7 +597,7 @@
</Target>

<Target Name="_ScanAssembliesDecideLightweightMarshaler">
<ItemGroup>
<ItemGroup>
<_AssembliesToScan Include="@(_WasmAssembliesInternal)" />
</ItemGroup>

Expand Down

0 comments on commit b194416

Please sign in to comment.