summaryrefslogtreecommitdiff
path: root/src/build.proj
blob: b7d0e8b7975566591f9ae8a97fb2a324c02ebae1 (plain)
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
68
69
70
71
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\dir.props"/>
  
  <!-- List the projects that need to be built -->
  <ItemGroup>
    <Project Condition="$(SkipSOS) != 'true'" Include="ToolBox\SOS\NETCore\SOS.NETCore.csproj" />
    <Project Include="System.Private.CoreLib\System.Private.CoreLib.csproj" />
  </ItemGroup>

  <Import Project="..\dir.targets" />

  <Import Project="..\dir.traversal.targets" />

  <Target Name="MovePostBuildBinaries" AfterTargets="Build">
    <Move SourceFiles="@(BinariesToMove)"
        DestinationFolder="$(BinDir)" />
  </Target>

  <ItemGroup>
    <ILToCopy Include="$(BinDir)System.Private.CoreLib.dll"/>
    <PDBSToMove Include="$(BinDir)System.Private.CoreLib.pdb"/>
  </ItemGroup>

  <PropertyGroup>
    <CoreLibPath>$(BinDir)System.Private.CoreLib.dll</CoreLibPath>
    <CoreLibPDBPath>$(BinDir)System.Private.CoreLib.pdb</CoreLibPDBPath>
  </PropertyGroup>

  <Target Name="BuildR2RDumpPackages" Condition="'$(DotNetBuildFromSource)' != 'true' AND '$(BuildManagedTools)' == 'true'" BeforeTargets="Build">
    <Exec Command="$(DotnetToolCommand) build /p:__BuildArch=$(BuildArch) /p:__BuildOS=$(BuildOS) /p:__BuildType=$(BuildType) tools/r2rdump/R2RDump.csproj"
          StandardOutputImportance="Low" />
  </Target>

  <Target Name="CopyCoreLib" AfterTargets="Build">
    <Copy Condition="Exists($(CoreLibPath))"
        SourceFiles="@(ILToCopy)"
        DestinationFolder="$(BinDir)IL" />
  </Target>

  <Target Name="MovePDB" AfterTargets="Build">
    <Move Condition="Exists($(CoreLibPDBPath))"
        SourceFiles="@(PDBSToMove)"
        DestinationFolder="$(BinDir)PDB" />
  </Target>

  <ItemGroup>
    <UcrtFilesToCopy Include="$(UniversalCRTSDKDir)Redist\ucrt\DLLs\$(BuildArch)\*.dll" />
  </ItemGroup>
  <!-- Copy the UCRT files from the windows kit directory to the local directory.
       The api-*xstate.dll binary needs to be signed. -->
  <Target Name="CopyUcrtFiles" AfterTargets="Build">
    <Copy Condition="'$(BuildType)'=='Release' AND '$(BuildArch)' != 'arm64'"
        SourceFiles="@(UcrtFilesToCopy)"
        DestinationFolder="$(BinDir)Redist\ucrt\DLLs\$(BuildArch)" />
  </Target>

  <PropertyGroup>
    <RunEnforcePGO Condition="$(__EnforcePgo) == '1'">true</RunEnforcePGO>
    <RunEnforcePGO Condition="$(__BuildArch) == 'arm' OR $(__BuildArch) == 'arm64'">false</RunEnforcePGO>
  </PropertyGroup>

  <Target Name="EnforcePGO" Condition="$(RunEnforcePGO) == 'true'" AfterTargets="Build">
    <ItemGroup>
      <PGOEnforcedFiles Include="$(BinDir)coreclr.dll" />
      <PGOEnforcedFiles Include="$(BinDir)clrjit.dll" />
    </ItemGroup>

    <Message Text="Checking if the following DLLs are properly compiled with PGO" Importance="High" />
    <Exec Command="python $(MSBuildThisFileDirectory)scripts\pgocheck.py @(PGOEnforcedFiles)" />
  </Target>
</Project>