Skip to content

Commit

Permalink
[wasm] Support mono runtime components (#55680)
Browse files Browse the repository at this point in the history
* [wasm] Support mono runtime components

* Do not use diagnostics_tracing component

* Allow custom @(_MonoComponent)

* Update src/mono/wasm/build/WasmApp.Native.targets

* Select components only with native workload

* Fixing CI when linking with stubs

* Adding what @radical asked for.

* Update sendtohelixhelp.proj

Fix helix work item prefix

Co-authored-by: Larry Ewing <[email protected]>
Co-authored-by: Thays <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
  • Loading branch information
4 people authored Jul 15, 2021
1 parent 188c270 commit dfdec3b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/mono/mono/component/debugger-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,32 @@ static void
stub_send_enc_delta (MonoImage *image, gconstpointer dmeta_bytes, int32_t dmeta_len, gconstpointer dpdb_bytes, int32_t dpdb_len)
{
}

#ifdef HOST_WASM

#include <emscripten.h>

//functions exported to be used by JS
G_BEGIN_DECLS

EMSCRIPTEN_KEEPALIVE gboolean mono_wasm_send_dbg_command (int id, int command_set, int command, guint8* data, unsigned int size);
EMSCRIPTEN_KEEPALIVE gboolean mono_wasm_send_dbg_command_with_parms (int id, int command_set, int command, guint8* data, unsigned int size, int valtype, char* newvalue);

G_END_DECLS


EMSCRIPTEN_KEEPALIVE gboolean
mono_wasm_send_dbg_command_with_parms (int id, int command_set, int command, guint8* data, unsigned int size, int valtype, char* newvalue)
{
return false;
}

EMSCRIPTEN_KEEPALIVE gboolean
mono_wasm_send_dbg_command (int id, int command_set, int command, guint8* data, unsigned int size)
{
return false;
}

#endif // HOST_WASM


16 changes: 13 additions & 3 deletions src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,16 @@
<EmccCompile SourceFiles="@(_WasmSourceFileToCompile)" Arguments='"@$(_EmccDefaultFlagsRsp)" "@$(_EmccCompileRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
</Target>

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

<Target Name="_WasmLinkDotNetSelectComponents"
Condition="'$(WasmNativeWorkload)' == true"
DependsOnTargets="_MonoSelectRuntimeComponents">
</Target>

<Target Name="_WasmLinkDotNet" DependsOnTargets="_WasmLinkDotNetSelectComponents">
<ItemGroup>
<!-- Adding optimization flag at the top, so it gets precedence -->
<_EmccLDFlags Include="$(EmccLinkOptimizationFlag)" />
Expand All @@ -258,8 +267,9 @@
<_WasmNativeFileForLinking Include="%(_BitcodeFile.ObjectFile)" />
<_WasmNativeFileForLinking Include="%(_WasmSourceFileToCompile.ObjectFile)" />

<!-- libmono* needs to be at the end, since it is used to resolve references the previous .o files -->
<_WasmNativeFileForLinking Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a" />
<_WasmNativeFileForLinking
Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\*.a"
Exclude="@(_MonoRuntimeComponentDontLink->'$(MicrosoftNetCoreAppRuntimePackRidNativeDir)\%(Identity)')" />

<_EmccLinkStepArgs Include="@(_EmccLDFlags)" />
<_EmccLinkStepArgs Include="--js-library &quot;%(_DotnetJSSrcFile.Identity)&quot;" />
Expand Down

0 comments on commit dfdec3b

Please sign in to comment.