From 2bbc3265c7ceca01d02dc90cfccf505c75b4e7fe Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 30 Oct 2023 12:43:23 +0100 Subject: [PATCH 1/9] Fix --- src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs | 5 ++++- src/mono/wasm/build/WasmApp.Native.targets | 2 +- src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs index 21feaea66f28e7..5ec25c83cf74b9 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs @@ -30,7 +30,10 @@ public class BuildEnvironment public static readonly string RelativeTestAssetsPath = @"..\testassets\"; public static readonly string TestAssetsPath = Path.Combine(AppContext.BaseDirectory, "testassets"); public static readonly string TestDataPath = Path.Combine(AppContext.BaseDirectory, "data"); - public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt"); + // ActiveIssue for Linux/OSx: https://github.com/dotnet/runtime/issues/92335 + public static readonly string TmpPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? + Path.Combine(AppContext.BaseDirectory, "wbt artifacts") : + Path.Combine(AppContext.BaseDirectory, "wbt"); public static readonly string DefaultRuntimeIdentifier = #if TARGET_WASI diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 73e5720abb01ed..52b2988f8dd3d3 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -415,7 +415,7 @@ - Date: Mon, 30 Oct 2023 15:55:30 +0100 Subject: [PATCH 2/9] Fix template wbt --- .../wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs index 08488d487a6151..821fd528e22479 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs @@ -277,7 +277,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(string config, st .WithWorkingDirectory(workingDir); await using var runner = new BrowserRunner(_testOutput); - var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project {projectFile} --forward-console"); + var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project \"{projectFile}\" --forward-console"); await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2)); Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines)); } @@ -287,7 +287,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(string config, st .WithWorkingDirectory(workingDir); await using var runner = new BrowserRunner(_testOutput); - var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project {projectFile} --forward-console"); + var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project \"{projectFile}\" --forward-console"); await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2)); Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines)); } @@ -307,7 +307,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP string workingDir = runOutsideProjectDirectory ? BuildEnvironment.TmpPath : _projectDir!; { - string runArgs = $"run --no-silent -c {config} --project {projectFile}"; + string runArgs = $"run --no-silent -c {config} --project \"{projectFile}\""; runArgs += " x y z"; using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id) .WithWorkingDirectory(workingDir) @@ -323,7 +323,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP { // Run with --no-build - string runArgs = $"run --no-silent -c {config} --project {projectFile} --no-build"; + string runArgs = $"run --no-silent -c {config} --project \"{projectFile}\" --no-build"; runArgs += " x y z"; using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id) .WithWorkingDirectory(workingDir); From 06b29d82bdebc1d6eb3852409f12f61e946ddf69 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 30 Oct 2023 16:01:06 +0100 Subject: [PATCH 3/9] Fix config wbt. --- src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs index ac71dafe0eb305..329ecbe0b49ca7 100644 --- a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs @@ -32,6 +32,6 @@ public void ConfigSrcAbsolutePath(BuildArgs buildArgs, RunHost host, string id) string bundleDir = Path.Combine(binDir, "AppBundle"); string configSrc = Path.GetFullPath(Path.Combine(bundleDir, "_framework", "blazor.boot.json")); - RunAndTestWasmApp(buildArgs, expectedExitCode: 42, host: host, id: id, extraXHarnessMonoArgs: $"--config-src={configSrc}"); + RunAndTestWasmApp(buildArgs, expectedExitCode: 42, host: host, id: id, extraXHarnessMonoArgs: $"--config-src=\"{configSrc}\""); } } From bcc6fa22aeb6b705bb1677723a032958e5520cd6 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Mon, 30 Oct 2023 16:43:43 +0100 Subject: [PATCH 4/9] Should fix native wbt but does not. --- src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs b/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs index 0ea7aaf7bfa8f2..dc9997b3e79b8b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs @@ -70,7 +70,7 @@ public void IntermediateBitcodeToObjectFilesAreNotLLVMIR(BuildArgs buildArgs, st { string printFileTypeTarget = @" - From 2b8dc2231c10f5bab883b83c8711336f1459fed2 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 31 Oct 2023 10:39:39 +0100 Subject: [PATCH 5/9] Missing change. --- src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs b/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs index dc9997b3e79b8b..3d30a5c8411527 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs @@ -70,7 +70,7 @@ public void IntermediateBitcodeToObjectFilesAreNotLLVMIR(BuildArgs buildArgs, st { string printFileTypeTarget = @" - From f989fc3c964cabcf572104f76d21b71688171a02 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:53:50 +0100 Subject: [PATCH 6/9] Update src/tasks/AotCompilerTask/MonoAOTCompiler.cs Co-authored-by: Ankit Jain --- src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index 7d22da51109fa3..f0d2ba39eda009 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -951,7 +951,7 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st if (isDedup) { foreach (var aItem in _assembliesToCompile!) - processArgs.Add('"' + aItem.ItemSpec + '"'); + processArgs.Add($"'{aItem.ItemSpec}'"); } else { From 4ffa657eada2e4012fef4ef452c708633426a1db Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 1 Nov 2023 11:55:51 +0100 Subject: [PATCH 7/9] Double quotes needed, not single. --- src/tasks/AotCompilerTask/MonoAOTCompiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index f0d2ba39eda009..0a761b44a4c8f2 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -951,7 +951,7 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st if (isDedup) { foreach (var aItem in _assembliesToCompile!) - processArgs.Add($"'{aItem.ItemSpec}'"); + processArgs.Add($"\"{aItem.ItemSpec}\""); } else { From 3aae4b3a5a9f46da66a5f9f0971d387254af73ba Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:53:49 +0200 Subject: [PATCH 8/9] Space on Linux should work. --- src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs index 5ec25c83cf74b9..0674991bc1d3a0 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs @@ -30,10 +30,7 @@ public class BuildEnvironment public static readonly string RelativeTestAssetsPath = @"..\testassets\"; public static readonly string TestAssetsPath = Path.Combine(AppContext.BaseDirectory, "testassets"); public static readonly string TestDataPath = Path.Combine(AppContext.BaseDirectory, "data"); - // ActiveIssue for Linux/OSx: https://github.com/dotnet/runtime/issues/92335 - public static readonly string TmpPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? - Path.Combine(AppContext.BaseDirectory, "wbt artifacts") : - Path.Combine(AppContext.BaseDirectory, "wbt"); + public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt artifacts"); public static readonly string DefaultRuntimeIdentifier = #if TARGET_WASI From e3f16b6d5611697ef9d4defd29af19511fcca7ab Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 16 Apr 2024 11:09:39 +0200 Subject: [PATCH 9/9] Backport https://github.com/dotnet/runtime/pull/94306 --- src/mono/wasm/build/WasmApp.targets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index 0a22f3f82d528f..a640a128b25044 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -81,7 +81,7 @@ - $(WasmAllowUndefinedSymbols) - Controls whether undefined symbols are allowed or not, if true, appends 'allow-undefined' and sets 'ERROR_ON_UNDEFINED_SYMBOLS=0' as arguments for wasm-ld, if false (default), removes 'allow-undefined' and sets 'ERROR_ON_UNDEFINED_SYMBOLS=1'. - - $(WasmRuntimeAssetsLocation) - Allows to override a location for build generated files. + - $(WasmRuntimeAssetsLocation) - Allows to override a location for build generated files. Defaults to '_framework', if you want to put framework files in the same directory as user files, use './' value. Output structure - AppBundle directly contains user files @@ -367,8 +367,8 @@ - - + + <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.wasm'">true <_HasDotnetJsWorker Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.native.worker.js'">true @@ -415,7 +415,7 @@ Outputs="$(WasmAppDir)\.stamp" Condition="'$(WasmGenerateAppBundle)' == 'true'" DependsOnTargets="_WasmGenerateRuntimeConfig;_GetWasmGenerateAppBundleDependencies"> - + <_WasmAppIncludeThreadsWorker Condition="'$(WasmEnableThreads)' == 'true' or '$(MonoWasmBuildVariant)' == 'multithread'">true @@ -473,7 +473,7 @@ - + - +