Skip to content

Commit

Permalink
Add PublicAPI analyzer to ensure we're aware of public changes (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
twsouthwick authored Oct 26, 2021
1 parent af88cf7 commit d0182db
Show file tree
Hide file tree
Showing 44 changed files with 298,284 additions and 145 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
</PropertyGroup>
</Target>

<PropertyGroup>
<IncludeFrameworkShims Condition=" '$(IncludeFrameworkShims)' == '' ">false</IncludeFrameworkShims>
</PropertyGroup>

<Import Condition="$(IncludeFrameworkShims)" Project="$(MSBuildThisFileDirectory)src\common\FrameworkShims.targets" />

<PropertyGroup>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)\packages\</PackageOutputPath>
<PackageOutputPath Condition="$(IsShipped)">$(PackageOutputPath)shipping\</PackageOutputPath>
Expand Down
6 changes: 5 additions & 1 deletion Open-XML-SDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.vsconfig = .vsconfig
CHANGELOG.md = CHANGELOG.md
compat.yml = compat.yml
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
DocumentFormat.OpenXml.Package.props = DocumentFormat.OpenXml.Package.props
Expand All @@ -28,6 +27,11 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentFormat.OpenXml.Packaging.Tests", "test\DocumentFormat.OpenXml.Packaging.Tests\DocumentFormat.OpenXml.Packaging.Tests.csproj", "{B9138975-0D18-4EC7-92C3-A2DB71DF64E9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A4DF60EB-3AA5-48F0-B4D2-3F94B8E62F03}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Build.targets = src\Directory.Build.targets
src\common\FrameworkShims.targets = src\common\FrameworkShims.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0782A132-968D-4BDD-911A-2C3074EAF886}"
EndProject
Expand Down
6 changes: 0 additions & 6 deletions compat.yml

This file was deleted.

5 changes: 5 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="..\Directory.Build.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</Otherwise>
</Choose>

<ItemGroup>
<PackageReference Remove="Microsoft.CodeAnalysis.PublicApiAnalyzers" />
</ItemGroup>

<!-- Elements required for Analyzer / C# Source Generator -->
<!--<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

<PropertyGroup>
<IsShipped>true</IsShipped>
<IncludeFrameworkShims>true</IncludeFrameworkShims>
</PropertyGroup>

