Skip to content

Commit

Permalink
Cherry-pick (#55283)
Browse files Browse the repository at this point in the history
* Update SDK to 6.0 Preview 6

Part of #55281

* Enable COM support to work around missing symbols in tests

* Update eng/testing/linker/project.csproj.template

* Disable the workload targets

* Disable workloads for wasm builds

For in-tree builds, and tests we don't want to use workloads from dotnet
being used to build these.

For the projects being built on the build machine, we can disable them
via `Directory.Build.props`, and wasm's InTree/LocalBuild props. But for
projects that get built on helix, eg. the runtime tests, we are setting
the property values as environment variables.

* Fix setting envvars for disabling workloads

* Another attempt to fix wasm tests

In preview5, the workload manifest overrides
`$(UsingBrowserRuntimeWorkload)` setting, so pass it on the command
line.

``xml
    <PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
        <UsingBrowserRuntimeWorkload Condition="'$(RunAOTCompilation)' == 'true' or '$(UsingMicrosoftNETSdkBlazorWebAssembly)' != 'true'" >true</UsingBrowserRuntimeWorkload>
        <UsingBrowserRuntimeWorkload Condition="'$(UsingBrowserRuntimeWorkload)' == ''" >$(WasmNativeWorkload)</UsingBrowserRuntimeWorkload>
    </PropertyGroup>
```

* Fix host tests after upgrade to P5

In P5 we don't generate .runtimeconfig.dev.json anymore. Some tests started to fail because they relied on the .runtime.dev.json to include local nuget cache in the probing paths.

I changed one of those tests to force-generate .runtimeconfig.dev.json as for the tested scenario it seems to make sense. For the other test I modified it to copy the necessary dependency into the right location instead.

* Fix up reflection to private FileStatus field

* Disable workload resolver for wasm.build.tests, EMSDK run

* Disable workloads for wasm with MSBuildEnableWorkloadResolver=false everywhere

* remove linker workaround

* [wasm] Remove args unnecessary for disabling workloads

* Pass MSBuildEnableWorkloadResolver property to individual trimming projects

Co-authored-by: Juan Sebastian Hoyos Ayala <juhoyosa@microsoft.com>
Co-authored-by: Santiago Fernandez Madero <safern@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: vitek-karas <vitek.karas@microsoft.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Anirudh Agnihotry <anirudhagnihotry098@gmail.com>
  • Loading branch information
8 people authored and mmitche committed Jul 23, 2021
1 parent 09bae7d commit 1139509
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions eng/testing/linker/trimmingTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<TestConsoleApps Include="@(TestConsoleAppSourceFiles->'%(ProjectFile)')" Condition="!$([System.String]::Copy('%(TestConsoleAppSourceFiles.SkipOnTestRuntimes)').Contains('$(PackageRID)'))">
<ProjectCompileItems>%(Identity)</ProjectCompileItems>
</TestConsoleApps>
<TestConsoleApps AdditionalProperties="MSBuildEnableWorkloadResolver=$(MSBuildEnableWorkloadResolver)" Condition="'$(MSBuildEnableWorkloadResolver)' != ''" />
</ItemGroup>
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<OutputType>Exe</OutputType>
<RuntimeFrameworkVersion>$(MNAVersion)</RuntimeFrameworkVersion>
<GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,15 @@ public void Muxer_Exec_activation_of_Build_Output_Portable_DLL_with_DepsJson_Rem
var fixture = sharedTestState.PortableAppFixture_Built
.Copy();

// Move the .deps.json to a subdirectory, note that in this case we have to move all of the app's dependencies
// along with it - in this case Newtonsoft.Json.dll
// For framework dependent apps (dotnet build produces those) the probing directories are:
// - The directory where the .deps.json is
// - Any framework directory
var depsJson = MoveDepsJsonToSubdirectory(fixture);
File.Move(
Path.Combine(Path.GetDirectoryName(fixture.TestProject.AppDll), "Newtonsoft.Json.dll"),
Path.Combine(Path.GetDirectoryName(depsJson), "Newtonsoft.Json.dll"));

var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static CoreFxFileStatusProvider()
try
{
s_fileSystem_fileStatusField = typeof(FileSystemInfo).GetField("_fileStatus", BindingFlags.NonPublic | BindingFlags.Instance);
s_fileStatus_fileStatusField = s_fileSystem_fileStatusField.FieldType.GetField("_fileStatus", BindingFlags.NonPublic | BindingFlags.Instance);
s_fileStatus_fileStatusField = s_fileSystem_fileStatusField.FieldType.GetField("_fileCache", BindingFlags.NonPublic | BindingFlags.Instance);
s_fileStatusModeField = s_fileStatus_fileStatusField.FieldType.GetField("Mode", BindingFlags.NonPublic | BindingFlags.Instance);
}
catch (Exception ex)
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/build/WasmApp.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<PropertyGroup>
<_NetCoreAppToolCurrent>net6.0</_NetCoreAppToolCurrent>
<MSBuildEnableWorkloadResolver>false</MSBuildEnableWorkloadResolver>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeSrcDir)' != '' and '$(WasmBuildSupportDir)' == ''">
Expand Down
3 changes: 3 additions & 0 deletions src/tests/BuildWasmApps/Wasm.Build.Tests/BuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public BuildEnvironment()
DefaultBuildArgs = $" /p:RuntimeSrcDir={solutionRoot.FullName} /p:RuntimeConfig={s_runtimeConfig} /p:EMSDK_PATH={emsdkPath} ";
}

// for EMSDK runs, we don't want to get the dependencies from workloads
DefaultBuildArgs += " /p:MSBuildEnableWorkloadResolver=false";

IsWorkload = false;
DotNet = "dotnet";
EnvVars = new Dictionary<string, string>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project>
<PropertyGroup>
<!-- disable workloads for this emsdk build -->
<MSBuildEnableWorkloadResolver>false</MSBuildEnableWorkloadResolver>

<_WasmTargetsDir Condition="'$(RuntimeSrcDir)' != ''">$(RuntimeSrcDir)\src\mono\wasm\build\</_WasmTargetsDir>
<_WasmTargetsDir Condition="'$(WasmBuildSupportDir)' != ''">$(WasmBuildSupportDir)\wasm\</_WasmTargetsDir>
<EMSDK_PATH Condition="'$(WasmBuildSupportDir)' != ''">$(WasmBuildSupportDir)\emsdk\</EMSDK_PATH>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Common/CLRTest.Execute.Bash.targets
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ else
__Command+=" dotnet"
fi
$__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssemblyFileName=$(MsBuildProjectName).dll /p:TestBinDir=`pwd` || exit $?
$__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssemblyFileName=$(MsBuildProjectName).dll /p:TestBinDir=`pwd` $(CLRTestMSBuildArgs) || exit $?
]]>
</BashCLRTestPreCommands>
Expand Down
4 changes: 4 additions & 0 deletions src/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@
as we do with many of the package versions above -->
<BaselineMicrosoftNetCoreAppPackageVersion>2.1.0-preview3-26416-01</BaselineMicrosoftNetCoreAppPackageVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<CLRTestMSBuildArgs>/p:MSBuildEnableWorkloadResolver=false</CLRTestMSBuildArgs>
</PropertyGroup>
</Project>

0 comments on commit 1139509

Please sign in to comment.