Skip to content

Commit 5a078b5

Browse files
radicallewing
andauthored
[wasm] Re-enable source generator tests failing due to OOM (#60701)
This adds support for setting per-project optimization flags, and sets them for these projects so they don't OOM. Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests System.Text.RegularExpressions.Generators.Tests Some individual ones are disabled due to #58226, and #60899 . Additionally, if a AOT build fails, then on linux it dumps the last few lines from dmesg, to help identify it was an oom-kill. Fixes #51961 . Co-authored-by: Larry Ewing <lewing@microsoft.com>
1 parent 0691c75 commit 5a078b5

File tree

17 files changed

+120
-24
lines changed

17 files changed

+120
-24
lines changed

eng/testing/WasmRunnerAOTTemplate.sh

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
EXECUTION_DIR=$(dirname $0)
4+
SCENARIO=$3
5+
6+
cd $EXECUTION_DIR
7+
8+
if [ -z "$HELIX_WORKITEM_UPLOAD_ROOT" ]; then
9+
XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
10+
else
11+
XHARNESS_OUT="$HELIX_WORKITEM_UPLOAD_ROOT/xharness-output"
12+
fi
13+
14+
if [ ! -z "$XHARNESS_CLI_PATH" ]; then
15+
# When running in CI, we only have the .NET runtime available
16+
# We need to call the XHarness CLI DLL directly via dotnet exec
17+
HARNESS_RUNNER="dotnet exec $XHARNESS_CLI_PATH"
18+
else
19+
HARNESS_RUNNER="dotnet xharness"
20+
fi
21+
22+
if [ "$SCENARIO" == "WasmTestOnBrowser" ]; then
23+
XHARNESS_COMMAND="test-browser"
24+
elif [ -z "$XHARNESS_COMMAND" ]; then
25+
XHARNESS_COMMAND="test"
26+
fi
27+
28+
function _buildAOTFunc()
29+
{
30+
local projectFile=$1
31+
local binLog=$2
32+
shift 2
33+
34+
time dotnet msbuild $projectFile /bl:$binLog $*
35+
local buildExitCode=$?
36+
37+
echo "\n** Performance summary for the build **\n"
38+
dotnet msbuild $binLog -clp:PerformanceSummary -v:q -nologo
39+
if [[ "$(uname -s)" == "Linux" && $buildExitCode -ne 0 ]]; then
40+
echo "\nLast few messages from dmesg:\n"
41+
dmesg | tail -n 20
42+
fi
43+
44+
echo
45+
echo
46+
47+
return $buildExitCode
48+
}
49+
50+
# RunCommands defined in tests.mobile.targets
51+
[[RunCommands]]
52+
53+
_exitCode=$?
54+
55+
echo "XHarness artifacts: $XHARNESS_OUT"
56+
57+
exit $_exitCode

eng/testing/tests.targets

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<RunScriptInputName Condition="'$(BuildTestsOnHelix)' == 'true' and '$(TargetsAppleMobile)' == 'true'">AppleHelixRunnerTemplate.sh</RunScriptInputName>
66
<RunScriptInputName Condition="'$(BuildTestsOnHelix)' != 'true' and '$(TargetsAppleMobile)' == 'true'">AppleRunnerTemplate.sh</RunScriptInputName>
77
<RunScriptInputName Condition="'$(TargetOS)' == 'Android'">AndroidRunnerTemplate.sh</RunScriptInputName>
8-
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT'">WasmRunnerTemplate.sh</RunScriptInputName>
8+
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT' and '$(BuildAOTTestsOnHelix)' == 'true'">WasmRunnerAOTTemplate.sh</RunScriptInputName>
9+
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' != 'Windows_NT' and '$(BuildAOTTestsOnHelix)' != 'true'">WasmRunnerTemplate.sh</RunScriptInputName>
910
<RunScriptInputName Condition="'$(TargetOS)' == 'Browser' and '$(OS)' == 'Windows_NT'">WasmRunnerTemplate.cmd</RunScriptInputName>
1011
</PropertyGroup>
1112

eng/testing/tests.wasm.targets

+20-9
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
</PropertyGroup>
3939

4040
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'">
41-
<_AOTBuildCommand>dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:$XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
41+
<_AOTBuildCommand>_buildAOTFunc publish/ProxyProjectForAOTOnHelix.proj $XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand>
4242

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

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

4949
<RunScriptCommand Condition="'$(RunScriptCommand)' == ''">$(_AOTBuildCommand)</RunScriptCommand>
@@ -87,9 +87,15 @@
8787
AssemblyFile="$(WasmBuildTasksAssemblyPath)" />
8888

8989
<Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp">
90+
<PropertyGroup Condition="'$(IsHighAotMemoryUsageTest)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true'">
91+
<DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">true</DisableParallelEmccCompile>
92+
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-O2</EmccLinkOptimizationFlag>
93+
</PropertyGroup>
94+
9095
<PropertyGroup>
9196
<_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath>
9297
<RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath>
98+
<EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl%252C-O0 -Wl%252C-lto-O0</EmccLinkOptimizationFlag>
9399
</PropertyGroup>
94100

95101
<Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" />
@@ -111,15 +117,20 @@
111117
<!-- To recreate the original project on helix, we need to set the wasm properties also, same as the
112118
library test project. Eg. $(InvariantGlobalization) -->
113119
<ItemGroup>
114-
<_WasmPropertyNames Include="InvariantGlobalization" />
115120
<_WasmPropertyNames Include="AOTMode" />
116-
<_WasmPropertyNames Include="WasmDebugLevel" />
121+
<_WasmPropertyNames Include="AssemblyName" />
122+
<_WasmPropertyNames Include="DisableParallelAot" />
123+
<_WasmPropertyNames Include="DisableParallelEmccCompile" />
124+
<_WasmPropertyNames Include="EmccCompileOptimizationFlag" />
125+
<_WasmPropertyNames Include="EmccLinkOptimizationFlag" />
126+
<_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" />
127+
<_WasmPropertyNames Include="InvariantGlobalization" />
117128
<_WasmPropertyNames Include="WasmBuildNative" />
118-
<_WasmPropertyNames Include="_WasmDevel" />
119-
<_WasmPropertyNames Include="WasmLinkIcalls" />
129+
<_WasmPropertyNames Include="WasmDebugLevel" />
120130
<_WasmPropertyNames Include="WasmDedup" />
121-
<_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" />
122-
<_WasmPropertyNames Include="AssemblyName" />
131+
<_WasmPropertyNames Include="WasmLinkIcalls" />
132+
<_WasmPropertyNames Include="WasmNativeStrip" />
133+
<_WasmPropertyNames Include="_WasmDevel" />
123134

124135
<_WasmPropertiesToPass
125136
Include="$(%(_WasmPropertyNames.Identity))"
@@ -159,7 +170,7 @@
159170
<WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel>
160171
</PropertyGroup>
161172

162-
<ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true'">
173+
<ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true' and '$(BuildAOTTestsOnHelix)' != 'true'">
163174
<_SatelliteAssemblies Include="$(PublishDir)*\*.resources.dll" />
164175
<_SatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" />
165176
<_SatelliteAssemblies TargetPath="%(CultureName)\%(FileName)%(Extension)" />

src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11)</RoslynApiVersion>
5+
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
56
</PropertyGroup>
67

