Skip to content

Commit 4a96981

Browse files
committed
[main] Check in mark-shipped.* scripts
- `cherry-pick` of 2b60776 - what I used to merge PublicAPI files - slight variation of <https://github.com/dotnet/roslyn/tree/main/scripts/PublicApi>
1 parent 5795084 commit 4a96981

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

eng/scripts/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+
powershell -noprofile -executionPolicy Bypass -file "%~dp0\mark-shipped.ps1"

eng/scripts/mark-shipped.ps1

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 = Get-Content $shippedFilePath
10+
if ($null -eq $shipped) {
11+
$shipped = @()
12+
}
13+
14+
$unshippedFilePath = Join-Path $dir "PublicAPI.Unshipped.txt"
15+
$unshipped = Get-Content $unshippedFilePath
16+
$removed = @()
17+
$removedPrefix = "*REMOVED*";
18+
Write-Host "Processing $dir"
19+
20+
foreach ($item in $unshipped) {
21+
if ($item.Length -gt 0) {
22+
if ($item.StartsWith($removedPrefix)) {
23+
$item = $item.Substring($removedPrefix.Length)
24+
$removed += $item
25+
}
26+
else {
27+
$shipped += $item
28+
}
29+
}
30+
}
31+
32+
$shipped | Sort-Object -Unique |Where-Object { -not $removed.Contains($_) } | Out-File $shippedFilePath -Encoding Ascii
33+
Copy-Item eng/PublicAPI.empty.txt $unshippedFilePath
34+
}
35+
36+
try {
37+
foreach ($file in Get-ChildItem -re -in "PublicApi.Shipped.txt") {
38+
$dir = Split-Path -parent $file
39+
MarkShipped $dir
40+
}
41+
}
42+
catch {
43+
Write-Host $_
44+
Write-Host $_.Exception
45+
exit 1
46+
}

0 commit comments

Comments
 (0)