Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Re-enable source generator tests failing due to OOM #60701

Merged
merged 9 commits into from
Nov 2, 2021
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<SdkVersionForWorkloadTesting>6.0.100-rc.2.21474.31</SdkVersionForWorkloadTesting>
lewing marked this conversation as resolved.
Show resolved Hide resolved
<SdkVersionForWorkloadTesting>6.0.100-rtm.21480.21</SdkVersionForWorkloadTesting>
<CompilerPlatformTestingVersion>1.1.1-beta1.21467.5</CompilerPlatformTestingVersion>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>6.0.0-preview-20211019.1</MicrosoftPrivateIntellisenseVersion>
Expand Down
57 changes: 57 additions & 0 deletions eng/testing/WasmRunnerAOTTemplate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

EXECUTION_DIR=$(dirname $0)
SCENARIO=$3

cd $EXECUTION_DIR

if [ -z "$HELIX_WORKITEM_UPLOAD_ROOT" ]; then
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
else
XHARNESS_OUT="$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output"
fi

if [ ! -z "$XHARNESS_CLI_PATH" ]; then
# When running in CI, we only have the .NET runtime available
# We need to call the XHarness CLI DLL directly via dotnet exec
HARNESS_RUNNER="dotnet exec $XHARNESS_CLI_PATH"
else
HARNESS_RUNNER="dotnet xharness"
fi

if [ "$SCENARIO" == "WasmTestOnBrowser" ]; then
XHARNESS_COMMAND="test-browser"
elif [ -z "$XHARNESS_COMMAND" ]; then
XHARNESS_COMMAND="test"
fi

function BuildAOT()
{
local projectFile=$1
local binLog=$2
shift 2

time dotnet msbuild $projectFile /bl:$binLog $*
local buildExitCode=$?

echo "\n** Performance summary for the build **\n"
dotnet msbuild $binLog -clp:PerformanceSummary -v:q -nologo
if [[ "$(uname -s)" == "Linux" && $buildExitCode -ne 0 ]]; then
echo "\nLast few messages from dmesg:\n"
dmesg | tail -n 20
fi

echo
echo

return $buildExitCode
}

# RunCommands defined in tests.mobile.targets
[[RunCommands]]

_exitCode=$?

echo "XHarness artifacts: $XHARNESS_OUT"

exit $_exitCode
3 changes: 2 additions & 1 deletion eng/testing/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<RunScriptInputName Condition="'$(TargetOS)' != 'windows'">RunnerTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">AppleRunnerTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'Android'">AndroidRunnerTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT'">WasmRunnerTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT' and '$(BuildAOTTestsOnHelix)' == 'true'">WasmRunnerAOTTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT' and '$(BuildAOTTestsOnHelix)' != 'true'">WasmRunnerTemplate.sh</RunScriptInputName>
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' == 'Windows_NT'">WasmRunnerTemplate.cmd</RunScriptInputName>
</PropertyGroup>

Expand Down
29 changes: 20 additions & 9 deletions eng/testing/tests.wasm.targets
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
</PropertyGroup>