78
<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>

src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<PropertyGroup>
44
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion)</RoslynApiVersion>
55
<DefineConstants>$(DefineConstants);ROSLYN4_0_OR_GREATER</DefineConstants>
6+
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
7+
<EmccLinkOptimizationFlag Condition="'$(ContinuousIntegrationBuild)' == 'true'">-O1</EmccLinkOptimizationFlag>
8+
<WasmNativeStrip>false</WasmNativeStrip>
69
</PropertyGroup>
710

811
<Import Project="Microsoft.Extensions.Logging.Generators.targets"/>

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public class IndexViewModel
125125
}
126126

127127
[Fact]
128+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
128129
public void NameClashSourceGeneration()
129130
{
130131
// Without resolution.
@@ -149,6 +150,7 @@ public void NameClashSourceGeneration()
149150
}
150151

151152
[Fact]
153+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
152154
public void ProgramsThatDontUseGeneratorCompile()
153155
{
154156
// No STJ usage.
@@ -192,6 +194,7 @@ public static void Main()
192194
}
193195

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

208211
[Fact]
212+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
209213
public void WarnOnClassesWithInaccessibleJsonIncludeProperties()
210214
{
211215
Compilation compilation = CompilationHelper.CreateCompilationWithInaccessibleJsonIncludeProperties();

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace System.Text.Json.SourceGeneration.UnitTests
1313
{
14+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
1415
public class GeneratorTests
1516
{
1617
[Fact]

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion_3_11)</RoslynApiVersion>
4+
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
45
</PropertyGroup>
56

67
<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<RoslynApiVersion>$(MicrosoftCodeAnalysisCSharpWorkspacesVersion)</RoslynApiVersion>
44
<DefineConstants>$(DefineConstants);ROSLYN4_0_OR_GREATER</DefineConstants>
5+
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
56
</PropertyGroup>
67

78
<Import Project="System.Text.Json.SourceGeneration.Unit.Tests.targets" />

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/TypeWrapperTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace System.Text.Json.SourceGeneration.UnitTests
1414
public class TypeWrapperTests
1515
{
1616
[Fact]
17+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
1718
public void MetadataLoadFilePathHandle()
1819
{
1920
// Create a MetadataReference from new code.
@@ -79,6 +80,7 @@ public void MySecondMethod() { }
7980
}
8081

8182
[Fact]
83+
[ActiveIssue("https://github.com/dotnet/runtime/issues/58226", TestPlatforms.Browser)]
8284
public void CanGetAttributes()
8385
{
8486
string source = @"

src/libraries/System.Text.RegularExpressions/tests/RegexCultureTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ public static IEnumerable<object[]> Match_In_Different_Cultures_CriticalCases_Te
325325
public static IEnumerable<object[]> Match_In_Different_Cultures_CriticalCases_TestData() =>
326326
Match_In_Different_Cultures_CriticalCases_TestData_For(RegexOptions.None).Union(Match_In_Different_Cultures_CriticalCases_TestData_For(RegexOptions.Compiled));
327327

328+
[ActiveIssue("https://github.com/dotnet/runtime/issues/60899", TestPlatforms.Browser)]
328329
[Theory]
329330
[MemberData(nameof(Match_In_Different_Cultures_TestData))]
330331
[ActiveIssue("https://github.com/dotnet/runtime/issues/60697", TestPlatforms.iOS | TestPlatforms.tvOS)]

src/libraries/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Generators.Tests/System.Text.RegularExpressions.Generators.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<Nullable>enable</Nullable>
88
<!-- xUnit2008 is about regexes and isn't appropriate in the test project for regexes -->
99
<NoWarn>$(NoWarn);xUnit2008</NoWarn>
10+
<IsHighAotMemoryUsageTest>true</IsHighAotMemoryUsageTest>
1011
</PropertyGroup>
1112

1213
<ItemGroup>

src/libraries/tests.proj

-9
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
</PropertyGroup>
1515

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

2219
<!-- Projects that don't support code coverage measurement. -->
@@ -272,12 +269,6 @@
272269

273270
<!-- https://github.com/dotnet/runtime/issues/58226 -->
274271
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.InteropServices\tests\DllImportGenerator.UnitTests\DllImportGenerator.Unit.Tests.csproj" />
275-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests.csproj" />
276-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Unit.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests.csproj" />
277-
278-
<!-- hhttps://github.com/dotnet/runtime/issues/60048 -->
279-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Tests.csproj" />
280-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\System.Text.RegularExpressions.Generators.Tests\System.Text.RegularExpressions.Generators.Tests.csproj" />
281272
</ItemGroup>
282273

283274
<!-- Aggressive Trimming related failures -->

src/mono/sample/wasm/browser-bench/Wasm.Browser.Bench.Sample.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<WasmCopyAppZipToHelixTestDir Condition="'$(ArchiveTests)' == 'true'">true</WasmCopyAppZipToHelixTestDir>
3+
<!-- don't need to run this on helix -->
4+
<WasmCopyAppZipToHelixTestDir>false</WasmCopyAppZipToHelixTestDir>
45
<WasmMainJSPath>runtime.js</WasmMainJSPath>
56
</PropertyGroup>
67

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
<_WasmPInvokeTablePath>$(_WasmIntermediateOutputPath)pinvoke-table.h</_WasmPInvokeTablePath>
153153
<_WasmPInvokeHPath>$(_WasmRuntimePackIncludeDir)wasm\pinvoke.h</_WasmPInvokeHPath>
154154
<_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c</_DriverGenCPath>
155+
<DisableParallelAot Condition="'$(DisableParallelAot)' == ''">false</DisableParallelAot>
156+
<DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">$(DisableParallelAot)</DisableParallelEmccCompile>
155157

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

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

286-
<Message Text="Compiling native assets with emcc. This may take a while ..." Importance="High" />
288+
<Message Text="Compiling native assets with emcc with $(EmccCompileOptimizationFlag). This may take a while ..." Importance="High" />
287289
<ItemGroup>
288290
<_WasmSourceFileToCompile Remove="@(_WasmSourceFileToCompile)" />
289291
<_WasmSourceFileToCompile Include="@(_WasmRuntimePackSrcFile)" Dependencies="%(_WasmRuntimePackSrcFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileRsp)" />
@@ -292,6 +294,7 @@
292294
SourceFiles="@(_WasmSourceFileToCompile)"
293295
Arguments='"@$(_EmccDefaultFlagsRsp)" "@$(_EmccCompileRsp)"'
294296
EnvironmentVariables="@(EmscriptenEnvVars)"
297+
DisableParallelCompile="$(DisableParallelEmccCompile)"
295298
OutputMessageImportance="$(_EmccCompileOutputMessageImportance)">
296299
<Output TaskParameter="OutputFiles" ItemName="FileWrites" />
297300
</EmccCompile>
@@ -308,11 +311,12 @@
308311
<_BitCodeFile Dependencies="%(_BitCodeFile.Dependencies);$(_EmccDefaultFlagsRsp);$(_EmccCompileBitcodeRsp)" />
309312
</ItemGroup>
310313

311-
<Message Text="Compiling assembly bitcode files..." Importance="High" Condition="@(_BitCodeFile->Count()) > 0" />
314+
<Message Text="Compiling assembly bitcode files with $(EmccLinkOptimizationFlag) ..." Importance="High" Condition="@(_BitCodeFile->Count()) > 0" />
312315
<EmccCompile
313316
SourceFiles="@(_BitCodeFile)"
314317
Arguments="&quot;@$(_EmccDefaultFlagsRsp)&quot; &quot;@$(_EmccCompileBitcodeRsp)&quot;"
315318
EnvironmentVariables="@(EmscriptenEnvVars)"
319+
DisableParallelCompile="$(DisableParallelEmccCompile)"
316320
OutputMessageImportance="$(_EmccCompileOutputMessageImportance)">
317321
<Output TaskParameter="OutputFiles" ItemName="FileWrites" />
318322
</EmccCompile>
@@ -371,7 +375,7 @@
371375
DependsOnTargets="_WasmSelectRuntimeComponentsForLinking;_WasmCompileAssemblyBitCodeFilesForAOT;_WasmWriteRspFilesForLinking"
372376
Returns="@(FileWrites)" >
373377

374-
<Message Text="Linking with emcc. This may take a while ..." Importance="High" />
378+
<Message Text="Linking with emcc with $(EmccLinkOptimizationFlag). This may take a while ..." Importance="High" />
375379
<Message Text="Running emcc with @(_EmccLinkStepArgs->'%(Identity)', ' ')" Importance="Low" />
376380
<Exec Command='emcc "@$(_EmccDefaultFlagsRsp)" "@$(_EmccLinkRsp)"' EnvironmentVariables="@(EmscriptenEnvVars)" />
377381
<ItemGroup>

src/tasks/AotCompilerTask/MonoAOTCompiler.cs

-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ private bool ExecuteInternal()
395395
new ParallelOptions { MaxDegreeOfParallelism = allowedParallelism },
396396
(args, state) => PrecompileLibraryParallel(args, state));
397397

398-
Log.LogMessage(MessageImportance.High, $"result: {result.IsCompleted}");
399398
if (result.IsCompleted)
400399
{
401400
int numUnchanged = _totalNumAssemblies - _numCompiled;

src/tasks/WasmAppBuilder/WasmAppBuilder.cs

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Collections.Specialized;
67
using System.Diagnostics.CodeAnalysis;
78
using System.IO;
89
using System.Linq;
@@ -222,6 +223,7 @@ private bool ExecuteInternal ()
222223
Directory.CreateDirectory(supportFilesDir);
223224

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

233235
// We normalize paths from `\` to `/` as MSBuild items could use `\`.
234236
targetPath = targetPath.Replace('\\', '/');
237+
if (targetPathTable.ContainsKey(targetPath))
238+
{
239+
string firstPath = Path.GetFullPath(targetPathTable[targetPath]!);
240+
string secondPath = Path.GetFullPath(item.ItemSpec);
241+
242+
if (firstPath == secondPath)
243+
{
244+
Log.LogWarning($"Found identical vfs mappings for target path: {targetPath}, source file: {firstPath}. Ignoring.");
245+
continue;
246+
}
247+
248+
throw new LogAsErrorException($"Found more than one file mapping to the target VFS path: {targetPath}. Source files: {firstPath}, and {secondPath}");
249+
}
250+
251+
targetPathTable[targetPath] = item.ItemSpec;
235252

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

0 commit comments

Comments
 (0)