forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnativepgo.targets
67 lines (58 loc) · 3.91 KB
/
nativepgo.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<Project>
<PropertyGroup>
<NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'windows' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'x86' Or '$(TargetArchitecture)' == 'arm64')">true</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(TargetOS)' == 'Linux' And ('$(TargetArchitecture)' == 'x64' Or '$(TargetArchitecture)' == 'arm64')">true</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(NoPgoOptimize)' == 'true'">false</NativeOptimizationDataSupported>
<NativeOptimizationDataSupported Condition="'$(Configuration)' != 'Release'">false</NativeOptimizationDataSupported>
<_NativeOptimizationDataPackageTarget>$(TargetOS.ToLower())-$(TargetArchitecture.ToLower())</_NativeOptimizationDataPackageTarget>
<_NativeOptimizationDataPackageTarget Condition="'$(TargetOS)' == 'windows'">windows_nt-$(TargetArchitecture.ToLower())</_NativeOptimizationDataPackageTarget>
</PropertyGroup>
<ItemGroup Condition="'$(optimizationPGOCoreCLRVersion)'!='' and '$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="optimization.windows_nt-x64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.windows_nt-x86.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.windows_nt-arm64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.linux-x64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
<PackageReference Include="optimization.linux-arm64.PGO.CoreCLR"
Version="$(optimizationPGOCoreCLRVersion)"
GeneratePathProperty="true" />
</ItemGroup>
<!-- -->
<!-- Task: GetPgoDataPackagePath -->
<!-- -->
<!-- Notes: -->
<!-- -->
<!-- DumpPgoDataPackagePath is used to get the path of the native PGO data -->
<!-- for other MSBuild projects, generally to pass to another project or -->
<!-- native script like build-runtime.cmd/sh. -->
<!-- -->
<Target Name="GetPgoDataPackagePath" Returns="$(PgoPackagePath)">
<PropertyGroup>
<PgoPackagePathProperty>Pkgoptimization_$(_NativeOptimizationDataPackageTarget)_PGO_CoreCLR</PgoPackagePathProperty>
</PropertyGroup>
<!--
Use an item group for expansion of $($(PgoPackagePathProperty)) (an illegal MSBuild expression)
i.e. the prop value's value.
-->
<ItemGroup>
<PgoPackagePathPropertyItemList Include="$(PgoPackagePathProperty)" />
<PgoPackagePathPropertyItemList>
<PgoPackagePath>$(%(Identity).TrimEnd('\\'))</PgoPackagePath>
</PgoPackagePathPropertyItemList>
</ItemGroup>
<PropertyGroup>
<PgoPackagePath>@(PgoPackagePathPropertyItemList->'%(PgoPackagePath)')</PgoPackagePath>
</PropertyGroup>
<Error Condition="!Exists('$(PgoPackagePath)') And '$(NativeOptimizationDataSupported)' == 'true'" Text="Unable to locate restored PGO package at $(PgoPackagePath). Maybe the platform-specific package naming changed?" />
</Target>
<Target Name="OutputPgoPathForCI" Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(NativeOptimizationDataSupported)' == 'true'" DependsOnTargets="GetPgoDataPackagePath">
<Message Text="##vso[task.setvariable variable=CoreClrPgoDataArg]-pgodatapath "$(PgoPackagePath)"" Importance="High" />
</Target>
</Project>