summaryrefslogtreecommitdiff
path: root/build.proj
blob: 3af8010944aa1a453289d246d816ee4c5d49a13b (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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="dir.props" />

  <ItemGroup>
    <!-- We use build.proj instead of dirs.proj so we don't conflict with the TFS build-->
    <Project Include="src\build.proj" />
  </ItemGroup>

  <Import Project="dir.targets" />

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

  <Import Project="$(ToolsDir)clean.targets" />

  <!-- The following properties are in place to keep the behavior of build.cmd while we work on the dev workflow steps. -->
  <PropertyGroup>
    <!-- To disable the restoration of packages, set RestoreDuringBuild=false or pass /p:RestoreDuringBuild=false.-->
    <RestoreDuringBuild Condition="'$(RestoreDuringBuild)'==''">true</RestoreDuringBuild>
  </PropertyGroup>

  <!-- Override clean from dir.traversal.targets and just remove the full BinDir -->
  <Target Name="Clean">
    <Delete Files="$(BinDir)SOS.NETCore.*" />
    <Delete Files="$(BinDir)mscorlib.*" />
    <Delete Files="$(BinDir)System.Private.CoreLib.*" />
    <Delete Files="$(BinDir)netcoreapp2.0/R2RDump.*" />
  </Target>

  <!--
    BuildTools will conditionally restore additional packages, including IBC tools, using the "RestoreOptionalToolingPackages"
    target, which runs automatically before "Sync". Since no "Sync" target actually exists, go ahead and define one now so that
    the tools are fetched before "Build".
  -->
  <Target Name="Sync" BeforeTargets="Build"
    DependsOnTargets="RestoreOptData;RestoreNETCorePlatforms" />

  <Target Name="RestoreOptData" Condition="'$(RestoreDuringBuild)'=='true' and '$(BuildType)'=='Release'">
    <PropertyGroup>
      <_OptimizationDataFeed Condition="'$(DotNetBuildOffline)' != 'true'">--source https://dotnet.myget.org/F/dotnet-core-optimization-data/api/v3/index.json</_OptimizationDataFeed>
    </PropertyGroup>

    <Exec Command="$(DotnetRestoreCommand) $(_OptimizationDataFeed) $(SourceDir).nuget/optdata/optdata.csproj"
          StandardOutputImportance="Low" />
  </Target>

  <Target Name="RestoreNETCorePlatforms" Condition="'$(RestoreDuringBuild)'=='true'">
    <Exec Command="$(DotnetRestoreCommand) $(SourceDir).nuget/init/init.csproj"
          StandardOutputImportance="Low" />
  </Target>

  <Target Name="CleanAllProjects">
    <Message Condition="Exists($(RootBinDir))" Importance="High" Text="Removing $(RootBinDir)"/>
    <RemoveDir Directories="$(RootBinDir)" />
  </Target>

</Project>