File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [CmdletBinding (PositionalBinding = $false )]
2+ param ()
3+
4+ Set-StrictMode - version 2.0
5+ $ErrorActionPreference = " Stop"
6+
7+ function MarkShipped ([string ]$dir ) {
8+ $shippedFilePath = Join-Path $dir " PublicAPI.Shipped.txt"
9+ $shipped = @ ()
10+ $shipped += Get-Content $shippedFilePath
11+
12+ $unshippedFilePath = Join-Path $dir " PublicAPI.Unshipped.txt"
13+ $unshipped = Get-Content $unshippedFilePath
14+ $removed = @ ()
15+ $removedPrefix = " *REMOVED*" ;
16+ Write-Host " Processing $dir "
17+
18+ foreach ($item in $unshipped ) {
19+ if ($item.Length -gt 0 ) {
20+ if ($item.StartsWith ($removedPrefix )) {
21+ $item = $item.Substring ($removedPrefix.Length )
22+ $removed += $item
23+ }
24+ else {
25+ $shipped += $item
26+ }
27+ }
28+ }
29+
30+ $shipped | Sort-Object - Unique | Where-Object { -not $removed.Contains ($_ ) } | Out-File $shippedFilePath - Encoding Ascii
31+ Clear-Content $unshippedFilePath
32+ }
33+
34+ try {
35+ foreach ($file in Get-ChildItem - re -in " PublicApi.Shipped.txt" ) {
36+ $dir = Split-Path - parent $file
37+ MarkShipped $dir
38+ }
39+ }
40+ catch {
41+ Write-Host $_
42+ Write-Host $_.Exception
43+ exit 1
44+ }
You can’t perform that action at this time.
0 commit comments