Skip to content

Commit 6556c6e

Browse files
author
Keegan Caruso
committed
Add mark-shipped.ps1
1 parent 38c3f4e commit 6556c6e

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

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+
$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+
}

0 commit comments

Comments
 (0)