Merge branch 'release/3.1' into merge/release/3.0-to-release/3.1
[platform/upstream/coreclr.git] / tests / src / Common / CoreFX / CoreFX.depproj
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
3   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4   <PropertyGroup>
5       <RestoreOutputPath>$(SourceDir)Common\CoreFX\obj</RestoreOutputPath>
6       <Language>C#</Language>
7       <NugetTargetMoniker>.NETCoreApp,Version=v3.1</NugetTargetMoniker>
8       <TargetFramework>netcoreapp3.1</TargetFramework>
9       <ContainsPackageReferences>true</ContainsPackageReferences>
10       <CLRTestKind>SharedLibrary</CLRTestKind>
11       <IsTestProject>false</IsTestProject>
12       <MicrosoftDiagnosticsRuntimePackageVersion>1.0.5</MicrosoftDiagnosticsRuntimePackageVersion>
13   </PropertyGroup>
14
15   <!-- Switch RuntimeIdentifier according to currently targeted OSGroup -->
16   <PropertyGroup>
17       <RuntimeIdentifier Condition="'$(OSGroup)' == 'Windows_NT'">win-$(Platform)</RuntimeIdentifier>
18       <RuntimeIdentifier Condition="'$(OSGroup)' == 'Linux'">linux-$(Platform)</RuntimeIdentifier>
19       <RuntimeIdentifier Condition="'$(OSGroup)' == 'OSX'">osx-$(Platform)</RuntimeIdentifier>
20       <NugetRuntimeIdentifier>$(RuntimeIdentifier)</NugetRuntimeIdentifier>
21
22       <!-- Set AdditionalRestoreArgs so the _DnuRestoreCommandFull in Tools\packageresolve.targets
23            passes these on to 'dotnet restore'. This is needed so all the various dirs.props files
24            set up the target architecture correctly, so $(Platform) above gets set correctly, among
25            other things. (Note that _DnuRestoreCommandFull doesn't properly set
26            TargetGroup/ConfigurationGroup/ArchGroup, and even if they are set, it isn't used by
27            the various dirs.props files.)
28       -->
29       <AdditionalRestoreArgs>/p:__BuildOS=$(__BuildOS) /p:__BuildType=$(__BuildType) /p:__BuildArch=$(__BuildArch)</AdditionalRestoreArgs>
30   </PropertyGroup>
31
32   <ItemGroup>
33
34     <!-- Microsoft.Private.CoreFx.OOB is a meta-package that contains references to most of what we need -->
35     <PackageReference Include="Microsoft.Private.CoreFx.OOB" Version="$(MicrosoftPrivateCoreFxNETCoreAppVersion)" />
36
37     <!-- dotnet.exe -->
38     <PackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(MicrosoftNETCoreAppVersion)" />
39
40     <!-- hostfxr.dll -->
41     <PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreAppVersion)" />
42
43     <!-- hostpolicy.dll -->
44     <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="$(MicrosoftNETCoreAppVersion)" />
45
46   </ItemGroup>
47
48   <!-- Target SetupTestingHost needs to run after "AfterResolveReferences" so @(ReferenceCopyLocalPaths) is
49        set up, and before "BeforeCompile" because @(ReferenceCopyLocalPaths) is cleared out during the
50        compile phase.
51   -->
52   <Target Name="SetupTestingHost" AfterTargets="AfterResolveReferences" BeforeTargets="BeforeCompile">
53
54     <Error Condition="'$(CORE_ROOT)' == ''"
55            Text="CORE_ROOT variable is not set." />
56
57     <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
58       <HostFxrFileName>hostfxr</HostFxrFileName>
59       <HostFxrFileExtension>dll</HostFxrFileExtension>
60       <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
61       <HostPolicyFileName>hostpolicy</HostPolicyFileName>
62       <HostPolicyExtension>dll</HostPolicyExtension>
63     </PropertyGroup>
64
65     <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
66       <HostFxrFileName>libhostfxr</HostFxrFileName>
67       <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
68       <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
69       <HostPolicyFileName>libhostpolicy</HostPolicyFileName>
70       <HostPolicyExtension>$(HostFxrFileExtension)</HostPolicyExtension>
71       <DotnetExecutableName>dotnet</DotnetExecutableName>
72     </PropertyGroup>
73
74     <ItemGroup>
75       <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency
76            The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root
77       -->
78       <!--
79       <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
80       -->
81
82       <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
83       <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
84
85       <!-- Exclude subdirectories that contain cross-architecture (possibly cross-bitness) crossgen/JIT -->
86       <TestDependenciesToExclude Include="$(CORE_ROOT)\**\x64\*"/>
87
88       <!-- Don't include all the nuget files -->
89       <TestDependenciesToExclude Include="$(CORE_ROOT)\.nuget\**\*"/>
90
91       <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
92     </ItemGroup>
93
94     <ItemGroup>
95       <!-- REVIEW: do we need to copy recursively (and flatten the structure into a single destination folder)? Can we just copy
96            the top level? Or, should we preserve the hierarchy?
97       -->
98       <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
99     </ItemGroup>
100
101     <ItemGroup>
102       <HostFxFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostFxrFileName)'" />
103       <DotnetExe Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == 'dotnet'" />
104       <HostPolicyFile Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Filename)' == '$(HostPolicyFileName)'" />
105     </ItemGroup>
106
107     <Copy SourceFiles="@(HostFxFile)"
108           DestinationFolder="$(NETCoreAppTestHostFxrPath)"
109           SkipUnchangedFiles="true"
110           UseHardlinksIfPossible="true" />
111
112     <Copy SourceFiles="@(HostPolicyFile)"
113           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
114           SkipUnchangedFiles="true"
115           UseHardlinksIfPossible="true" />
116
117     <Copy SourceFiles="@(DotnetExe)"
118           DestinationFolder="$(TestHostRootPath)"
119           SkipUnchangedFiles="true"
120           UseHardlinksIfPossible="true"  />
121
122     <Copy SourceFiles="@(CoreCLRBinaries)"
123           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)"
124           SkipUnchangedFiles="true" />
125
126     <Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(OSGroup)' != 'Windows_NT'"/>
127   </Target>
128
129   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
130
131   <PropertyGroup>
132     <ProjectAssetsFile>$(SourceDir)Common\CoreFX\obj\project.assets.json</ProjectAssetsFile>
133   </PropertyGroup>
134 </Project>