summaryrefslogtreecommitdiff
path: root/tests/src/dir.props
blob: 89b43f8e5f7e9cade73cfaad27281211ffce70df (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- tests/dir.common.props must be imported first, as
       tests/dir.props relies on properties computed in this import
       chain. -->
  <!-- TODO: remove this when we use the SDK. Then tests/dir.props
       will automatically import tests/dir.common.props. -->
  <Import Project="..\dir.common.props" Condition="'$(UsingMicrosoftNETSdk)' != 'true'"  />
  <Import Project="..\dir.props" />


  <!-- Setup Default symbol and optimization for Configuration -->
  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
    <Optimize Condition="'$(Optimize)' == ''">false</Optimize>
    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
    <DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
    <DefineConstants>$(DefineConstants);TRACE;XUNIT_PERF</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Checked'">
    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
  </PropertyGroup>

  <!-- Setup target platform pointer size in bit-->
  <PropertyGroup>
    <PointerSize Condition="'$(Platform)'=='x64'">64</PointerSize>
    <PointerSize Condition="'$(Platform)'=='arm64'">64</PointerSize>
    <PointerSize Condition="'$(Platform)'=='x86'">32</PointerSize>
    <PointerSize Condition="'$(Platform)'=='arm'">32</PointerSize>
    <PointerSize Condition="'$(Platform)'=='armel'">32</PointerSize>
  </PropertyGroup>

  <!-- Setup the default output and intermediate paths -->
  <PropertyGroup>
    <BaseOutputPath>$(ProjectDir)..\bin\tests</BaseOutputPath>
    <BaseOutputPath Condition="'$(__TestRootDir)' != ''">$(__TestRootDir)</BaseOutputPath>
    <BaseOutputPathWithConfig>$(BaseOutputPath)\$(OSPlatformConfig)\</BaseOutputPathWithConfig>
    <BinDir>$(BaseOutputPathWithConfig)</BinDir>
    <BaseIntermediateOutputPath>$(ProjectDir)..\bin\tests\obj\$(OSPlatformConfig)\Managed\</BaseIntermediateOutputPath>
    <BaseIntermediateOutputPath Condition="'$(__ManagedTestIntermediatesDir)' != ''">$(__ManagedTestIntermediatesDir)\</BaseIntermediateOutputPath>
    <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\Native\))</__NativeTestIntermediatesDir>
    <BuildProjectRelativeDir>$(MSBuildProjectName)\</BuildProjectRelativeDir>
    <BuildProjectRelativeDir Condition="'$(MSBuildProjectDirectory.Contains($(SourceDir)))'">$([System.String]::Copy('$(MSBuildProjectDirectory)').Replace($(SourceDir),''))\$(MSBuildProjectName)</BuildProjectRelativeDir>
    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(BuildProjectRelativeDir)\</IntermediateOutputPath>
    <OutputPath>$(BaseOutputPathWithConfig)$(BuildProjectRelativeDir)\</OutputPath>
    <TestWorkingDir Condition="'$(TestWorkingDir)'==''">$(BaseOutputPath)\testStagingDir\</TestWorkingDir>
    <TestPath Condition="'$(TestPath)'==''">$(TestWorkingDir)$(OSPlatformConfig)\$(MSBuildProjectName)/</TestPath>
    <SkipXunitDependencyCopying>true</SkipXunitDependencyCopying>
  </PropertyGroup>

  <!-- Disable some standard properties for building our projects -->
  <PropertyGroup>
    <NoStdLib>true</NoStdLib>
    <NoExplicitReferenceToStdLib>true</NoExplicitReferenceToStdLib>
    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
    <!-- Disable some C# warnings for the tests. -->
    <NoWarn>78,162,164,168,169,219,251,252,414,429,642,649,652,675,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <SkipSigning Condition="'$(CrossGen)' == 'true'">true</SkipSigning>
    <AssemblyKey>Test</AssemblyKey>
  </PropertyGroup>

  <!-- Expose the target OS in a more convenient fashion -->
  <PropertyGroup>
    <OSGroup Condition="'$(OSGroup)'=='' and $(OSPlatformConfig.StartsWith('Windows'))">Windows_NT</OSGroup>
    <OSGroup Condition="'$(OSGroup)'=='' and $(OSPlatformConfig.StartsWith('Linux'))">Linux</OSGroup>
    <OSGroup Condition="'$(OSGroup)'=='' and $(OSPlatformConfig.StartsWith('OSX'))">OSX</OSGroup>
    <OSGroup Condition="'$(OSGroup)'=='' and $(OSPlatformConfig.StartsWith('FreeBSD'))">FreeBSD</OSGroup>
    <OSGroup Condition="'$(OSGroup)'==''">AnyOS</OSGroup>
  </PropertyGroup>

  <!-- Setup properties per OSGroup -->
  <Choose>
    <When Condition="'$(OSGroup)'=='AnyOS'">
      <PropertyGroup>
      </PropertyGroup>
    </When>
    <When Condition="'$(OSGroup)'=='Windows_NT'">
      <PropertyGroup>
        <!-- Since cross compilation of test builds on Windows is possible, the
             TargetsWindows property may already be set. Only set the property if
             it is not already defined -->
        <TargetsWindows Condition="'$(TargetsWindows)' == ''" >true</TargetsWindows>
        <TestNugetRuntimeId>win-$(__BuildArch)</TestNugetRuntimeId>
      </PropertyGroup>
    </When>
    <When Condition="'$(OSGroup)'=='Linux'">
      <PropertyGroup>
        <TargetsUnix>true</TargetsUnix>
        <TargetsLinux>true</TargetsLinux>
        <TestNugetRuntimeId>ubuntu.14.04-$(__BuildArch)</TestNugetRuntimeId>
      </PropertyGroup>
    </When>
    <When Condition="'$(OSGroup)'=='OSX'">
      <PropertyGroup>
        <TargetsUnix>true</TargetsUnix>
        <TargetsOSX>true</TargetsOSX>
        <TestNugetRuntimeId>osx.10.12-$(__BuildArch)</TestNugetRuntimeId>
      </PropertyGroup>
    </When>
    <When Condition="'$(OSGroup)'=='FreeBSD'">
      <PropertyGroup>
        <TargetsUnix>true</TargetsUnix>
        <TargetsFreeBSD>true</TargetsFreeBSD>
        <TestNugetRuntimeId>ubuntu.14.04-$(__BuildArch)</TestNugetRuntimeId>
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup>
        <ConfigurationErrorMsg>$(ConfigurationErrorMsg);Unknown OSGroup [$(OSGroup)] specificed in your project.</ConfigurationErrorMsg>
      </PropertyGroup>
    </Otherwise>
  </Choose>

  <PropertyGroup>
    <TargetRid>$(__RuntimeId)</TargetRid>
    <TargetRid Condition="'$(TargetRid)' == ''">$(TestNugetRuntimeId)</TargetRid>
  </PropertyGroup>

  <PropertyGroup>
    <TargetsUnknownUnix Condition="'$(TargetsUnix)' == 'true' AND '$(OSGroup)' != 'FreeBSD' AND '$(OSGroup)' != 'Linux' AND '$(OSGroup)' != 'OSX'">true</TargetsUnknownUnix>
    <Language Condition="'$(Language)' == '' and  '$(MSBuildProjectExtension)' == '.csproj'">C#</Language>
    <Language Condition="'$(Language)' == '' and  '$(MSBuildProjectExtension)' == '.ilproj'">IL</Language>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
    <!-- RAR thinks all EXEs require binding redirects.  That's not the case for CoreCLR -->
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>

  <!-- Don't reference the mscorlib facade -->
  <PropertyGroup>
    <ExcludeMscorlibFacade>true</ExcludeMscorlibFacade>
  </PropertyGroup>

  <!-- Set default ZapRequire level (used only when CrossGen is enabled) -->
  <PropertyGroup>
    <ZapRequire Condition="'$(ZapRequire)' == ''">2</ZapRequire>
  </PropertyGroup>
  
  <PropertyGroup>
    <RestoreOutputPath>$(MSBuildProjectDirectory)\obj-$(TargetRid)</RestoreOutputPath>

    <!-- Specify the target framework of the common test dependency project.json. -->
    <NuGetTargetMoniker>.NETCoreApp,Version=v3.1</NuGetTargetMoniker>
    <NuGetTargetMonikerShort>netcoreapp3.1</NuGetTargetMonikerShort>
    <PrereleaseResolveNuGetPackages>true</PrereleaseResolveNuGetPackages>
  </PropertyGroup>

</Project>