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] Misc follow up improvements for workloads testing #55647

Merged
merged 7 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 1 addition & 86 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -335,90 +335,5 @@
Text="Analyzers must only target netstandard2.0 since they run in the compiler which targets netstandard2.0. The following files were found to target '%(_AnalyzerPackFile.TargetFramework)': @(_AnalyzerPackFile)" />
</Target>

<!-- ************** Workload based testing ************** -->

<Target Name="ProvisionSdkForWorkloadTesting" Condition="!Exists($(SdkForWorkloadTestingStampPath)) and '$(InstallWorkloadForTesting)' == 'true'">
<Error Text="%24(SdkPathForWorkloadTesting) is not set" Condition="'$(SdkPathForWorkloadTesting)' == ''" />
<Error Text="%24(SdkVersionForWorkloadTesting) is not set" Condition="'$(SdkVersionForWorkloadTesting)' == ''" />

<Message Text="** Installing sdk $(SdkVersionForWorkloadTesting) for workload based tests" Importance="High" />

<RemoveDir Directories="$(SdkPathForWorkloadTesting)" />
<MakeDir Directories="$(SdkPathForWorkloadTesting)" />

<PropertyGroup>
<_DotNetInstallScriptPath Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(DOTNET_INSTALL_DIR)/dotnet-install.sh</_DotNetInstallScriptPath>
<_DotNetInstallScriptPath Condition=" $([MSBuild]::IsOSPlatform('windows'))">$(RepoRoot).dotnet\dotnet-install.ps1</_DotNetInstallScriptPath>
</PropertyGroup>

<Exec Condition="!$([MSBuild]::IsOSPlatform('windows'))"
Command="chmod +x $(_DotNetInstallScriptPath); $(_DotNetInstallScriptPath) -i $(SdkPathForWorkloadTesting) -v $(SdkVersionForWorkloadTesting)" />

<Exec Condition="$([MSBuild]::IsOSPlatform('windows'))"
Command='powershell -ExecutionPolicy ByPass -NoProfile -command "&amp; $(_DotNetInstallScriptPath) -InstallDir $(SdkPathForWorkloadTesting) -Version $(SdkVersionForWorkloadTesting)"' />

<WriteLinesToFile File="$(SdkForWorkloadTestingStampPath)" Lines="" Overwrite="true" />
</Target>

<Target Name="GetWorkloadInputs">
<ItemGroup>
<AvailableNuGetsInArtifacts Include="$(LibrariesShippingPackagesDir)\*.nupkg" />
</ItemGroup>

<Error Text="Cannot find any nupkg files in $(LibrariesShippingPackagesDir), needed for workloads" Condition="@(AvailableNuGetsInArtifacts->Count()) == 0" />
</Target>

<UsingTask Condition="'$(InstallWorkloadForTesting)' == 'true'"
TaskName="Microsoft.Workload.Build.Tasks.InstallWorkloadFromArtifacts"
AssemblyFile="$(WorkloadBuildTasksAssemblyPath)" />

<UsingTask Condition="'$(InstallWorkloadForTesting)' == 'true'"
TaskName="GenerateFileFromTemplate"
AssemblyFile="$(WorkloadBuildTasksAssemblyPath)" />

<Target Name="InstallWorkloadUsingArtifacts"
AfterTargets="ArchiveTests"
DependsOnTargets="ProvisionSdkForWorkloadTesting;GetWorkloadInputs"
Inputs="@(AvailableNuGetsInArtifacts)"
Outputs="$(WorkloadStampFile)"
Condition="'$(InstallWorkloadForTesting)' == 'true'">

<ItemGroup>
<_PropsForAOTCrossBuild Include="TestingWorkloads=true" />
<_PropsForAOTCrossBuild Include="Configuration=$(Configuration)" />
<_PropsForAOTCrossBuild Include="TargetOS=Browser" />
<_PropsForAOTCrossBuild Include="TargetArchitecture=wasm" />
<_PropsForAOTCrossBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" />

