Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublicApiAnalyzer refinements #3677

Merged
merged 41 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9305c33
Add PublicAPI files as additional files
tobias-tengler May 7, 2021
bdaee63
Exclude PublicAPI files from VS Code search
tobias-tengler May 7, 2021
63a342f
Fix issue
tobias-tengler May 7, 2021
5ecdf59
Add new scalars to public api
tobias-tengler May 10, 2021
25f0307
Add breaking flag to display-unshipped-api.ps1
tobias-tengler May 12, 2021
a5937ff
Add separate CheckPublicApi Nuke target
tobias-tengler May 12, 2021
9053ec5
Run public api check in azure devops pipeline
tobias-tengler May 13, 2021
48fd81e
Intentionally add undocumented public api change
tobias-tengler May 13, 2021
0cba5b7
Revert "Intentionally add undocumented public api change"
tobias-tengler May 13, 2021
44d3b4f
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 13, 2021
6a74900
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 15, 2021
85e1139
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 15, 2021
ded6625
Add error codes to APIBaselines.md for better discoverability
tobias-tengler May 15, 2021
6b121c0
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 18, 2021
c17b90a
Update API-Baselines.md
tobias-tengler May 18, 2021
9ee4ca2
Document Pipeline Job
tobias-tengler May 18, 2021
e5e3683
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 21, 2021
5feeeb2
Remove AdditionalFile requirement
tobias-tengler May 22, 2021
61e6140
Use current branch for the diff-shipped-api.ps1 script
tobias-tengler May 22, 2021
00931b1
Remember Tab Selection (#3699)
tobias-tengler May 22, 2021
cf1f1ab
Merge branch 'main' into tte/public-api-analyzer-refinements
tobias-tengler May 22, 2021
e445629
Update API-Baselines.md
tobias-tengler May 22, 2021
5b94fc7
Add add-unshipped-apis.ps1
tobias-tengler May 23, 2021
a5ff804
Merge branch 'develop' into tte/public-api-analyzer-refinements
michaelstaib May 23, 2021
c756c42
Add GitHub action for public api change
tobias-tengler May 24, 2021
329ef28
Added DiffShippedApi and
michaelstaib May 24, 2021
4edce0e
Updated Nuke
michaelstaib May 24, 2021
fb10473
Delete diff-shipped-api.ps1
michaelstaib May 24, 2021
97584f9
Update script documentation
tobias-tengler May 24, 2021
59a199e
Remove add-unshipped-apis.ps1
tobias-tengler May 24, 2021
cd08255
Add new apis
tobias-tengler May 24, 2021
46e6dd5
Correctly remove apis
tobias-tengler May 24, 2021
8a90e6b
Move PublicAPI.empty.txt to src directory
tobias-tengler May 25, 2021
9a89d22
Add MarkApiShipped nuke target
tobias-tengler May 25, 2021
e71c46b
Add DisplayUnshippedApi nuke target
tobias-tengler May 25, 2021
2117a93
Remove scripts directory
tobias-tengler May 25, 2021
f7290d0
Remove todo
tobias-tengler May 25, 2021
406fce6
Merge branch 'develop' into tte/public-api-analyzer-refinements
michaelstaib May 27, 2021
b6a87c1
Updated Pipelines
michaelstaib May 27, 2021
65a81c2
Added 2.1 SDK
michaelstaib May 27, 2021
10bf00d
Fixed client introspection tests
michaelstaib May 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .build/Build.CheckPublicApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.AzurePipelines;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution;
using Nuke.Common.Tools.DotNet;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Helpers;

partial class Build : NukeBuild
{
Target CheckPublicApi => _ => _
.DependsOn(Restore)
.Executes(() =>
{
if (!InvokedTargets.Contains(Restore))
{
DotNetBuildSonarSolution(AllSolutionFile);
}

DotNetBuild(c => c
.SetProjectFile(AllSolutionFile)
.SetNoRestore(InvokedTargets.Contains(Restore))
.SetConfiguration(Configuration)
.SetProperty("RequireDocumentationOfPublicApiChanges", true));
});
tobias-tengler marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 1 addition & 2 deletions .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ partial class Build : NukeBuild
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.SetVersion(GitVersion.SemVer)
.SetProperty("RequireDocumentationOfPublicApiChanges", true));
.SetVersion(GitVersion.SemVer));
});
}
6 changes: 6 additions & 0 deletions API-Baselines.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ It also takes care of removing lines marked with `*REMOVE*` (removals of APIs).

This will output the contents of all `PublicAPI.Unshipped.txt` files throughout the project.

If we only want to see the breaking changes, we can add the `breaking` flag:

```sh
display-unshipped-api.ps1 -breaking $true
```

### diff-shipped-api.ps1

