Skip to content

Commit

Permalink
[wasm] Wasm.Build.Tests: Use the default cache for emcc (dotnet#76694)
Browse files Browse the repository at this point in the history
* [wasm] Wasm.Build.Tests: Use the default cache for emcc

On windows, WBT overrides the cache path to a new directory -
`~/.emscripten-cache`. Because of this the first native build takes a
long time (~16-20mins) as it run `embuilder build MINIMAL`.

Instead, we can use the new workload pack for emscripten Cache, which is
the default behavior. So, not overriding the cache path improves the
test run times on windows by ~17-20mins.

* [wasm] WBT: Use multithreading with robocopy when copying dotnet on helix
  • Loading branch information
radical authored Oct 7, 2022
1 parent d83ec0e commit ca50108
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 22 deletions.
6 changes: 0 additions & 6 deletions src/mono/wasm/Wasm.Build.Tests/BuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ public BuildEnvironment()
EnvVars["DOTNET_CLI_DO_NOT_USE_MSBUILD_SERVER"] = "1";
DefaultBuildArgs += " /nr:false";

if (OperatingSystem.IsWindows())
{
EnvVars["WasmCachePath"] = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".emscripten-cache");
}

DotNet = Path.Combine(sdkForWorkloadPath!, "dotnet");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
DotNet += ".exe";
Expand Down
3 changes: 0 additions & 3 deletions src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@ public string CreateWasmTemplateProject(string id, string template = "wasmbrowse
File.WriteAllText(Path.Combine(_projectDir, "Directory.Build.targets"),
"""
<Project>
<ItemGroup>
<EmscriptenEnvVars Include="FROZEN_CACHE=" Condition="'$(OS)' == 'Windows_NT'" />
</ItemGroup>
<Target Name="PrintRuntimePackPath" BeforeTargets="Build">
<Message Text="** MicrosoftNetCoreAppRuntimePackDir : '@(ResolvedRuntimePack -> '%(PackageDirectory)')'" Importance="High" Condition="@(ResolvedRuntimePack->Count()) > 0" />
</Target>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<Project>
<ItemGroup>
<EmscriptenEnvVars Include="FROZEN_CACHE=" Condition="'$(OS)' == 'Windows_NT'" />
</ItemGroup>

<Target Name="PrintRuntimePackPath" BeforeTargets="Build">
<Message Text="** MicrosoftNetCoreAppRuntimePackDir : '@(ResolvedRuntimePack -> '%(PackageDirectory)')'" Importance="High" Condition="@(ResolvedRuntimePack->Count()) > 0" />
</Target>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<Project>
<ItemGroup>
<EmscriptenEnvVars Include="FROZEN_CACHE=" Condition="'$(OS)' == 'Windows_NT'" />
</ItemGroup>

<Target Name="PrintRuntimePackPath" BeforeTargets="Build">
<Message Text="** MicrosoftNetCoreAppRuntimePackDir : '@(ResolvedRuntimePack -> '%(PackageDirectory)')'" Importance="High" Condition="@(ResolvedRuntimePack->Count()) > 0" />
</Target>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/Wasm.Build.Tests/data/RunScriptTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if [%TEST_USING_WORKLOADS%] == [true] (
)

if [%HELIX_CORRELATION_PAYLOAD%] NEQ [] (
robocopy /np /nfl /NDL /NJH /NJS /nc /e %BASE_DIR%\%_DIR_NAME% %EXECUTION_DIR%\%_DIR_NAME%
robocopy /mt /np /nfl /NDL /nc /e %BASE_DIR%\%_DIR_NAME% %EXECUTION_DIR%\%_DIR_NAME%
set _SDK_DIR=%EXECUTION_DIR%\%_DIR_NAME%
) else (
set _SDK_DIR=%BASE_DIR%\%_DIR_NAME%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<Project>
<ItemGroup>
<EmscriptenEnvVars Include="FROZEN_CACHE=" Condition="'$(OS)' == 'Windows_NT'" />
</ItemGroup>

<Target Name="PrintRuntimePackPath" BeforeTargets="Build">
<Message Text="** MicrosoftNetCoreAppRuntimePackDir : '@(ResolvedRuntimePack -> '%(PackageDirectory)')'" Importance="High" Condition="@(ResolvedRuntimePack->Count()) > 0" />
</Target>
Expand Down

0 comments on commit ca50108

Please sign in to comment.