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"/>
8 <TestBinary Include="$(BinDir)**/*.dll" />
9 <TestBinary Include="$(BinDir)**/*.exe" />
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>
18 <TestRuntimeDependenciesJson>$(SourceDir)Common\test_runtime\project.json</TestRuntimeDependenciesJson>
19 <TestRuntimeProjectLockJson>$(SourceDir)Common\test_runtime\project.lock.json</TestRuntimeProjectLockJson>
22 <!-- Restore the runtime dependencies -->
23 <Exec Command="$(DnuRestoreCommand) "$(TestRuntimeDependenciesJson)""
24 StandardOutputImportance="Low"
25 CustomErrorRegularExpression="^Unable to resolve .*"
27 IgnoreStandardErrorWarningFormat="true" />
29 <!-- For each perf test, generate assembly list, and zip up the workitem -->
30 <MSBuild Projects="$(MSBuildProjectFile)" Properties="CurrPerfAssembly=%(CoreCLRPerfTest.Identity);TestRuntimeProjectLockJson=$(TestRuntimeProjectLockJson)" Targets="_zipSingleProject"/>
32 <!-- After all workitems are packaged, call the CloudBuild Targets from Build Tools which upload these workitems and trigger a test run for these workitems -->
33 <MSBuild Projects="$(MSBuildProjectFile)" Properties="BinDir=$(BinDir)../" Targets="CloudBuild" />
37 <Target Name="_zipSingleProject">
39 <OutDir>$([System.IO.Path]::GetDirectoryName($(CurrPerfAssembly)))/</OutDir>
40 <TestArchiveDir>$(BaseOutputPath)\testStagingDir\</TestArchiveDir>
41 <TestProjectName>$([System.IO.Path]::GetFileNameWithoutExtension($(CurrPerfAssembly)))</TestProjectName>
42 <ProjectLockJson>$(OutDir)project.lock.json</ProjectLockJson>
46 <TestNugetProjectLockFile Include="$(ProjectLockJson)" Condition="Exists($(ProjectLockJson))"/>
47 <TestNugetProjectLockFile Include="$(TestRuntimeProjectLockJson)" Condition="Exists($(TestRuntimeProjectLockJson))"/>
50 <!-- Generate Assembly list based on the individual project's project.json as well as the common runtime dependencies generated by AddAssFilesToAssemblyList target -->
51 <PrereleaseResolveNuGetPackageAssets
52 AllowFallbackOnTargetSelection="true"
53 IncludeFrameworkReferences="false"
54 NuGetPackagesDirectory="$(PackagesDir)"
55 RuntimeIdentifier="$(TestNugetRuntimeId)"
57 ProjectLockFile="%(TestNugetProjectLockFile.FullPath)"
58 TargetMonikers="@(TestTargetFramework)">
59 <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RequiredAssemblies" />
60 </PrereleaseResolveNuGetPackageAssets>
62 <AssemblyPaths Include="$([MSBuild]::MakeRelative($(PackagesDir), %(RequiredAssemblies.FullPath)))" />
64 <RemoveDuplicatesWithLastOneWinsPolicy Inputs="@(AssemblyPaths)">
65 <Output TaskParameter="Filtered" ItemName="UniqueAssemblyPaths" />
66 </RemoveDuplicatesWithLastOneWinsPolicy>
68 <_TestCopyLocalByFileNameWithoutDuplicates></_TestCopyLocalByFileNameWithoutDuplicates>
71 <UniqueAssemblyPaths Include="$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').Replace('$(PackagesDir)',''))" Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.NugetPackageId)' != ''" />
74 File="$(OutDir)/assemblylist.flat.txt"
75 Lines="@(UniqueAssemblyPaths)"
80 InputListLocation="$(OutDir)assemblylist.flat.txt"
81 OutputListLocation="$(OutDir)assemblylist.txt"
84 <Message Text="Archiving Perf test assemblies for project: $(OutDir)" Importance="High" />
85 <MSBuild Projects="$(MSBuildProjectFile)" Properties="OutDir=$(OutDir);TestArchiveDir=$(TestArchiveDir);TestProjectName=$(TestProjectName);DisableCopyTestToTestDirectory=true" Targets="ArchiveTestBuild"/>