summaryrefslogtreecommitdiff
path: root/build.proj
blob: 775f6a54184e4b5ef5d69f7e7763929e36f92bb0 (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
72
73
74
75
76
77
78
79
80
81
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="dir.props" />

  <!-- required to build the projects in their specified order -->
  <PropertyGroup>
    <SerializeProjects>true</SerializeProjects>
  </PropertyGroup>

  <PropertyGroup>
    <BuildPackages Condition="'$(BuildPackages)'==''">true</BuildPackages>
  </PropertyGroup>

  <Import Project="$(ToolsDir)VersionTools.targets" Condition="Exists('$(ToolsDir)VersionTools.targets')" />

  <ItemGroup>
    <Project Include="external\dir.proj" />
    <Project Include="src\dirs.proj" />
    <Project Include="src\tests.builds" Condition="'$(BuildTests)'=='true'" />
    <!-- signing must happen before packaging -->
    <Project Include="src\sign.builds" />
    <Project Include="src\packages.builds" Condition="'$(BuildPackages)'=='true'" />
  </ItemGroup>

  <Import Project="dir.targets" />

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

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

  <PropertyGroup>
    <TraversalBuildDependsOn>
      GenerateConfigurationProperties;
      CreateOrUpdateCurrentVersionFile;
      $(TraversalBuildDependsOn);
    </TraversalBuildDependsOn>
  </PropertyGroup>

  <!-- Generate the configurations for this repo -->
  <UsingTask TaskName="GenerateConfigurationProps" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
  <Target Name="GenerateConfigurationProperties">
    <GenerateConfigurationProps Properties="@(Property)" PropertyValues="@(PropertyValue)" PropsFolder="$(BuildConfigurationFolder)" />
  </Target>

  <Target Name="Sync" DependsOnTargets="GenerateConfigurationProperties">
    <ItemGroup>
      <ExternalProject Include="external\dir.proj" />
    </ItemGroup>

    <MSBuild Projects="@(ExternalProject)"
             ContinueOnError="ErrorAndContinue" />
  </Target>

  <UsingTask TaskName="UpdateVSConfigurations" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
  <Target Name="UpdateVSConfigurations">
    <Message Importance="High" Text="Updating configurations for projects ..." />
    <ItemGroup>
      <_projectsToExcludeFromUpdate Include="$(MSBuildThisFileDirectory)src/**/RestoreSDKProject.csproj" />
      <_projectsToUpdate Include="$(MSBuildThisFileDirectory)src/**/*.*csproj" Exclude="@(_projectsToExcludeFromUpdate)" />
      <_projectsToUpdate Include="$(MSBuildThisFileDirectory)src/**/*.*ilproj" Exclude="@(_projectsToExcludeFromUpdate)" />
      <_solutionsToUpdateFiles Include="$(MSBuildThisFileDirectory)src/*/dir.props" />
      <_solutionsToUpdate Include="@(_solutionsToUpdateFiles->'%(RootDir)%(Directory)')" Exclude="@(_solutionsToExcludeFromUpdate)" />
      <_solutionsToUpdate Include="$(MSBuildThisFileDirectory)src/System.ServiceProcess.ServiceController/" >
        <ExcludePattern>TestNativeService</ExcludePattern>
      </_solutionsToUpdate>
    </ItemGroup>
    <UpdateVSConfigurations ProjectsToUpdate="@(_projectsToUpdate)" SolutionsToUpdate="@(_solutionsToUpdate)" />
    <Message Importance="High" Text="Updating configurations for projects ... Done." />
  </Target>

  <!-- Override CleanAllProjects from dir.traversal.targets and just remove the full BinDir -->
  <Target Name="CleanAllProjects">
    <RemoveDir Directories="$(BinDir)" />
    <!-- Temporarily outside BinDir -->
    <RemoveDir Directories="$(PackageInstallPath)" />
  </Target>

  <!-- Hook that can be used to insert custom build tasks to the build process such as setup and/or cleanup tasks -->
  <Import Project="build.override.targets" Condition="Exists('build.override.targets')" />

</Project>