<_PropsForAOTCrossBuild Include="RuntimeIdentifier=$(NETCoreSdkRuntimeIdentifier)" />
<_PropsForAOTCrossBuild Include="TargetCrossRid=$(RuntimeIdentifier)" />
</ItemGroup>

<Exec Command="dotnet build -bl -restore -t:Pack @(_PropsForAOTCrossBuild -> '-p:%(Identity)', ' ') Microsoft.NETCore.App.MonoCrossAOT.sfxproj"
WorkingDirectory="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App" />

<ItemGroup>
<_NuGetSourceForWorkloads Include="dotnet6" Value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<_BuiltNuGets Include="$(LibrariesShippingPackagesDir)\*.nupkg" />
</ItemGroup>

<PropertyGroup>
<!-- Eg. Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm.6.0.0-dev.nupkg -->
<_AOTCrossNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.AOT.$(NETCoreSdkRuntimeIdentifier).Cross.$(RuntimeIdentifier).$(PackageVersion).nupkg</_AOTCrossNuGetPath>
</PropertyGroup>

<Error Text="Could not find cross compiler nupkg at $(_AOTCrossNuGetPath). Found packages: @(_BuiltNuGets)"
Condition="!Exists($(_AOTCrossNuGetPath))" />

<Message Text="Packages found in $(LibrariesShippingPackagesDir): @(_BuiltNuGets)" Importance="Low" />

<InstallWorkloadFromArtifacts
WorkloadId="@(WorkloadIdForTesting)"
VersionBand="$(SdkBandVersion)"
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
ExtraNuGetSources="@(_NuGetSourceForWorkloads)"
SdkDir="$(SdkPathForWorkloadTesting)" />

<WriteLinesToFile File="$(WorkloadStampFile)" Lines="" Overwrite="true" />
</Target>
<Import Project="$(MSBuildThisFileDirectory)workloads-testing.targets" />
</Project>
6 changes: 3 additions & 3 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@
<WasmBuildTargetsDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono', 'wasm', 'build'))</WasmBuildTargetsDir>
<TestEchoMiddleware>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'bin', 'NetCoreServer', '$(NetCoreAppCurrent)-$(Configuration)'))</TestEchoMiddleware>
<RemoteLoopMiddleware>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'bin', 'RemoteLoopServer', '$(NetCoreAppCurrent)-$(Configuration)'))</RemoteLoopMiddleware>
<WorkItemPrefix Condition="'$(Scenario)' == 'BuildWasmApps' and '$(TestUsingWorkloads)' == 'true'">Workloads/</WorkItemPrefix>
<WorkItemPrefix Condition="'$(Scenario)' == 'BuildWasmApps' and '$(TestUsingWorkloads)' != 'true'">EMSDK/</WorkItemPrefix>
<WorkItemPrefix Condition="'$(Scenario)' == 'BuildWasmApps' and '$(TestUsingWorkloads)' == 'true'">Workloads-</WorkItemPrefix>
<WorkItemPrefix Condition="'$(Scenario)' == 'BuildWasmApps' and '$(TestUsingWorkloads)' != 'true'">EMSDK-</WorkItemPrefix>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
Expand Down Expand Up @@ -377,7 +377,7 @@
<_WorkItem Include="$(TestArchiveRoot)runonly/**/WebAssembly.Browser.*.Test.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'" />
<_WorkItem Include="$(TestArchiveRoot)browseronly/**/*.zip" Condition="'$(TargetOS)' == 'Browser' and '$(Scenario)' == 'WasmTestOnBrowser'" />

