Merge pull request #11054 from wtgodbe/spacing
[platform/upstream/coreclr.git] / tests / xunitwrapper.targets
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- This overrides the typical ResolveNuGetPackages so that it does copy local of the
3      referenced items.  This is used so that we can correctly resolve and copy the libraries necessary
4      to the core_root directory -->
5
6 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7   <Target Name="ResolveNuGetPackages">
8  
9     <PrereleaseResolveNuGetPackageAssets Condition="Exists($(ProjectLockJson))"
10                                          AllowFallbackOnTargetSelection="true"
11                                          IncludeFrameworkReferences="false"
12                                          NuGetPackagesDirectory="$(PackagesDir)"
13                                          RuntimeIdentifier="$(TestNugetRuntimeId)"
14                                          ProjectLanguage="$(Language)"
15                                          ProjectLockFile="$(ProjectLockJson)"
16                                          TargetMonikers="$(TargetFrameworkMoniker)">
17       <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
18       <Output TaskParameter="ResolvedReferences" ItemName="Reference" />
19       <Output TaskParameter="ResolvedCopyLocalItems" ItemName="CopyLocal" />
20     </PrereleaseResolveNuGetPackageAssets>
21
22     <!-- We may have an indirect package reference that we want to replace with a project reference -->
23     <ItemGroup>
24       <!-- Convert to file names so that we can intersect -->
25       <_ProjectReferenceFilenames Include="@(_ResolvedProjectReferencePaths->'%(FileName)%(Extension)')">
26         <OriginalIdentity>%(Identity)</OriginalIdentity>
27       </_ProjectReferenceFilenames>
28
29       <_ReferencesFileNames Include="@(Reference->'%(FileName)%(Extension)')">
30         <OriginalIdentity>%(Identity)</OriginalIdentity>
31       </_ReferencesFileNames>
32
33       <_CopyLocalFileNames Include="@(CopyLocal->'%(FileName)%(Extension)')">
34         <OriginalIdentity>%(Identity)</OriginalIdentity>
35       </_CopyLocalFileNames>
36       
37       <!-- Intersect project-refs with package-refs -->
38       <_ReferenceFileNamesToRemove Include="@(_ReferencesFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_ReferencesFileNames)' and '%(Identity)' != ''"/>
39       <_CopyLocalFileNamesToRemove Include="@(_CopyLocalFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_CopyLocalFileNames)' and '%(Identity)' != ''"/>
40
41       <Reference Remove="@(_ReferenceFileNamesToRemove)" />
42       <CopyLocal Remove="@(_CopyLocalFileNamesToRemove)"/>
43     </ItemGroup>
44     
45     <Message Text="Excluding @(_ReferenceFileNamesToRemove);@(_CopyLocalFileNamesToRemove) from package references since the same file is provided by a project reference."
46              Condition="'@(_ReferenceFileNamesToRemove)' != '' or '@(_CopyLocalFileNamesToRemove)' != ''"/>
47              
48     <Copy
49       SourceFiles="@(CopyLocal)"
50       DestinationFolder="$(OutDir)"
51       SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
52       OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
53       Retries="$(CopyRetryCount)"
54       RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
55       UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
56       
57       <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
58     </Copy>
59     
60   </Target>
61 </Project>