This shows all changes of `PublicAPI.Shipped.txt` files between git refs. Tags, commit hashes and branch names are supported.
Expand Down
2 changes: 1 addition & 1 deletion scripts/diff-shipped-api.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[CmdletBinding(PositionalBinding=$false)]
[CmdletBinding(PositionalBinding = $false)]
param (
[string]$from,
[string]$to = "main"
Expand Down
14 changes: 13 additions & 1 deletion scripts/display-unshipped-api.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
[CmdletBinding(PositionalBinding = $false)]
param ()
param (
[bool]$breaking = $false
)

Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
$removedPrefix = "*REMOVED*";

function ShowUnshipped([string]$file, [string]$src_dir) {
[string[]]$unshipped = Get-Content $file

if ($breaking) {
$unshipped = $unshipped | Where-Object { $_.StartsWith($removedPrefix) }
}

if ([string]::IsNullOrWhiteSpace($unshipped)) {
return
}

$dir = (Split-Path -parent $file) -replace [regex]::escape($src_dir + [IO.Path]::DirectorySeparatorChar), ""

Write-Host -Foreground green "## ${dir}"

foreach ($item in $unshipped) {
Expand All @@ -24,6 +32,10 @@ function ShowUnshipped([string]$file, [string]$src_dir) {
try {
$src_dir = Resolve-Path -Path "../src"

if ($breaking) {
Write-Host "Breaking changes:"
}

foreach ($file in Get-ChildItem -Path "$src_dir" -Recurse -Include "PublicApi.Unshipped.txt") {
ShowUnshipped $file $src_dir
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/mark-api-shipped.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ param ()

Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
$removedPrefix = "*REMOVED*";

function MarkShipped([string]$dir) {
$shippedFilePath = Join-Path $dir "PublicAPI.Shipped.txt"
Expand All @@ -18,7 +19,6 @@ function MarkShipped([string]$dir) {
}

$removed = @()
$removedPrefix = "*REMOVED*";

Write-Host "Processing $dir"

Expand All @@ -43,6 +43,8 @@ try {
$dir = Split-Path -parent $file
MarkShipped $dir
}

Write-Host "Marked unshipped API as shipped!"
}
catch {
Write-Host $_
Expand Down
8 changes: 8 additions & 0 deletions src/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/PublicAPI*.txt": true
}
}
3 changes: 3 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
<ExcludeAssets>compile</ExcludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

<AdditionalFiles Include="PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI.Unshipped.txt" />
</ItemGroup>

<Target Name="_CheckIgnoredPublicApiFiles"
Expand Down
4 changes: 4 additions & 0 deletions src/HotChocolate/Core/src/Core/HotChocolate.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@
</EmbeddedResource>
</ItemGroup>

<PropertyGroup>
<AddPublicApiAnalyzers>false</AddPublicApiAnalyzers>
</PropertyGroup>

</Project>
19 changes: 18 additions & 1 deletion src/HotChocolate/Core/src/Types.Scalars/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@

HotChocolate.Types.LatitudeType
HotChocolate.Types.LatitudeType.LatitudeType() -> void
HotChocolate.Types.LatitudeType.LatitudeType(HotChocolate.NameString name, string? description = null, HotChocolate.Types.BindingBehavior bind = HotChocolate.Types.BindingBehavior.Explicit) -> void
HotChocolate.Types.LongitudeType
HotChocolate.Types.LongitudeType.LongitudeType() -> void
HotChocolate.Types.LongitudeType.LongitudeType(HotChocolate.NameString name, string? description = null, HotChocolate.Types.BindingBehavior bind = HotChocolate.Types.BindingBehavior.Explicit) -> void
override HotChocolate.Types.LatitudeType.IsInstanceOfType(double runtimeValue) -> bool
override HotChocolate.Types.LatitudeType.ParseLiteral(HotChocolate.Language.StringValueNode! valueSyntax) -> double
override HotChocolate.Types.LatitudeType.ParseResult(object? resultValue) -> HotChocolate.Language.IValueNode!
override HotChocolate.Types.LatitudeType.ParseValue(double runtimeValue) -> HotChocolate.Language.StringValueNode!
override HotChocolate.Types.LatitudeType.TryDeserialize(object? resultValue, out object? runtimeValue) -> bool
override HotChocolate.Types.LatitudeType.TrySerialize(object? runtimeValue, out object? resultValue) -> bool
override HotChocolate.Types.LongitudeType.IsInstanceOfType(double runtimeValue) -> bool
override HotChocolate.Types.LongitudeType.ParseLiteral(HotChocolate.Language.StringValueNode! valueSyntax) -> double
override HotChocolate.Types.LongitudeType.ParseResult(object? resultValue) -> HotChocolate.Language.IValueNode!
override HotChocolate.Types.LongitudeType.ParseValue(double runtimeValue) -> HotChocolate.Language.StringValueNode!
override HotChocolate.Types.LongitudeType.TryDeserialize(object? resultValue, out object? runtimeValue) -> bool
override HotChocolate.Types.LongitudeType.TrySerialize(object? runtimeValue, out object? resultValue) -> bool
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public IInterfaceTypeDescriptor Interface<TInterface>(
=> Implements(type);

[Obsolete("Use Implements.")]
public IInterfaceTypeDescriptor Interface(NamedTypeNode type)
=> Implements(type);
public IInterfaceTypeDescriptor Interface(NamedTypeNode namedType)
=> Implements(namedType);

public IInterfaceTypeDescriptor Implements<T>()
where T : InterfaceType
Expand Down