From f176b3fa24ffd29a9a676a453cf188e404f8a1d2 Mon Sep 17 00:00:00 2001 From: Grant Birchmeier Date: Mon, 30 Dec 2024 14:03:18 -0600 Subject: [PATCH] add Explicit-Clean.ps1 because `dotnet clean` is trash --- scripts/Explicit-Clean.ps1 | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 scripts/Explicit-Clean.ps1 diff --git a/scripts/Explicit-Clean.ps1 b/scripts/Explicit-Clean.ps1 new file mode 100644 index 000000000..36a10028e --- /dev/null +++ b/scripts/Explicit-Clean.ps1 @@ -0,0 +1,68 @@ +if ($args.Length -gt 0) { + Write-Error "This script does not take any parameters." + Exit 1 +} + +# `dotnet clean` is pretty disappointing. It doesn't delete all the bin and obj dirs! +# So I wrote this to do the job, and delete store dirs also. + + +$rootpath = Join-Path $PSScriptRoot '..' | Resolve-Path + +@( + "AcceptanceTest", + "DDTool\DDTool", + "DDTool\UnitTests", + "Examples\Executor", + "Examples\FixToJson", + "Examples\JsonToFix", + "Examples\SimpleAcceptor", + "Examples\Standalone\SerilogLog", + "Examples\Standalone\SerilogLog\UnitTests", + "Examples\TradeClient", + "Messages\FIX40", + "Messages\FIX41", + "Messages\FIX42", + "Messages\FIX43", + "Messages\FIX44", + "Messages\FIX50", + "Messages\FIX50SP1", + "Messages\FIX50SP2", + "Messages\FIXT11", + # Don't include "QuickFIXn" because there is a "Store" source dir! + "UnitTests" +) | ForEach-Object { + + $projPath = Join-Path $rootpath $_ + + $binPath = Join-Path $projPath 'bin' + $objPath = Join-Path $projPath 'obj' + $storePath = Join-Path $projPath 'store' + + if (Test-Path -Path $binPath) { + Remove-Item -Recurse -Force $binPath + } + if (Test-Path -Path $objPath) { + Remove-Item -Recurse -Force $objPath + } + if (Test-Path -Path $storePath) { + Remove-Item -Recurse -Force $storePath + } + + Write-Host "* Cleaned $projPath" +} + +@( + "QuickFIXn/bin", + "QuickFIXn/obj" +) | ForEach-Object { + $delPath = Join-Path $rootpath $_ + if (Test-Path -Path $delPath) { + Remove-Item -Recurse -Force $delPath + } + Write-Host "* Deleted $delPath" +} + + +Write-Host "Finished." +