Skip to content

Commit 7e316e2

Browse files
ilonatommyradical
andauthored
[wasm] Fix AOT publish in paths with space on Windows (#94166)
* 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>
1 parent 8bce5a8 commit 7e316e2

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

src/mono/wasm/Wasm.Build.Tests/Common/BuildEnvironment.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public class BuildEnvironment
3232
public static readonly string RelativeTestAssetsPath = @"..\testassets\";
3333
public static readonly string TestAssetsPath = Path.Combine(AppContext.BaseDirectory, "testassets");
3434
public static readonly string TestDataPath = Path.Combine(AppContext.BaseDirectory, "data");
35-
public static readonly string TmpPath = Path.Combine(AppContext.BaseDirectory, "wbt");
35+
// ActiveIssue for Linux/OSx: https://github.com/dotnet/runtime/issues/92335
36+
public static readonly string TmpPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
37+
Path.Combine(AppContext.BaseDirectory, "wbt artifacts") :
38+
Path.Combine(AppContext.BaseDirectory, "wbt");
3639

3740
public static readonly string DefaultRuntimeIdentifier =
3841
#if TARGET_WASI

src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public void ConfigSrcAbsolutePath(BuildArgs buildArgs, RunHost host, string id)
3232
string bundleDir = Path.Combine(binDir, "AppBundle");
3333
string configSrc = Path.GetFullPath(Path.Combine(bundleDir, "_framework", "blazor.boot.json"));
3434

35-
RunAndTestWasmApp(buildArgs, expectedExitCode: 42, host: host, id: id, extraXHarnessMonoArgs: $"--config-src={configSrc}");
35+
RunAndTestWasmApp(buildArgs, expectedExitCode: 42, host: host, id: id, extraXHarnessMonoArgs: $"--config-src=\"{configSrc}\"");
3636
}
3737
}

src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void IntermediateBitcodeToObjectFilesAreNotLLVMIR(BuildArgs buildArgs, st
6565
{
6666
string printFileTypeTarget = @"
6767
<Target Name=""PrintIntermediateFileType"" AfterTargets=""WasmNestedPublishApp"">
68-
<Exec Command=""wasm-dis $(_WasmIntermediateOutputPath)System.Private.CoreLib.dll.o -o $(_WasmIntermediateOutputPath)wasm-dis-out.txt""
68+
<Exec Command=""wasm-dis &quot;$(_WasmIntermediateOutputPath)System.Private.CoreLib.dll.o&quot; -o &quot;$(_WasmIntermediateOutputPath)wasm-dis-out.txt&quot;""
6969
EnvironmentVariables=""@(EmscriptenEnvVars)""
7070
IgnoreExitCode=""true"">
7171

src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(string config, st
275275
.WithWorkingDirectory(workingDir);
276276

277277
await using var runner = new BrowserRunner(_testOutput);
278-
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project {projectFile} --forward-console");
278+
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --project \"{projectFile}\" --forward-console");
279279
await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2));
280280
Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines));
281281
}
@@ -285,7 +285,7 @@ private async Task BrowserRunTwiceWithAndThenWithoutBuildAsync(string config, st
285285
.WithWorkingDirectory(workingDir);
286286

287287
await using var runner = new BrowserRunner(_testOutput);
288-
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project {projectFile} --forward-console");
288+
var page = await runner.RunAsync(runCommand, $"run --no-silent -c {config} --no-build --project \"{projectFile}\" --forward-console");
289289
await runner.WaitForExitMessageAsync(TimeSpan.FromMinutes(2));
290290
Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines));
291291
}
@@ -305,7 +305,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP
305305
string workingDir = runOutsideProjectDirectory ? BuildEnvironment.TmpPath : _projectDir!;
306306

307307
{
308-
string runArgs = $"run --no-silent -c {config} --project {projectFile}";
308+
string runArgs = $"run --no-silent -c {config} --project \"{projectFile}\"";
309309
runArgs += " x y z";
310310
using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id)
311311
.WithWorkingDirectory(workingDir)
@@ -321,7 +321,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP
321321

322322
{
323323
// Run with --no-build
324-
string runArgs = $"run --no-silent -c {config} --project {projectFile} --no-build";
324+
string runArgs = $"run --no-silent -c {config} --project \"{projectFile}\" --no-build";
325325
runArgs += " x y z";
326326
using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id)
327327
.WithWorkingDirectory(workingDir);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
</ItemGroup>
417417

418418
<!-- for AOT builds we use llvm-size tool to collect size of the DATA segment in each object file -->
419-
<Exec Command="llvm-size$(_ExeExt) -d --format=sysv @(_AOTObjectFile, ' ')"
419+
<Exec Command="llvm-size$(_ExeExt) -d --format=sysv @(_AOTObjectFile->'&quot;%(Identity)&quot;', ' ')"
420420
Condition="'$(_WasmShouldAOT)' == 'true'"
421421
IgnoreStandardErrorWarningFormat="true"
422422
ConsoleToMsBuild="true"

src/tasks/AotCompilerTask/MonoAOTCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st
951951
if (isDedup)
952952
{
953953
foreach (var aItem in _assembliesToCompile!)
954-
processArgs.Add(aItem.ItemSpec);
954+
processArgs.Add($"\"{aItem.ItemSpec}\"");
955955
}
956956
else
957957
{

0 commit comments

Comments
 (0)