File size: 3,953 Bytes
090629c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!--

***********************************************************************************************

Microsoft.NET.ApiCompat.Common.targets



WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have

          created a backup copy.  Incorrect changes to this file will make it

          impossible to load or build your projects from the command-line or the IDE.



Copyright (c) .NET Foundation. All rights reserved.

***********************************************************************************************

-->
<Project>

  <!-- Expose the tasks for SDK consumption and for external use cases. -->
  <UsingTask TaskName="Microsoft.DotNet.ApiCompat.Task.ValidateAssembliesTask" AssemblyFile="$(DotNetApiCompatTaskAssembly)" />
  <UsingTask TaskName="Microsoft.DotNet.ApiCompat.Task.ValidatePackageTask" AssemblyFile="$(DotNetApiCompatTaskAssembly)" />

  <Target Name="CollectApiCompatInputs">
    <PropertyGroup Condition="'$(RoslynAssembliesPath)' == ''">
      <!-- If a custom roslyn assemblies path isn't provided, the opt-in switch 'ApiCompatUseRoslynToolsetPackagePath' is set to true and

           the roslyn toolset package is referenced, use the assemblies from that package. -->
      <_UseRoslynToolsetPackage Condition="'$(ApiCompatUseRoslynToolsetPackagePath)' == 'true' and '@(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.Net.Compilers.Toolset'))' == 'true'">true</_UseRoslynToolsetPackage>

      <!-- CSharpCoreTargetsPath and VisualBasicCoreTargetsPath point to the same location, Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.VisualBasic

           are on the same directory as Microsoft.CodeAnalysis. So there is no need to distinguish between csproj or vbproj. -->
      <RoslynAssembliesPath Condition="'$(_UseRoslynToolsetPackage)' == 'true'">$([System.IO.Path]::GetDirectoryName('$(CSharpCoreTargetsPath)'))</RoslynAssembliesPath>
      
      <!-- Otherwise, default to the roslyn compiler provided by the SDK / Visual Studio. -->
      <RoslynAssembliesPath Condition="'$(_UseRoslynToolsetPackage)' != 'true'">$(RoslynTargetsPath)</RoslynAssembliesPath>

      <!-- The SDK stores the roslyn assemblies in the 'bincore' subdirectory. -->
      <RoslynAssembliesPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$([System.IO.Path]::Combine('$(RoslynAssembliesPath)', 'bincore'))</RoslynAssembliesPath>
    </PropertyGroup>

    <!-- Respect legacy property and item names. -->
    <PropertyGroup>
      <ApiCompatGenerateSuppressionFile Condition="'$(ApiCompatGenerateSuppressionFile)' == ''">$(GenerateCompatibilitySuppressionFile)</ApiCompatGenerateSuppressionFile>
    </PropertyGroup>

    <ItemGroup>
      <ApiCompatSuppressionFile Include="$(CompatibilitySuppressionFilePath)"

                                Condition="'@(ApiCompatSuppressionFile)' == '' and '$(CompatibilitySuppressionFilePath)' != ''" />
    </ItemGroup>
    <!-- END: Respect legacy property and item names. -->

    <PropertyGroup>
      <_apiCompatDefaultProjectSuppressionFile>$([MSBuild]::NormalizePath('$(MSBuildProjectDirectory)', 'CompatibilitySuppressions.xml'))</_apiCompatDefaultProjectSuppressionFile>
      <!-- Pass in a default suppression output file if non is supplied, and ApiCompatGenerateSuppressionFile is true. -->
      <ApiCompatSuppressionOutputFile Condition="'$(ApiCompatSuppressionOutputFile)' == '' and '$(ApiCompatGenerateSuppressionFile)' == 'true'">$(_apiCompatDefaultProjectSuppressionFile)</ApiCompatSuppressionOutputFile>
    </PropertyGroup>

    <!-- Pass in a default suppression file, if it exists. -->
    <ItemGroup Condition="'@(ApiCompatSuppressionFile)' == ''">
      <ApiCompatSuppressionFile Include="$(_apiCompatDefaultProjectSuppressionFile)"

                                Condition="Exists($(_apiCompatDefaultProjectSuppressionFile))" />
    </ItemGroup>
  </Target>

</Project>