Skip to content

Commit

Permalink
Upgrade ApiCompat version and remove contract assemblies (#1308)
Browse files Browse the repository at this point in the history
* Remove contract assemblies from the repo as build pipelines are now
in charge of providing the correct contract assemblies.
* Upgrade ApiCompat to version 5-beta.
* Introduce ApiCompatExcludeAttributeList.
* Introduce a workaround for missing contract assemblies.
  • Loading branch information
GeoK authored Jan 7, 2020
1 parent 47dac47 commit b9c40c0
Show file tree
Hide file tree
Showing 51 changed files with 13 additions and 2 deletions.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 13 additions & 2 deletions build/apiCompat.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<Project>
<!-- https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.ApiCompat -->
<PropertyGroup>
<RunApiCompat>false</RunApiCompat>
<RunApiCompatForSrc>true</RunApiCompatForSrc>
<RunMatchingRefApiCompat>false</RunMatchingRefApiCompat>
<ApiCompatEnforceOptionalRules>true</ApiCompatEnforceOptionalRules>
<ApiCompatBaseline>$(SolutionDir)Tools\apiCompat\baseline\ApiCompatBaseline.$(TargetFramework).txt</ApiCompatBaseline>
<ApiCompatExcludeAttributeList>$(SolutionDir)Tools\apiCompat\ApiCompatExcludeAttributeList.txt</ApiCompatExcludeAttributeList>
<AllowMissingContractAssemblies>true</AllowMissingContractAssemblies>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="1.0.0-beta.18557.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.19626.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand All @@ -25,8 +28,16 @@
<Message Importance="High" Text=">>> Running ApiCompat for the assembly: $(TargetFramework)\$(TargetName).dll"/>
</Target>

<Target Name="CheckIfContractAssemblyExists" Condition="'$(RunApiCompat)' == 'true' AND !Exists('@(ResolvedMatchingContract)')" BeforeTargets="ValidateApiCompatForSrc">
<!--
Only warn (don't throw) if a contract assembly is not found. ApiCompat > v5 by default throws if a contract assembly is not found.
Useful when a new assembly/target is introduced and there is no contract assembly available yet.
-->
<Target Name="CheckIfContractAssemblyExists" Condition="'$(RunApiCompat)' == 'true' AND '$(AllowMissingContractAssemblies)' == 'true' AND !Exists('@(ResolvedMatchingContract)')" BeforeTargets="ValidateApiCompatForSrc">
<Warning Text=">>> Contract assembly doesn't exist. ApiCompat will not run for the assembly: @(ResolvedMatchingContract)"/>
<Copy
SourceFiles="$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)"
DestinationFolder="$(SolutionDir)Tools\apiCompat\contractAssemblies\$(TargetFramework)\"
/>
</Target>

<Target Name="ResolveContractDependencyDirectories" BeforeTargets="ValidateApiCompatForSrc">
Expand Down

0 comments on commit b9c40c0

Please sign in to comment.