summaryrefslogtreecommitdiff
path: root/Tools/Build.Common.props
blob: 11c8dd8ef5f3b2a73ec20a108eb9b5de9b900c37 (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
82
83
84
85
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
     This file will contain all of the common properties from most repos. The intention is to only have
     repo specific properties inside the repos, and move to this file everything that is common.
  -->

  <!--
    Import the reference assembly props

      Sets Properties:
        IsReferenceAssembly - Set if the project is in the ref assm path
  -->
  <Import Project="$(MSBuildThisFileDirectory)ReferenceAssemblies.props" Condition="'$(ExcludeReferenceAssembliesImport)'!='true'" />

  <Import Project="$(MSBuildThisFileDirectory)RepoAPI.Mapping.props" />

  <PropertyGroup>
    <ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
  </PropertyGroup>

  <PropertyGroup>
    <GetNuGetPackageVersionsDependsOn>CreateVersionFileDuringBuild</GetNuGetPackageVersionsDependsOn>
  </PropertyGroup>

  <!-- Platform detection -->
  <PropertyGroup>
    <DefaultOSGroup Condition="'$(OS)'=='Unix' AND Exists('/Applications')">OSX</DefaultOSGroup>
    <DefaultOSGroup Condition="'$(DefaultOSGroup)'=='' AND '$(OS)'=='Unix' AND $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</DefaultOSGroup>
    <DefaultOSGroup Condition="'$(DefaultOSGroup)'=='' AND '$(OS)'=='Unix' AND $([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</DefaultOSGroup>
    <DefaultOSGroup Condition="'$(DefaultOSGroup)'=='' AND '$(OS)'=='Unix'">Linux</DefaultOSGroup>
    <DefaultOSGroup Condition="'$(DefaultOSGroup)'==''">$(OS)</DefaultOSGroup>
    <RunningOnUnix Condition="'$(OS)'!='Windows_NT'">true</RunningOnUnix>

    <RunningOnCore Condition="'$(MSBuildRuntimeType)' == 'core'">true</RunningOnCore>
  </PropertyGroup>

  <!-- Common BuildTools properties -->
  <PropertyGroup>
    <RootIntermediateOutputPath Condition="$(RootIntermediateOutputPath) == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), init-tools.msbuild))/bin/obj/</RootIntermediateOutputPath>
    <ToolsDir Condition="'$(ToolsDir)'==''">$(MSBuildThisFileDirectory)</ToolsDir>
    <ToolRuntimePath Condition="'$(ToolRuntimePath)'==''">$(ToolsDir)</ToolRuntimePath>
    <DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolRuntimePath)dotnetcli/</DotnetCliPath>
    <OverrideToolHost Condition="'$(RunningOnUnix)' == 'true'">$(DotnetCliPath)dotnet</OverrideToolHost>
    <OverrideToolHost Condition="'$(RunningOnUnix)' != 'true'">$(DotnetCliPath)dotnet.exe</OverrideToolHost>
    <BuildToolsTaskDir Condition="'$(RunningOnCore)'!='true'">$(ToolsDir)net46/</BuildToolsTaskDir>
    <BuildToolsTaskDir Condition="'$(RunningOnCore)'=='true'">$(ToolsDir)</BuildToolsTaskDir>
    <RoslynIncompatibleMsbuildVersion Condition="'$(MSBuildToolsVersion)' == '2.0' OR
                                                 '$(MSBuildToolsVersion)' == '3.5' OR
                                                 '$(MSBuildToolsVersion)' == '4.0' OR
                                                 '$(MSBuildToolsVersion)' == '12.0' OR
                                                 '$(MSBuildToolsVersion)' == '14.0'">true</RoslynIncompatibleMsbuildVersion>
    <!-- UseSharedCompilation is not supported in MSBuild 14.0 with the new version of roslyn, so make sure we are not using that for building -->
    <UseSharedCompilation Condition="'$(UseSharedCompilation)' == '' and '$(UseRoslynCompilers)' != 'false' and '$(RoslynIncompatibleMsbuildVersion)' != 'true'">true</UseSharedCompilation>
    <GenFacadesIgnoreBuildAndRevisionMismatch>true</GenFacadesIgnoreBuildAndRevisionMismatch>
  </PropertyGroup>

  <!-- Setting IsTestProject prior to Build.Common.targets -->
  <PropertyGroup>
    <IsTestProject Condition="'$(IsTestProject)'=='' And ($(MSBuildProjectFullPath.Contains('\tests\')) OR $(MSBuildProjectFullPath.Contains('/tests/')))">true</IsTestProject>
    <IsPerformanceTestProject Condition="'$(IsPerformanceTestProject)' == '' AND '$(IsTestProject)' == 'true' AND $(MSBuildProjectName.EndsWith('Performance.Tests'))">true</IsPerformanceTestProject>
  </PropertyGroup>

  <Import Project="$(MSBuildThisFileDirectory)BuildVersion.targets" />

  <Import Project="$(MSBuildThisFileDirectory)Roslyn.Common.props" Condition="'$(DisableBuildToolsRoslynVersion)' != 'true'" />

  <!-- Restore commands -->
  <PropertyGroup>
    <DotnetToolCommand>$(OverrideToolHost)</DotnetToolCommand>
    <DotnetRestoreSource>@(DotnetSourceList -> '--source %(Identity)', ' ')</DotnetRestoreSource>
    <DotnetRestoreCommand>"$(DotnetToolCommand)"</DotnetRestoreCommand>
    <DotnetRestoreCommand>$(DotnetRestoreCommand) restore</DotnetRestoreCommand>
    <DotnetRestoreCommand>$(DotnetRestoreCommand) --packages "$(PackagesDir.TrimEnd('/').TrimEnd('\'))" $(DotnetRestoreSource)</DotnetRestoreCommand>
    <DotnetRestoreCommand Condition="'$(NuGetConfigPath)'!=''">$(DotnetRestoreCommand) --configfile $(NuGetConfigPath)</DotnetRestoreCommand>

    <!-- Keeping this for legacy reasons for now but should eliminate Dnu* eventually -->
    <DnuRestoreCommand>$(DotnetRestoreCommand)</DnuRestoreCommand>
  </PropertyGroup>

  <!--
    import the MicroBuild boot-strapper props (only relevant for shipping binaries)
  -->
  <Import Project="$(MSBuildThisFileDirectory)MicroBuild.Core.props" Condition="Exists('$(MSBuildThisFileDirectory)MicroBuild.Core.props') and '$(IsTestProject)' != 'true' and '$(ExcludeSigningImport)' != 'true'" />
</Project>