<HelixWorkItem Include="@(_WorkItem -> '%(WorkItemPrefix)%(FileName)')">
<HelixWorkItem Include="@(_WorkItem -> '$(WorkItemPrefix)%(FileName)')">
<PayloadArchive>%(Identity)</PayloadArchive>
<Command>$(HelixCommand)</Command>
<Timeout>$(_workItemTimeout)</Timeout>
Expand Down
86 changes: 86 additions & 0 deletions src/libraries/workloads-testing.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<Project>
<Target Name="ProvisionSdkForWorkloadTesting" Condition="!Exists($(SdkForWorkloadTestingStampPath)) and '$(InstallWorkloadForTesting)' == 'true'">
<Error Text="%24(SdkPathForWorkloadTesting) is not set" Condition="'$(SdkPathForWorkloadTesting)' == ''" />
<Error Text="%24(SdkVersionForWorkloadTesting) is not set" Condition="'$(SdkVersionForWorkloadTesting)' == ''" />

<Message Text="** Installing sdk $(SdkVersionForWorkloadTesting) for workload based tests" Importance="High" />

<RemoveDir Directories="$(SdkPathForWorkloadTesting)" />
<MakeDir Directories="$(SdkPathForWorkloadTesting)" />

<PropertyGroup>
<_DotNetInstallScriptPath Condition="!$([MSBuild]::IsOSPlatform('windows'))">$(DOTNET_INSTALL_DIR)/dotnet-install.sh</_DotNetInstallScriptPath>
<_DotNetInstallScriptPath Condition=" $([MSBuild]::IsOSPlatform('windows'))">$(RepoRoot).dotnet\dotnet-install.ps1</_DotNetInstallScriptPath>
</PropertyGroup>

<Exec Condition="!$([MSBuild]::IsOSPlatform('windows'))"
Command="chmod +x $(_DotNetInstallScriptPath); $(_DotNetInstallScriptPath) -i $(SdkPathForWorkloadTesting) -v $(SdkVersionForWorkloadTesting)" />

<Exec Condition="$([MSBuild]::IsOSPlatform('windows'))"
Command='powershell -ExecutionPolicy ByPass -NoProfile -command "&amp; $(_DotNetInstallScriptPath) -InstallDir $(SdkPathForWorkloadTesting) -Version $(SdkVersionForWorkloadTesting)"' />

<WriteLinesToFile File="$(SdkForWorkloadTestingStampPath)" Lines="" Overwrite="true" />
</Target>

<Target Name="GetWorkloadInputs">
<ItemGroup>
<AvailableNuGetsInArtifacts Include="$(LibrariesShippingPackagesDir)\*.nupkg" />
</ItemGroup>

<Error Text="Cannot find any nupkg files in $(LibrariesShippingPackagesDir), needed for workloads" Condition="@(AvailableNuGetsInArtifacts->Count()) == 0" />
</Target>

<UsingTask Condition="'$(InstallWorkloadForTesting)' == 'true'"
TaskName="Microsoft.Workload.Build.Tasks.InstallWorkloadFromArtifacts"
AssemblyFile="$(WorkloadBuildTasksAssemblyPath)" />

<UsingTask Condition="'$(InstallWorkloadForTesting)' == 'true'"
TaskName="GenerateFileFromTemplate"
AssemblyFile="$(WorkloadBuildTasksAssemblyPath)" />

<Target Name="InstallWorkloadUsingArtifacts"
AfterTargets="ArchiveTests"
DependsOnTargets="ProvisionSdkForWorkloadTesting;GetWorkloadInputs"
Inputs="@(AvailableNuGetsInArtifacts)"
Outputs="$(WorkloadStampFile)"
Condition="'$(InstallWorkloadForTesting)' == 'true'">

<ItemGroup>
<_PropsForAOTCrossBuild Include="TestingWorkloads=true" />
<_PropsForAOTCrossBuild Include="Configuration=$(Configuration)" />
<_PropsForAOTCrossBuild Include="TargetOS=Browser" />
<_PropsForAOTCrossBuild Include="TargetArchitecture=wasm" />
<_PropsForAOTCrossBuild Include="ContinuousIntegrationBuild=$(ContinuousIntegrationBuild)" />

<_PropsForAOTCrossBuild Include="RuntimeIdentifier=$(NETCoreSdkRuntimeIdentifier)" />
<_PropsForAOTCrossBuild Include="TargetCrossRid=$(RuntimeIdentifier)" />
</ItemGroup>

