Skip to content
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

[browser] Unify boot config schema and output layout #86255

Merged
merged 89 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
3ab43ea
WIP
maraf May 15, 2023
9d4ddc5
Assets hash
maraf May 15, 2023
1c44c21
VFS
maraf May 15, 2023
c74bb29
Drop RemoteSources
maraf May 15, 2023
c1903bb
Disable nullable in BootJsonData
maraf May 15, 2023
0928652
Load VFS in JS
maraf May 15, 2023
b8fe6e5
Add dotnetwasm to runtimeAssets
maraf May 15, 2023
eaca5a6
Fix null config.resources.pdb
maraf May 15, 2023
784a09a
Fix null config.resources.satelliteResources
maraf May 15, 2023
859c46f
Fix dotnetwasm hash
maraf May 16, 2023
8ebcce8
Handle symbols in blazor path
maraf May 16, 2023
c709ba3
Move everything in _framework folder
maraf May 16, 2023
b32d5a3
Update path to dotnet.js in imports
maraf May 16, 2023
1581b76
Fix configSrc path in advanced sample
maraf May 16, 2023
105b35c
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf May 16, 2023
d1abc9a
Fix merge
maraf May 16, 2023
3e67550
Merge branch 'main' into WasmUnifyBootConfigSchema
maraf May 29, 2023
dca3ae7
Drop logging
maraf May 29, 2023
7c2b383
Console friendly
maraf May 29, 2023
cfddfd6
TMP TO REVERT
maraf May 29, 2023
280fe69
Fix build
maraf May 30, 2023
bbde368
Console friendly
maraf May 30, 2023
9ffdf75
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf May 30, 2023
3c7d14c
Fix null extensions
maraf May 30, 2023
dac75e7
A bit more work on WasmExtraConfig
maraf May 30, 2023
a3a3346
Propagate assetUniqueQuery
maraf May 30, 2023
52f796d
Fix pthreadPoolSize
maraf May 30, 2023
33843cb
Fix default globalization
maraf May 30, 2023
7f2a16e
Fix virtualPath for VFS entries
maraf May 30, 2023
4a39857
Share BootJsonData
maraf May 30, 2023
293d270
Call setupModuleForBlazor on web. Drop disableDotnet6Compatibility be…
maraf May 30, 2023
c08752d
WBT fix paths
maraf May 31, 2023
464554b
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf May 31, 2023
724cd78
Globalization
maraf Jun 1, 2023
b58f61b
test-main arg --no-exit
maraf Jun 1, 2023
c385a62
Fix MonoJsTests
maraf Jun 1, 2023
29c5287
Fix wbt managed
maraf Jun 1, 2023
dd40afb
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 2, 2023
29eec40
loadAllSatelliteResources on startup
maraf Jun 2, 2023
d005783
Remote sources
maraf Jun 2, 2023
290a78e
Fix environment variables
maraf Jun 2, 2023
8836468
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 5, 2023
61a7ca4
Fix relative path to the imported modules in JS tests
maraf Jun 5, 2023
76864f1
Fix hybrid. These changes will come from a different PR
maraf Jun 5, 2023
8efa39c
Threading
maraf Jun 5, 2023
3e9dd79
Fix imports
maraf Jun 6, 2023
0f45395
Fix culture on v8/node
maraf Jun 6, 2023
6edc837
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 6, 2023
a58082b
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 8, 2023
b137849
Drop enableDownloadRetry=false and maxParallelDownloads
maraf Jun 9, 2023
c4d3fa0
Properly set hybrid globalization
maraf Jun 9, 2023
c236198
Fix merging configs
maraf Jun 12, 2023
5ab1b0b
Use latest test-main for .NET 8.0 or empty target framework
maraf Jun 13, 2023
793ce2b
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 13, 2023
01c6104
Feedback
maraf Jun 13, 2023
b0f7f4d
Fix WAB
maraf Jun 13, 2023
7c377fb
Fix threads-minimal sample
maraf Jun 13, 2023
91162cb
Fix WBT using GetFilesTable
maraf Jun 13, 2023
ca4c6f3
Feedback
maraf Jun 13, 2023
90ccf1f
Syntax
maraf Jun 13, 2023
b871e28
WasmRuntimeAssetsLocation
maraf Jun 13, 2023
51d7222
WasmEnableRuntimeAssetsLocation
maraf Jun 19, 2023
5a88c5c
Revert --no-exit
maraf Jun 19, 2023
6fc1f06
WasmEnableRuntimeAssetsLocation default value comment
maraf Jun 19, 2023
f832ac0
Flat output structure for advanced sample
maraf Jun 19, 2023
f5c07cd
Feedback
maraf Jun 19, 2023
2ff44c8
Fix browser-threads-minimal
maraf Jun 20, 2023
b523c63
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 20, 2023
8a5f657
Use flat structure for template wbt
maraf Jun 20, 2023
cc0568c
Use flat structure for template wbt (fix)
maraf Jun 20, 2023
8c1f461
Fix WBT hybrid
maraf Jun 20, 2023
cb6ffa1
More WBT fixes
maraf Jun 20, 2023
b23186e
Update dotnet.js import in templates
maraf Jun 20, 2023
270c00d
Rename test-main.js to test-main.mjs
maraf Jun 21, 2023
16474e9
Rename test-main.js to test-main.mjs (2)
maraf Jun 21, 2023
c7c9efa
Merge remote-tracking branch 'upstream/main' into WasmUnifyBootConfig…
maraf Jun 21, 2023
f8b415e
WBT icu
maraf Jun 21, 2023
aed2640
WBT templates
maraf Jun 21, 2023
0445f7c
WBT with flat output
maraf Jun 21, 2023
d4c4db8
Always asume blazor.boot.json is next to the dotnet.js (if not specif…
maraf Jun 21, 2023
71ec250
Feedback
maraf Jun 23, 2023
023387f
Feedback WBT templates
maraf Jun 23, 2023
e690d6e
Feedback symbols
maraf Jun 23, 2023
6c7eb28
DebugLevel
maraf Jun 23, 2023
ccf8234
Feedback WasmRuntimeAssetsLocation message
maraf Jun 23, 2023
2e119ce
Revert "Rename test-main.js to test-main.mjs"
maraf Jun 27, 2023
9c0ce98
Merge remote-tracking branch 'origin/main' into WasmUnifyBootConfigSc…
radical Jun 27, 2023
e027248
[wasm] WBT: Add --module for enabling use of es6 modules
radical Jun 27, 2023
d059cec
Add --module only for v8
radical Jun 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public async Task InitializeAsync()
{
if (_module == null)
{
_module = await JSHost.ImportAsync("Timers", "./timers.mjs");
_module = await JSHost.ImportAsync("Timers", "../timers.mjs");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public unsafe void StructSize()
[Fact]
public async Task MultipleImportAsync()
{
var first = await JSHost.ImportAsync("JavaScriptTestHelper", "./JavaScriptTestHelper.mjs");
var second = await JSHost.ImportAsync("JavaScriptTestHelper", "./JavaScriptTestHelper.mjs");
var first = await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs");
var second = await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs");
Assert.NotNull(first);
Assert.NotNull(second);
Assert.Equal("object", first.GetTypeOfProperty("instance"));
Expand All @@ -36,12 +36,12 @@ public async Task MultipleImportAsync()
public async Task CancelableImportAsync()
{
var cts = new CancellationTokenSource();
var exTask = Assert.ThrowsAsync<JSException>(async () => await JSHost.ImportAsync("JavaScriptTestHelper", "./JavaScriptTestHelper.mjs", cts.Token));
var exTask = Assert.ThrowsAsync<JSException>(async () => await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs", cts.Token));
cts.Cancel();
var actualEx2 = await exTask;
Assert.Equal("OperationCanceledException", actualEx2.Message);

var actualEx = await Assert.ThrowsAsync<JSException>(async () => await JSHost.ImportAsync("JavaScriptTestHelper", "./JavaScriptTestHelper.mjs", new CancellationToken(true)));
var actualEx = await Assert.ThrowsAsync<JSException>(async () => await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs", new CancellationToken(true)));
Assert.Equal("OperationCanceledException", actualEx.Message);
}

Expand Down Expand Up @@ -300,7 +300,7 @@ public static IEnumerable<object[]> MarshalObjectArrayCases()
yield return new object[] { new object[] { "JSData" } }; // special cased, so we call createData in the test itself
yield return new object[] { new object[] { new byte[] { }, new int[] { }, new double[] { }, new string[] { }, new object[] { } } };
yield return new object[] { new object[] { new byte[] { 1, 2, 3 }, new int[] { 1, 2, 3 }, new double[] { 1, 2, 3 }, new string[] { "a", "b", "c" }, new object[] { } } };
yield return new object[] { new object[] { new object[] { new byte[] { 1, 2, 3 }, new int[] { 1, 2, 3 }, new double[] { 1, 2, 3 }, new string[] { "a", "b", "c" } , new object(), new SomethingRef(), new SomethingStruct(), new Exception("test") } } };
yield return new object[] { new object[] { new object[] { new byte[] { 1, 2, 3 }, new int[] { 1, 2, 3 }, new double[] { 1, 2, 3 }, new string[] { "a", "b", "c" }, new object(), new SomethingRef(), new SomethingStruct(), new Exception("test") } } };
yield return new object[] { new object[] { } };
yield return new object[] { null };
}
Expand All @@ -317,10 +317,10 @@ public unsafe void JsImportObjectArray(object[]? expected)
Assert.Equal(expected, actual);

if (expected != null) for (int i = 0; i < expected.Length; i++)
{
var actualI = JavaScriptTestHelper.store_ObjectArray(expected, i);
Assert.Equal(expected[i], actualI);
}
{
var actualI = JavaScriptTestHelper.store_ObjectArray(expected, i);
Assert.Equal(expected[i], actualI);
}
}

public static IEnumerable<object[]> MarshalObjectArrayCasesToDouble()
Expand Down Expand Up @@ -362,7 +362,7 @@ public static IEnumerable<object[]> MarshalObjectArrayCasesThrow()
yield return new object[] { new object[] { (ushort)0 } };
yield return new object[] { new object[] { new SomethingStruct[] { } } };
yield return new object[] { new object[] { new SomethingRef[] { }, } };
yield return new object[] { new object[] { new ArraySegment<byte>(new byte[] { 11 }) , } };
yield return new object[] { new object[] { new ArraySegment<byte>(new byte[] { 11 }), } };
}
delegate void dummyDelegate();
static void dummyDelegateA()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void Optimized0V()
[JSExport]
public static void Optimized1V(int a1)
{
optimizedReached+= a1;
optimizedReached += a1;
}
[JSImport("invoke1V", "JavaScriptTestHelper")]
public static partial void invoke1V(int a1);
Expand All @@ -85,8 +85,8 @@ public static int Optimized1R(int a1)
[JSExport]
public static int Optimized2R(int a1, int a2)
{
optimizedReached += a1+ a2;
return a1 + a2 +1;
optimizedReached += a1 + a2;
return a1 + a2 + 1;
}
[JSImport("invoke2R", "JavaScriptTestHelper")]
public static partial int invoke2R(int a1, int a2);
Expand Down Expand Up @@ -997,7 +997,7 @@ public static async Task InitializeAsync()
if (_module == null)
{
// Log("JavaScriptTestHelper.mjs importing");
_module = await JSHost.ImportAsync("JavaScriptTestHelper", "./JavaScriptTestHelper.mjs");
_module = await JSHost.ImportAsync("JavaScriptTestHelper", "../JavaScriptTestHelper.mjs");
await Setup();
// Log("JavaScriptTestHelper.mjs imported");
}
Expand All @@ -1010,7 +1010,7 @@ namespace JavaScriptTestHelperNamespace
public partial class JavaScriptTestHelper
{
[System.Runtime.InteropServices.JavaScript.JSExport]
public static string EchoString(string message)
public static string EchoString(string message)
{
return message + "11";
}
Expand All @@ -1019,7 +1019,7 @@ private partial class NestedClass
{
[System.Runtime.InteropServices.JavaScript.JSExport]
public static string EchoString(string message) => message + "12";

private partial class DoubleNestedClass
{
[System.Runtime.InteropServices.JavaScript.JSExport]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace System.Runtime.InteropServices.JavaScript.Tests
public partial class SecondRuntimeTest
{
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowserDomSupportedOrNodeJS))]
public static async Task RunSecondRuntimeAndTestStaticState()
public static async Task RunSecondRuntimeAndTestStaticState()
{
await JSHost.ImportAsync("SecondRuntimeTest", "./SecondRuntimeTest.js");
await JSHost.ImportAsync("SecondRuntimeTest", "../SecondRuntimeTest.js");

Interop.State = 42;
var state2 = await Interop.RunSecondRuntimeAndTestStaticState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export async function runSecondRuntimeAndTestStaticState() {
const { dotnet: dotnet2 } = await import('./dotnet.js?instance=2');
const { dotnet: dotnet2 } = await import('./_framework/dotnet.js?instance=2');
const runtime2 = await dotnet2
.withStartupMemoryCache(false)
.withConfig({
Expand Down
4 changes: 2 additions & 2 deletions src/mono/sample/mbr/browser/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dotnet } from './dotnet.js'
import { dotnet } from './_framework/dotnet.js'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So anyone consuming the runtime needs to hardcode _framework into their paths now, I guess this is an official part of the ABI?

Copy link
Member

@pavelsavara pavelsavara Jun 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changing layout is breaking change for non-blazor templates.
I'm OK with it.
cc @radical @lewing

Edit: I don't like the "hardcoging" part of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would it take to make the deployment path configurable ? And only make it _framework for Blazor ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be as a close to blazor as possible. Since non-blazor templates are "experimental", I wouldn't about it much, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to get to blazor by setting some properties, but the default should not be blazor. We do have the browser/console templates.


try {
const { getAssemblyExports } = await dotnet
Expand All @@ -8,7 +8,7 @@ try {
const exports = await getAssemblyExports("WasmDelta.dll");
const update = exports.Sample.Test.Update;
const testMeaning = exports.Sample.Test.TestMeaning;

const outElement = document.getElementById("out");
document.getElementById("update").addEventListener("click", function () {
update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<_ServeHeaders>$(_ServeHeaders) -h &quot;Content-Security-Policy: default-src 'self' 'wasm-unsafe-eval'&quot;</_ServeHeaders>
<!-- enable reporting to profiler in browser dev tools -->
<WasmProfilers>browser;</WasmProfilers>

<!-- Put "framework" (dotnet.js, dlls, etc) files directly into the AppBundle -->
<WasmRuntimeAssetsLocation>./</WasmRuntimeAssetsLocation>
</PropertyGroup>
<ItemGroup>
<WasmExtraFilesToDeploy Include="main.js" />
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval';" />
<script type='module' src="./main.js"></script>
<script type='module' src="./dotnet.js"></script>
<script type='module' src="./_framework/dotnet.js"></script>
<link rel="preload" href="./_framework/blazor.boot.json" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.runtime.js" as="fetch" crossorigin="anonymous">
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-advanced/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ try {
// here we show how emscripten could be further configured
// It is preferred to use specific 'with***' methods instead in all other cases.
.withModuleConfig({
configSrc: "./_framework/blazor.boot.json",
configSrc: "./blazor.boot.json",
pavelsavara marked this conversation as resolved.
Show resolved Hide resolved
onConfigLoaded: (config) => {
// This is called during emscripten `dotnet.wasm` instantiation, after we fetched config.
console.log('user code Module.onConfigLoaded');
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-bench/appstart-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" src="./frame-main.js"></script>
<script type='module' src="./dotnet.js"></script>
<script type='module' src="./_framework/dotnet.js"></script>
<link rel="preload" href="./_framework/blazor.boot.json" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.runtime.js" as="fetch" crossorigin="anonymous">
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-bench/frame-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"use strict";

import { dotnet, exit } from './dotnet.js'
import { dotnet, exit } from './_framework/dotnet.js'

class FrameApp {
async init({ getAssemblyExports }) {
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-bench/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"use strict";

import { dotnet, exit } from './dotnet.js'
import { dotnet, exit } from './_framework/dotnet.js'

let runBenchmark;
let setTasks;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-eventpipe/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import { dotnet, exit } from "./dotnet.js";
import { dotnet, exit } from "./_framework/dotnet.js";

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-profile/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import { dotnet, exit } from './dotnet.js'
import { dotnet, exit } from './_framework/dotnet.js'

function saveProfile(aotProfileData) {
if (!aotProfileData) {
Expand Down
Loading