Merge pull request #4723 from kyulee1/tailcall
[platform/upstream/coreclr.git] / tests / helixperftasks.targets
1 <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2   <UsingTask TaskName="GetPerfTestAssemblies" AssemblyFile="$(ToolsDir)net45/Microsoft.DotNet.Build.CloudTestTasks.dll"/>
3   <Import Project="$(ToolsDir)publishtest.targets" />
4   <Import Project="$(ToolsDir)CloudTest.targets" />
5   <Target Name="UploadPerfAssemblies">
6     <Message Text="Searching for Perf tests in $(BinDir)" Importance = "High"/>
7     <ItemGroup>
8       <TestBinary Include="$(BinDir)**/*.dll" />
9       <TestBinary Include="$(BinDir)**/*.exe" />
10     </ItemGroup>
11
12     <!-- Get full paths to each of the perf test directories -->
13     <GetPerfTestAssemblies TestBinaries="@(TestBinary)" GetFullPaths="true">
14       <Output TaskParameter="PerfTestAssemblies" ItemName="CoreCLRPerfTest" />
15     </GetPerfTestAssemblies>
16
17     <PropertyGroup>
18       <TestRuntimeDependenciesJson>$(SourceDir)Common\test_runtime\project.json</TestRuntimeDependenciesJson>
19       <TestRuntimeProjectLockJson>$(SourceDir)Common\test_runtime\project.lock.json</TestRuntimeProjectLockJson>
20     </PropertyGroup>
21
22     <ItemGroup>
23      <DnuSourceList Include="$(CORE_ROOT)\.nuget\pkg" />
24     </ItemGroup>
25
26     <!-- Restore the runtime dependencies -->
27     <Exec Command="$(DnuRestoreCommand) &quot;$(TestRuntimeDependenciesJson)&quot;"
28            StandardOutputImportance="Low"
29            CustomErrorRegularExpression="^Unable to resolve .*"
30            IgnoreExitCode="true"
31            IgnoreStandardErrorWarningFormat="true" />
32
33     <!-- For each perf test, generate assembly list, and zip up the workitem -->
34     <MSBuild Projects="$(MSBuildProjectFile)" Properties="CurrPerfAssembly=%(CoreCLRPerfTest.Identity);TestRuntimeProjectLockJson=$(TestRuntimeProjectLockJson)" Targets="_zipSingleProject"/>
35
36     <!-- After all workitems are packaged, call the CloudBuild Targets from Build Tools which upload these workitems and trigger a test run for these workitems -->
37     <MSBuild Projects="$(MSBuildProjectFile)" Properties="BinDir=$(BinDir)../" Targets="CloudBuild" />
38
39   </Target>
40
41   <Target Name="_zipSingleProject">
42     <PropertyGroup>
43       <OutDir>$([System.IO.Path]::GetDirectoryName($(CurrPerfAssembly)))/</OutDir>
44       <TestArchiveDir>$(BaseOutputPath)\testStagingDir\</TestArchiveDir>
45       <TestProjectName>$([System.IO.Path]::GetFileNameWithoutExtension($(CurrPerfAssembly)))</TestProjectName>
46       <ProjectLockJson>$(OutDir)project.lock.json</ProjectLockJson>
47     </PropertyGroup>
48
49     <ItemGroup>
50       <TestNugetProjectLockFile Include="$(ProjectLockJson)" Condition="Exists($(ProjectLockJson))"/>
51       <TestNugetProjectLockFile Include="$(TestRuntimeProjectLockJson)" Condition="Exists($(TestRuntimeProjectLockJson))"/>
52     </ItemGroup>
53
54     <!-- Generate Assembly list based on the individual project's project.json as well as the common runtime dependencies generated by AddAssFilesToAssemblyList target -->
55     <PrereleaseResolveNuGetPackageAssets
56                                AllowFallbackOnTargetSelection="true"
57                                IncludeFrameworkReferences="false"
58                                NuGetPackagesDirectory="$(PackagesDir)"
59                                RuntimeIdentifier="$(TestNugetRuntimeId)"
60                                ProjectLanguage="C#"
61                                ProjectLockFile="%(TestNugetProjectLockFile.FullPath)"
62                                TargetMonikers="@(TestTargetFramework)">
63       <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RequiredAssemblies" />
64     </PrereleaseResolveNuGetPackageAssets>
65     <ItemGroup>
66       <AssemblyPaths Include="$([MSBuild]::MakeRelative($(PackagesDir), %(RequiredAssemblies.FullPath)))" />
67     </ItemGroup>
68     <RemoveDuplicatesWithLastOneWinsPolicy Inputs="@(AssemblyPaths)">
69       <Output TaskParameter="Filtered" ItemName="UniqueAssemblyPaths" />
70     </RemoveDuplicatesWithLastOneWinsPolicy>
71     <PropertyGroup>
72       <_TestCopyLocalByFileNameWithoutDuplicates></_TestCopyLocalByFileNameWithoutDuplicates>
73     </PropertyGroup>
74     <ItemGroup>
75       <UniqueAssemblyPaths Include="$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').Replace('$(PackagesDir)',''))" Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.NugetPackageId)' != ''" />
76     </ItemGroup>
77     <WriteLinesToFile
78       File="$(OutDir)/assemblylist.flat.txt"
79       Lines="@(UniqueAssemblyPaths)"
80       Overwrite="true"
81       Encoding="Ascii" />
82
83     <GenerateAssemblyList
84       InputListLocation="$(OutDir)assemblylist.flat.txt"
85       OutputListLocation="$(OutDir)assemblylist.txt"
86      />
87
88     <Message Text="Archiving Perf test assemblies for project: $(OutDir)" Importance="High" />
89     <MSBuild Projects="$(MSBuildProjectFile)" Properties="OutDir=$(OutDir);TestArchiveDir=$(TestArchiveDir);TestProjectName=$(TestProjectName);DisableCopyTestToTestDirectory=true" Targets="ArchiveTestBuild"/>
90   </Target>
91 </Project>