<Exec Command="dotnet build -bl -restore -t:Pack @(_PropsForAOTCrossBuild -> '-p:%(Identity)', ' ') Microsoft.NETCore.App.MonoCrossAOT.sfxproj"
WorkingDirectory="$(InstallerProjectRoot)pkg/sfx/Microsoft.NETCore.App" />

<ItemGroup>
<_NuGetSourceForWorkloads Include="dotnet6" Value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<_BuiltNuGets Include="$(LibrariesShippingPackagesDir)\*.nupkg" />
</ItemGroup>

<PropertyGroup>
<!-- Eg. Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.browser-wasm.6.0.0-dev.nupkg -->
<_AOTCrossNuGetPath>$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.AOT.$(NETCoreSdkRuntimeIdentifier).Cross.$(RuntimeIdentifier).$(PackageVersion).nupkg</_AOTCrossNuGetPath>
</PropertyGroup>

<Error Text="Could not find cross compiler nupkg at $(_AOTCrossNuGetPath). Found packages: @(_BuiltNuGets)"
Condition="!Exists($(_AOTCrossNuGetPath))" />

<Message Text="Packages found in $(LibrariesShippingPackagesDir): @(_BuiltNuGets)" Importance="Low" />

<InstallWorkloadFromArtifacts
WorkloadId="@(WorkloadIdForTesting)"
VersionBand="$(SdkBandVersion)"
LocalNuGetsPath="$(LibrariesShippingPackagesDir)"
ExtraNuGetSources="@(_NuGetSourceForWorkloads)"
SdkDir="$(SdkPathForWorkloadTesting)" />

<WriteLinesToFile File="$(WorkloadStampFile)" Lines="" Overwrite="true" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<Project>
<PropertyGroup>
<UseMonoRuntime Condition="'$(RuntimeIdentifier)' == 'Browser-wasm'">true</UseMonoRuntime>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)\RuntimeConfigParserTask.props" />
<Import Project="$(MSBuildThisFileDirectory)\RuntimeComponentManifest.props" />
</Project>
3 changes: 0 additions & 3 deletions src/mono/wasm/build/WasmApp.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<Import Project="$(MSBuildThisFileDirectory)WasmApp.props" />

<PropertyGroup>
<!-- needed by the sdk, for net6.0, to include the correct runtime packs -->
<UseMonoRuntime>true</UseMonoRuntime>

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

Expand Down
1 change: 0 additions & 1 deletion src/mono/wasm/build/WasmApp.LocalBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<PropertyGroup>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
<UseMonoRuntime>true</UseMonoRuntime>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
Expand Down
3 changes: 2 additions & 1 deletion src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_
<ActualEmccVersionRaw>%(_ReversedVersionLines.Identity)</ActualEmccVersionRaw>
</PropertyGroup>

<Error Condition="'$(RuntimeEmccVersionRaw)' != '$(ActualEmccVersionRaw)'" Text="Emscripten version mismatch, expected '$(RuntimeEmccVersionRaw)', got '$(ActualEmccVersionRaw)'"/>
<Warning Condition="'$(RuntimeEmccVersionRaw)' != '$(ActualEmccVersionRaw)'"
Text="Emscripten version mismatch. The runtime pack in $(MicrosoftNetCoreAppRuntimePackDir) expects '$(RuntimeEmccVersionRaw)', but emcc being used has version '$(ActualEmccVersionRaw)'. This might cause build failures." />
</Target>

<!--
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/build/WasmApp.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetArchitecture>wasm</TargetArchitecture>
<TargetOS>Browser</TargetOS>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<UseMonoRuntime>true</UseMonoRuntime>

<WasmBuildAppAfterThisTarget Condition="'$(WasmBuildAppAfterThisTarget)' == ''">Publish</WasmBuildAppAfterThisTarget>
<WasmBuildAppDependsOn>
Expand Down
Loading