forked from microsoft/ApplicationInsights-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FinalizePublicApi.ps1
31 lines (23 loc) · 1.06 KB
/
FinalizePublicApi.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# After every stable release, all PublicApi text files (Shipped & Unshipped) should be merged.
$path = "\PublicAPI";
$directory = $PSScriptRoot;
$searchPath = Join-Path -Path $directory -ChildPath $path;
Write-Host "Search Directory: $searchPath";
Write-Host "";
Get-ChildItem -Path $searchPath -Recurse -Filter *.Shipped.txt |
ForEach-Object {
Write-Host $_.FullName;
[string]$shipped = $_.FullName;
[string]$unshipped = $shipped -replace ".shipped.txt", ".Unshipped.txt";
if (Test-Path $unshipped) {
Write-Host $unshipped;
Get-Content $shipped, $unshipped | # get contents of both text files
Where-Object {$_ -ne ""} | # filter empty lines
Sort-Object | # sort lines
Get-Unique | # filter duplicates
Set-Content $shipped; # write to shipped.txt
Clear-Content $unshipped; # empty unshipped.txt
Write-Host "...MERGED and SORTED";
}
Write-Host "";
}