Skip to content

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
"commands": [
2020
"meziantou.validate-nuget-package"
2121
]
22+
},
23+
"powershell": {
24+
"version": "7.4.0",
25+
"commands": [
26+
"pwsh"
27+
]
2228
}
2329
}
2430
}

tools/mark-shipped.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
dotnet pwsh -NoProfile -ExecutionPolicy RemoteSigned -File "%~dpn0.ps1"

tools/mark-shipped.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[CmdletBinding(PositionalBinding=$false)]
2+
param ()
3+
4+
Set-StrictMode -Version 2.0
5+
$ErrorActionPreference = 'Stop'
6+
7+
function MarkShipped([string]$dir)
8+
{
9+
$shippedFilePath = Join-Path $dir 'PublicAPI.Shipped.txt'
10+
[array]$shipped = Get-Content $shippedFilePath
11+
12+
$unshippedFilePath = Join-Path $dir 'PublicAPI.Unshipped.txt'
13+
[array]$unshipped = Get-Content $unshippedFilePath | ? { $_ -and $_ -notmatch '^#' }
14+
15+
$removed = @()
16+
$removedPrefix = '*REMOVED*';
17+
Write-Verbose "Processing $dir"
18+
19+
foreach ($item in $unshipped)
20+
{
21+
if ($item.StartsWith($removedPrefix))
22+
{
23+
$item = $item.Substring($removedPrefix.Length)
24+
$removed += $item
25+
}
26+
else
27+
{
28+
$shipped += $item
29+
}
30+
}
31+
32+
$shipped |
33+
Sort-Object |
34+
? { -not $removed.Contains($_) } |
35+
Out-File $shippedFilePath -Encoding Ascii
36+
37+
'#nullable enable' | Out-File $unshippedFilePath -Encoding Ascii
38+
}
39+
40+
foreach ($file in Get-ChildItem -re -in 'PublicApi.Shipped.txt')
41+
{
42+
$dir = Split-Path -parent $file
43+
MarkShipped $dir
44+
}

0 commit comments

Comments
 (0)