--- /dev/null
+TOP=../../../../../..
+
+DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary
+
+CONFIG?=Release
+
+all: build
+
+build:
+ $(TOP)/.dotnet/dotnet build $(DOTNET_Q_ARGS) /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) WasmSample.csproj
+
+clean:
+ rm -rf bin
+
+run:
+ cd bin/$(CONFIG)/publish && python server.py
\ No newline at end of file
--- /dev/null
+// -*- indent-tabs-mode: nil -*-
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+
+namespace Sample
+{
+ public class Test
+ {
+ public static void Main(String[] args)
+ {
+ Console.WriteLine ("Hello, World!");
+ }
+
+ public static int TestMeaning()
+ {
+ return 42;
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="BuildApp">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <OutputPath>bin</OutputPath>
+ <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
+ <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
+ <TargetArchitecture>wasm</TargetArchitecture>
+ <TargetOS>Browser</TargetOS>
+ <MicrosoftNetCoreAppRuntimePackDir>$(ArtifactsBinDir)microsoft.netcore.app.runtime.browser-wasm\$(Configuration)\runtimes\browser-wasm\</MicrosoftNetCoreAppRuntimePackDir>
+ <BuildDir>$(MSBuildThisFileDirectory)obj\$(Configuration)\wasm</BuildDir>
+ <AppDir>$(MSBuildThisFileDirectory)bin\$(Configuration)\publish</AppDir>
+ </PropertyGroup>
+
+ <Target Name="RebuildWasmAppBuilder">
+ <ItemGroup>
+ <WasmAppBuildProject Include="$(RepoTasksDir)mobile.tasks\WasmAppBuilder\WasmAppBuilder.csproj" />
+ </ItemGroup>
+
+ <MSBuild Projects="@(WasmAppBuildProject)"
+ Properties="Configuration=$(Configuration);MSBuildRestoreSessionId=$([System.Guid]::NewGuid())"
+ Targets="Restore"/>
+
+ <MSBuild Projects="@(WasmAppBuildProject)"
+ Properties="Configuration=$(Configuration)"
+ Targets="Build;Publish"/>
+ </Target>
+
+ <UsingTask TaskName="WasmAppBuilder"
+ AssemblyFile="$(ArtifactsBinDir)WasmAppBuilder\$(Configuration)\$(NetCoreAppCurrent)\publish\WasmAppBuilder.dll"/>
+
+ <Target Name="BuildApp" DependsOnTargets="RebuildWasmAppBuilder;Build">
+ <ItemGroup>
+ <AssemblySearchPaths Include="bin"/>
+ <AssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackDir)native"/>
+ <AssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackDir)lib\$(NetCoreAppCurrent)"/>
+ </ItemGroup>
+ <WasmAppBuilder
+ AppDir="$(AppDir)"
+ ExtraAssemblies="$(MicrosoftNetCoreAppRuntimePackDir)lib\$(NetCoreAppCurrent)\System.Runtime.InteropServices.JavaScript.dll"
+ MicrosoftNetCoreAppRuntimePackDir="$(MicrosoftNetCoreAppRuntimePackDir)"
+ MainAssembly="bin\WasmSample.dll"
+ MainJS="runtime.js"
+ AssemblySearchPaths="@(AssemblySearchPaths)"/>
+ <Exec Command="chmod a+x $(AppDir)/run-v8.sh" />
+ <Copy SourceFiles="bin\index.html;bin\server.py" DestinationFolder="$(AppDir)" />
+ </Target>
+
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Content Include="index.html">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="server.py">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+</Project>
--- /dev/null
+<!DOCTYPE html>
+<!-- Licensed to the .NET Foundation under one or more agreements. -->
+<!-- The .NET Foundation licenses this file to you under the MIT license. -->
+<html>
+ <head>
+ <title>TESTS</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ </head>
+ <body>
+ <h3 id="header">Wasm Browser Sample</h3>
+ Result from Sample.Test.TestMeaaning: <span id="out"></span>
+ <script type='text/javascript'>
+ var App = {
+ init: function () {
+ var ret = BINDING.call_static_method("[WasmSample] Sample.Test:TestMeaning", []);
+ document.getElementById("out").innerHTML = ret;
+ console.log ("ready");
+ },
+ };
+ </script>
+ <script type="text/javascript" src="mono-config.js"></script>
+ <script type="text/javascript" src="runtime.js"></script>
+
+ <script defer src="dotnet.js"></script>
+
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+var Module = {
+ onRuntimeInitialized: function () {
+ config.loaded_cb = function () {
+ App.init ();
+ };
+ config.fetch_file_cb = function (asset) {
+ return fetch (asset, { credentials: 'same-origin' });
+ }
+
+ MONO.mono_load_runtime_and_bcl_args (config);
+ },
+};
--- /dev/null
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+
+import sys
+
+if sys.version_info[0] == 2:
+
+ import SimpleHTTPServer
+ import SocketServer
+
+ PORT = 8000
+
+ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+ pass
+
+ Handler.extensions_map['.wasm'] = 'application/wasm'
+
+ httpd = SocketServer.TCPServer(("", PORT), Handler)
+
+ print ("python 2 serving at port", PORT)
+ httpd.serve_forever()
+
+
+if sys.version_info[0] == 3:
+
+ import http.server
+ import socketserver
+
+ PORT = 8000
+
+ Handler = http.server.SimpleHTTPRequestHandler
+ Handler.extensions_map['.wasm'] = 'application/wasm'
+
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
+ print("python 3 serving at port", PORT)
+ httpd.serve_forever()
+
-TOP=../../../../..
+TOP=../../../../../..
DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary