@@ -7,37 +7,45 @@ Set-StrictMode -version 2.0
77$ErrorActionPreference = " Stop"
88
99function MarkShipped ([string ]$dir ) {
10+ $nullableHeader = " #nullable enable" ;
1011 $shippedFilePath = Join-Path $dir " PublicAPI.Shipped.txt"
1112 $shipped = @ ()
1213 $shipped += Get-Content $shippedFilePath
1314
1415 $unshippedFilePath = Join-Path $dir " PublicAPI.Unshipped.txt"
1516 $unshipped = Get-Content $unshippedFilePath
17+ $added = @ ()
1618 $removed = @ ()
1719 $removedPrefix = " *REMOVED*" ;
18- Write-Host " Processing $dir "
1920
2021 foreach ($item in $unshipped ) {
21- if ($item.Length -gt 0 ) {
22+ if ($item.Length -gt 0 -and $item -ne $nullableHeader ) {
2223 if ( $item.StartsWith ($removedPrefix )) {
2324 $item = $item.Substring ($removedPrefix.Length )
2425 $removed += $item
2526 }
2627 else {
2728 $shipped += $item
29+ $added += $item
2830 }
2931 }
3032 }
3133
34+ $changeCount = $added.Count + $removed.Count
35+ Write-Host (" {0,-6} Processed {1}" -f " [$changeCount ]" , $unshippedFilePath )
36+
3237 $shipped | Sort-Object - Unique | Where-Object { -not $removed.Contains ($_ ) } | Out-File $shippedFilePath - Encoding Ascii
33- " #nullable enable " | Out-File $unshippedFilePath - Encoding Ascii
38+ $nullableHeader | Out-File $unshippedFilePath - Encoding Ascii
3439}
3540
3641try {
3742 foreach ($file in Get-ChildItem - re -in " PublicApi.Shipped.txt" ) {
3843 $dir = Split-Path - parent $file
3944 MarkShipped $dir
4045 }
46+ if ($null -ne (git status -- porcelain)) {
47+ Write-Host " Changes detected, committing and pushing changes"
48+ }
4149}
4250catch {
4351 Write-Host $_
0 commit comments