<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
<_AOTBuildCommand>dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:$XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
<_AOTBuildCommand>BuildAOT publish/ProxyProjectForAOTOnHelix.proj $XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to clearly communicate that this is a function defined in a script, and not a command? (Will it work on Windows?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm how about naming it _buildAOTFunc? or just _buildAOT even.
re:windows, we are not running these on windows yet. And I have a separate PR for that, where I can add the cmd/ps1 equivalent of the new template script.


<!-- running aot-helix tests locally, so we can test with the same project file as CI -->
<_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand>

<_AOTBuildCommand>$(_AOTBuildCommand) /p:RunAOTCompilation=$(RunAOTCompilation) /p:EmccLinkOptimizationFlag='-Oz -Wl%252C-O0 -Wl%252C-lto-O0'</_AOTBuildCommand>
<_AOTBuildCommand>$(_AOTBuildCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</_AOTBuildCommand>
<_AOTBuildCommand>$(_AOTBuildCommand) &amp;&amp; cd wasm_build/AppBundle</_AOTBuildCommand>

<RunScriptCommand Condition="'$(RunScriptCommand)' == ''">$(_AOTBuildCommand)</RunScriptCommand>
Expand Down Expand Up @@ -87,9 +87,15 @@
AssemblyFile="$(WasmBuildTasksAssemblyPath)" />

<Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp">
<PropertyGroup Condition="'$(IsHighAotMemoryUsageTest)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true'">
<DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">true</DisableParallelEmccCompile>
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-O2</EmccLinkOptimizationFlag>
</PropertyGroup>

<PropertyGroup>
<_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
<RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl%252C-O0 -Wl%252C-lto-O0</EmccLinkOptimizationFlag>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An xml comment (doesn't need to be long) explaining why these specific flags were selected would be great here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this one for @radekdoulik to add, since he set these originally.

</PropertyGroup>

<Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" />
Expand All @@ -111,15 +117,20 @@
<!-- To recreate the original project on helix, we need to set the wasm properties also, same as the
library test project. Eg. $(InvariantGlobalization) -->
<ItemGroup>
<_WasmPropertyNames Include="InvariantGlobalization" />
<_WasmPropertyNames Include="AOTMode" />
<_WasmPropertyNames Include="WasmDebugLevel" />
<_WasmPropertyNames Include="AssemblyName" />
<_WasmPropertyNames Include="DisableParallelAot" />
<_WasmPropertyNames Include="DisableParallelEmccCompile" />
<_WasmPropertyNames Include="EmccCompileOptimizationFlag" />
<_WasmPropertyNames Include="EmccLinkOptimizationFlag" />
<_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" />
<_WasmPropertyNames Include="InvariantGlobalization" />
<_WasmPropertyNames Include="WasmBuildNative" />
<_WasmPropertyNames Include="_WasmDevel" />
<_WasmPropertyNames Include="WasmLinkIcalls" />
<_WasmPropertyNames Include="WasmDebugLevel" />
<_WasmPropertyNames Include="WasmDedup" />
<_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" />
<_WasmPropertyNames Include="AssemblyName" />
<_WasmPropertyNames Include="WasmLinkIcalls" />
<_WasmPropertyNames Include="WasmNativeStrip" />
<_WasmPropertyNames Include="_WasmDevel" />

<_WasmPropertiesToPass
Include="$(%(_WasmPropertyNames.Identity))"
Expand Down Expand Up @@ -159,7 +170,7 @@
<WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel>
</PropertyGroup>

<ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true'">
<ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true' and '$(BuildAOTTestsOnHelix)' != 'true'">
<_SatelliteAssemblies Include="$(PublishDir)*\*.resources.dll" />
<_SatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
<_SatelliteAssemblies TargetPath="%(CultureName)\%(FileName)%(Extension)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11)</RoslynApiVersion>
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
</PropertyGroup>

<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion)</RoslynApiVersion>
<DefineConstants>$(DefineConstants);ROSLYN4_0_OR_GREATER</DefineConstants>
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
<EmccLinkOptimizationFlag Condition="'$(ContinuousIntegrationBuild)' == 'true'">-O1</EmccLinkOptimizationFlag>
<WasmNativeStrip>false</WasmNativeStrip>
</PropertyGroup>

<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public class IndexViewModel
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void NameClashSourceGeneration()
{
// Without resolution.
Expand All @@ -149,6 +150,7 @@ public void NameClashSourceGeneration()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void ProgramsThatDontUseGeneratorCompile()
{
// No STJ usage.
Expand Down Expand Up @@ -192,6 +194,7 @@ public static void Main()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void WarnOnClassesWithInitOnlyProperties()
{
Compilation compilation = CompilationHelper.CreateCompilationWithInitOnlyProperties();
Expand All @@ -206,6 +209,7 @@ public void WarnOnClassesWithInitOnlyProperties()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void WarnOnClassesWithInaccessibleJsonIncludeProperties()
{
Compilation compilation = CompilationHelper.CreateCompilationWithInaccessibleJsonIncludeProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace System.Text.Json.SourceGeneration.UnitTests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public class GeneratorTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11)</RoslynApiVersion>
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
</PropertyGroup>

<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion)</RoslynApiVersion>
<DefineConstants>$(DefineConstants);ROSLYN4_0_OR_GREATER</DefineConstants>
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
</PropertyGroup>

<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace System.Text.Json.SourceGeneration.UnitTests
public class TypeWrapperTests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void MetadataLoadFilePathHandle()
{
// Create a MetadataReference from new code.
Expand Down Expand Up @@ -79,6 +80,7 @@ public void MySecondMethod() { }
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
public void CanGetAttributes()
{
string source = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public static IEnumerable<object[]> Match_In_Different_Cultures_CriticalCases_Te
public static IEnumerable<object[]> Match_In_Different_Cultures_CriticalCases_TestData() =>
Match_In_Different_Cultures_CriticalCases_TestData_For(RegexOptions.None).Union(Match_In_Different_Cultures_CriticalCases_TestData_For(RegexOptions.Compiled));

[ActiveIssue("https://github.com/dotnet/runtime/issues/60899", TestPlatforms.Browser)]
[Theory]
[MemberData(nameof(Match_In_Different_Cultures_TestData))]
public void Match_In_Different_Cultures(string pattern, RegexOptions options, CultureInfo culture, string input, string match_expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Nullable>enable</Nullable>
<!-- xUnit2008 is about regexes and isn't appropriate in the test project for regexes -->
<NoWarn>$(NoWarn);xUnit2008</NoWarn>
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 0 additions & 9 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetOS)' == 'Browser' and '$(BuildAOTTestsOnHelix)' == 'true' and '$(RunDisabledWasmTests)' != 'true' and '$(RunAOTCompilation)' == 'true'">
<!-- Exceeds VM resources in CI on compilation: https://github.com/dotnet/runtime/issues/51961 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.Abstractions\tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.Abstractions\tests\Microsoft.Extensions.Logging.Generators.Tests\Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj" />
</ItemGroup>

<!-- Projects that don't support code coverage measurement. -->
Expand Down Expand Up @@ -223,12 +220,6 @@

<!-- https://github.com/dotnet/runtime/issues/58226 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.InteropServices\tests\DllImportGenerator.UnitTests\DllImportGenerator.Unit.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj" />

<!-- hhttps://github.com/dotnet/runtime/issues/60048 -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Generators.Tests\System.Text.RegularExpressions.Generators.Tests.csproj" />
</ItemGroup>

<!-- Aggressive Trimming related failures -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<WasmCopyAppZipToHelixTestDir Condition="'$(ArchiveTests)' == 'true'">true</WasmCopyAppZipToHelixTestDir>
<!-- don't need to run this on helix -->
<WasmCopyAppZipToHelixTestDir>false</WasmCopyAppZipToHelixTestDir>
<WasmMainJSPath>runtime.js</WasmMainJSPath>
</PropertyGroup>

Expand Down
10 changes: 7 additions & 3 deletions src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
<_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h</_WasmPInvokeTablePath>
<_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h</_WasmPInvokeHPath>
<_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c</_DriverGenCPath>
<DisableParallelAot Condition="'$(DisableParallelAot)' == ''">false</DisableParallelAot>
<DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">$(DisableParallelAot)</DisableParallelEmccCompile>

<_DriverGenCNeeded Condition="'$(_DriverGenCNeeded)' == '' and '$(_WasmShouldAOT)' == 'true'">true</_DriverGenCNeeded>

Expand Down Expand Up @@ -283,7 +285,7 @@
<!-- warm up the cache -->
<Exec Command="$(_EmBuilder) build MINIMAL" EnvironmentVariables="@(EmscriptenEnvVars)" StandardOutputImportance="Low" StandardErrorImportance="Low" />

<Message Text="Compiling native assets with emcc. This may take a while ..." Importance="High" />
<Message Text="Compiling native assets with emcc with $(EmccCompileOptimizationFlag). This may take a while ..." Importance="High" />
<ItemGroup>
<_WasmSourceFileToCompile Remove="@(_WasmSourceFileToCompile)" />
<_WasmSourceFileToCompile Include="@(_WasmRuntimePackSrcFile)" Dependencies="%(_WasmRuntimePackSrcFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileRsp)" />
Expand All @@ -292,6 +294,7 @@
SourceFiles="@(_WasmSourceFileToCompile)"
Arguments='"@$(_EmccDefaultFlagsRsp)" "@$(_EmccCompileRsp)"'
EnvironmentVariables="@(EmscriptenEnvVars)"
DisableParallelCompile="$(DisableParallelEmccCompile)"
OutputMessageImportance="$(_EmccCompileOutputMessageImportance)">
<Output TaskParameter="OutputFiles" ItemName="FileWrites" />
</EmccCompile>
Expand All @@ -308,11 +311,12 @@
<_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileBitcodeRsp)" />
</ItemGroup>

<Message Text="Compiling assembly bitcode files..." Importance="High" Condition="@(_BitCodeFile->Count()) > 0" />
<Message Text="Compiling assembly bitcode files with $(EmccLinkOptimizationFlag) ..." Importance="High" Condition="@(_BitCodeFile->Count()) > 0" />
<EmccCompile
SourceFiles="@(_BitCodeFile)"
Arguments="&quot;@$(_EmccDefaultFlagsRsp)&quot; &quot;@$(_EmccCompileBitcodeRsp)&quot;"
EnvironmentVariables="@(EmscriptenEnvVars)"
DisableParallelCompile="$(DisableParallelEmccCompile)"
OutputMessageImportance="$(_EmccCompileOutputMessageImportance)">
<Output TaskParameter="OutputFiles" ItemName="FileWrites" />
</EmccCompile>
Expand Down Expand Up @@ -371,7 +375,7 @@
DependsOnTargets="_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking"
Returns="@(FileWrites)" >

<Message Text="Linking with emcc. This may take a while ..." Importance="High" />
<Message Text="Linking with emcc with $(EmccLinkOptimizationFlag). This may take a while ..." Importance="High" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional suggestion) Maybe put a prefix on these 3 stages like '2/3' to indicate how many more emcc steps are left in the build since each step is so slow

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, a AOT build looks like:

  AOT'ing 31 assemblies
  [1/30] System.ComponentModel.dll -> System.ComponentModel.dll.bc
  [2/30] System.Net.Primitives.dll -> System.Net.Primitives.dll.bc
...

  Compiling native assets with emcc with -Oz. This may take a while ...
  [1/3] pinvoke.c -> pinvoke.o [took 0.331s]
  [2/3] corebindings.c -> corebindings.o [took 0.353s]
...

  Compiling assembly bitcode files with -Oz ...
  [1/30] System.ComponentModel.dll.bc -> System.ComponentModel.dll.o [took 0.498s]
  [2/30] System.Net.Primitives.dll.bc -> System.Net.Primitives.dll.o [took 0.517s]
...

  <linking>

Adding another level of numbering might be confusing. Maybe some other way of communicating the same idea?

<Message Text="Running emcc with @(_EmccLinkStepArgs->'%(Identity)', ' ')" Importance="Low" />
<Exec Command='emcc "@$(_EmccDefaultFlagsRsp)" "@$(_EmccLinkRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ private bool ExecuteInternal()
new ParallelOptions { MaxDegreeOfParallelism = allowedParallelism },
(args, state) => PrecompileLibraryParallel(args, state));

Log.LogMessage(MessageImportance.High, $"result: {result.IsCompleted}");
if (result.IsCompleted)
{
int numUnchanged = _totalNumAssemblies - _numCompiled;
Expand Down
17 changes: 17 additions & 0 deletions src/tasks/WasmAppBuilder/WasmAppBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -222,6 +223,7 @@ private bool ExecuteInternal ()
Directory.CreateDirectory(supportFilesDir);

var i = 0;
StringDictionary targetPathTable = new();
foreach (var item in FilesToIncludeInFileSystem)
{
string? targetPath = item.GetMetadata("TargetPath");
Expand All @@ -232,6 +234,21 @@ private bool ExecuteInternal ()

// We normalize paths from `\` to `/` as MSBuild items could use `\`.
targetPath = targetPath.Replace('\\', '/');
if (targetPathTable.ContainsKey(targetPath))
{
string firstPath = Path.GetFullPath(targetPathTable[targetPath]!);
string secondPath = Path.GetFullPath(item.ItemSpec);

if (firstPath == secondPath)
{
Log.LogWarning($"Found identical vfs mappings for target path: {targetPath}, source file: {firstPath}. Ignoring.");
continue;
}

throw new LogAsErrorException($"Found more than one file mapping to the target VFS path: {targetPath}. Source files: {firstPath}, and {secondPath}");
}

targetPathTable[targetPath] = item.ItemSpec;

var generatedFileName = $"{i++}_{Path.GetFileName(item.ItemSpec)}";

Expand Down