Skip to content

Commit 33dbf98

Browse files
committed
PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time
.. instead of depending on *one* runtime pack version. This is needed when we have more than one workload installed.
1 parent 1a731fb commit 33dbf98

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,21 @@ public static void Main()
462462
463463
""";
464464

465+
string tasksDir = Path.Combine(s_buildEnv.WorkloadPacksDir,
466+
"Microsoft.NET.Runtime.WebAssembly.Sdk",
467+
s_buildEnv.GetRuntimePackVersion(DefaultTargetFramework),
468+
"tasks");
469+
if (!Directory.Exists(tasksDir))
470+
throw new DirectoryNotFoundException($"Could not find tasks directory {tasksDir}");
471+
472+
string? taskPath = Directory.EnumerateFiles(tasksDir, "WasmAppBuilder.dll", SearchOption.AllDirectories)
473+
.FirstOrDefault();
474+
if (string.IsNullOrEmpty(taskPath))
475+
throw new FileNotFoundException($"Could not find WasmAppBuilder.dll in {tasksDir}");
476+
465477
projectCode = projectCode
466478
.Replace("###WasmPInvokeModule###", AddAssembly("System.Private.CoreLib") + AddAssembly("System.Runtime") + AddAssembly(libraryBuildArgs.ProjectName))
467-
.Replace("###WasmAppBuilder###", Path.Combine(s_buildEnv.WorkloadPacksDir, "Microsoft.NET.Runtime.WebAssembly.Sdk", s_buildEnv.GetRuntimePackVersion(), "tasks", DefaultTargetFramework, "WasmAppBuilder.dll"));
479+
.Replace("###WasmAppBuilder###", taskPath);
468480

469481
buildArgs = buildArgs with { ProjectName = $"icall_enum_{buildArgs.Config}_{id}", ProjectFileContents = projectCode };
470482

0 commit comments

Comments
 (0)