Skip to content

Commit

Permalink
[wasm] Fix AOT publish in paths with space on Windows (#94166)
Browse files Browse the repository at this point in the history
* Fix

* Fix template wbt

* Fix config wbt.

* Should fix native wbt but does not.

* Missing change.

* Update src/tasks/AotCompilerTask/MonoAOTCompiler.cs

Co-authored-by: Ankit Jain <radical@gmail.com>

* Double quotes needed, not single.

---------

Co-authored-by: Ankit Jain <radical@gmail.com>
  • Loading branch information
ilonatommy and radical committed Nov 1, 2023
1 parent 8bce5a8 commit 7e316e2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"");
}
}
2 changes: 1 addition & 1 deletion src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void IntermediateBitcodeToObjectFilesAreNotLLVMIR(BuildArgs buildArgs, st
{
string printFileTypeTarget = @"
<Target Name=""PrintIntermediateFileType"" AfterTargets=""WasmNestedPublishApp"">
<Exec Command=""wasm-dis $(_WasmIntermediateOutputPath)System.Private.CoreLib.dll.o -o $(_WasmIntermediateOutputPath)wasm-dis-out.txt""
<Exec Command=""wasm-dis &quot;$(_WasmIntermediateOutputPath)System.Private.CoreLib.dll.o&quot; -o &quot;$(_WasmIntermediateOutputPath)wasm-dis-out.txt&quot;""
EnvironmentVariables=""@(EmscriptenEnvVars)""
IgnoreExitCode=""true"">
Expand Down
8 changes: 4 additions & 4 deletions src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,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));
}
Expand All @@ -285,7 +285,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));
}
Expand All @@ -305,7 +305,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)
Expand All @@ -321,7 +321,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);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
</ItemGroup>

<!-- for AOT builds we use llvm-size tool to collect size of the DATA segment in each object file -->
<Exec Command="llvm-size$(_ExeExt) -d --format=sysv @(_AOTObjectFile, ' ')"
<Exec Command="llvm-size$(_ExeExt) -d --format=sysv @(_AOTObjectFile->'&quot;%(Identity)&quot;', ' ')"
Condition="'$(_WasmShouldAOT)' == 'true'"
IgnoreStandardErrorWarningFormat="true"
ConsoleToMsBuild="true"
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 7e316e2

Please sign in to comment.