<PropertyGroup>
<Summary>Provides additional features that add functionality to the Open XML SDK.</Summary>
<Description>Provides additional functionality to the Open XML SDK.</Description>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\SimpleTypes\HexStringFactory.cs" Link="HexStringFactory.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DocumentFormat.OpenXml\DocumentFormat.OpenXml.csproj" />
</ItemGroup>
Expand All @@ -17,14 +22,4 @@
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<Compile Remove="System/Runtime/CompilerServices/IsExternalInit.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net5.0' ">
<Compile Include="..\DocumentFormat.OpenXml\System\Span.cs" Link="System\Span.cs" />
<Compile Include="..\DocumentFormat.OpenXml\System\SpanExtensions.cs" Link="System\SpanExtensions.cs" />
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/DocumentFormat.OpenXml.Features/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#nullable enable
34 changes: 34 additions & 0 deletions src/DocumentFormat.OpenXml.Features/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
DocumentFormat.OpenXml.Features.DisposableFeatureExtensions
DocumentFormat.OpenXml.Features.IDisposableFeature
DocumentFormat.OpenXml.Features.IDisposableFeature.Register(System.IDisposable! disposable) -> void
DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature
DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature.Contains(string! id) -> bool
DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature.Count.get -> int
DocumentFormat.OpenXml.Features.IParagraphIdGeneratorFeature
DocumentFormat.OpenXml.Features.IParagraphIdGeneratorFeature.CreateUniqueParagraphId() -> string!
DocumentFormat.OpenXml.Features.IRandomNumberGeneratorFeature
DocumentFormat.OpenXml.Features.IRandomNumberGeneratorFeature.GetBytes(byte[]! bytes) -> void
DocumentFormat.OpenXml.Features.ISharedFeature<T>
DocumentFormat.OpenXml.Features.ISharedFeature<T>.Add(T feature) -> void
DocumentFormat.OpenXml.Features.ISharedFeature<T>.Composite.get -> T
DocumentFormat.OpenXml.Features.ISharedFeature<T>.Count.get -> int
DocumentFormat.OpenXml.Features.ISharedFeature<T>.Remove(T feature) -> bool
DocumentFormat.OpenXml.Features.ParagraphIdFeatureExtensions
DocumentFormat.OpenXml.Features.ParagraphIdOptions
DocumentFormat.OpenXml.Features.ParagraphIdOptions.AutoGenerateIds.get -> bool
DocumentFormat.OpenXml.Features.ParagraphIdOptions.AutoGenerateIds.init -> void
DocumentFormat.OpenXml.Features.ParagraphIdOptions.EnsureUniquenessOnExistingNodes.get -> bool
DocumentFormat.OpenXml.Features.ParagraphIdOptions.EnsureUniquenessOnExistingNodes.init -> void
DocumentFormat.OpenXml.Features.ParagraphIdOptions.ParagraphIdOptions() -> void
DocumentFormat.OpenXml.Features.RandomNumberGeneratorFeatureExtensions
DocumentFormat.OpenXml.Features.SharedParagraphIdFeatureExtensions
static DocumentFormat.OpenXml.Features.DisposableFeatureExtensions.AddDisposableFeature(this DocumentFormat.OpenXml.Features.IFeatureCollection! features) -> void
static DocumentFormat.OpenXml.Features.DisposableFeatureExtensions.AddDisposableFeature(this DocumentFormat.OpenXml.Packaging.OpenXmlPackage! package) -> void
static DocumentFormat.OpenXml.Features.DisposableFeatureExtensions.AddDisposableFeature(this DocumentFormat.OpenXml.Packaging.OpenXmlPart! part) -> void
static DocumentFormat.OpenXml.Features.DisposableFeatureExtensions.SetDisposable<TFeature>(this DocumentFormat.OpenXml.Features.IFeatureCollection! features, TFeature feature) -> void
static DocumentFormat.OpenXml.Features.ParagraphIdFeatureExtensions.AddParagraphIdFeature(this DocumentFormat.OpenXml.Packaging.WordprocessingDocument! doc, DocumentFormat.OpenXml.Features.ParagraphIdOptions? options = null) -> void
static DocumentFormat.OpenXml.Features.ParagraphIdFeatureExtensions.AddParagraphIdGeneratorFeature(this DocumentFormat.OpenXml.Packaging.WordprocessingDocument! doc) -> void
static DocumentFormat.OpenXml.Features.RandomNumberGeneratorFeatureExtensions.AddRandomNumberGeneratorFeature(this DocumentFormat.OpenXml.Packaging.OpenXmlPackage! package) -> void
static DocumentFormat.OpenXml.Features.SharedParagraphIdFeatureExtensions.Add(this DocumentFormat.OpenXml.Features.ISharedFeature<DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature!>! shared, DocumentFormat.OpenXml.Packaging.WordprocessingDocument! doc) -> DocumentFormat.OpenXml.Features.ISharedFeature<DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature!>!
static DocumentFormat.OpenXml.Features.SharedParagraphIdFeatureExtensions.Add(this DocumentFormat.OpenXml.Features.ISharedFeature<DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature!>! shared, System.Collections.Generic.IEnumerable<string!>! paragraphIds) -> DocumentFormat.OpenXml.Features.ISharedFeature<DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature!>!
static DocumentFormat.OpenXml.Features.SharedParagraphIdFeatureExtensions.AddSharedParagraphIdFeature(this DocumentFormat.OpenXml.Packaging.WordprocessingDocument! doc) -> DocumentFormat.OpenXml.Features.ISharedFeature<DocumentFormat.OpenXml.Features.IParagraphIdCollectionFeature!>!
25 changes: 2 additions & 23 deletions src/DocumentFormat.OpenXml.Linq/DocumentFormat.OpenXml.Linq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<IsShipped>true</IsShipped>
<Summary>Provides additional LINQ functionality to the Open XML SDK.</Summary>
<Description>Provides additional LINQ functionality to the Open XML SDK to allow operations using XLINQ.</Description>
<NoWarn>$(NoWarn);RS0041</NoWarn>
<IncludeFrameworkShims>true</IncludeFrameworkShims>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,10 +20,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>

<When Condition=" '$(TargetFramework)' == 'net40'">
Expand All @@ -30,10 +28,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>

<When Condition=" '$(TargetFramework)' == 'net46'">
Expand All @@ -42,28 +36,13 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>

<When Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<ItemGroup>
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>

<When Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup>
<Compile Include="..\DocumentFormat.OpenXml\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Link="System\Diagnostics\CodeAnalysis\NullableAttributes.cs" />
</ItemGroup>
</When>

</Choose>

</Project>
1 change: 1 addition & 0 deletions src/DocumentFormat.OpenXml.Linq/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#nullable enable
Loading

0 comments on commit d0182db

Please sign in to comment.