From eebe30ee90514ae2e325d8f6354d324ce175168f Mon Sep 17 00:00:00 2001 From: Steve Otteson Date: Thu, 11 Mar 2021 09:07:32 -0800 Subject: [PATCH] Add script for cleaning up outputs --- scripts/CleanOutputs.ps1 | 6 ++++++ scripts/CommonUtils.ps1 | 9 +++++++++ scripts/GenerateMetadataSource.ps1 | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scripts/CleanOutputs.ps1 diff --git a/scripts/CleanOutputs.ps1 b/scripts/CleanOutputs.ps1 new file mode 100644 index 000000000..e0dab0df8 --- /dev/null +++ b/scripts/CleanOutputs.ps1 @@ -0,0 +1,6 @@ + +. "$PSScriptRoot\CommonUtils.ps1" + +Remove-Directory "$emitterDir\obj" +Remove-Directory "$scraperDir\obj" +Remove-Directory $defaultArtifactsDir diff --git a/scripts/CommonUtils.ps1 b/scripts/CommonUtils.ps1 index 1961a4926..c02b1a182 100644 --- a/scripts/CommonUtils.ps1 +++ b/scripts/CommonUtils.ps1 @@ -6,6 +6,14 @@ function Create-Directory([string[]] $Path) } } +function Remove-Directory([string[]] $Path) +{ + if ((Test-Path -Path $Path)) + { + Remove-Item $Path -Recurse + } +} + function Replace-Text { Param ([string] $path, [hashtable] $items) @@ -100,6 +108,7 @@ $emitterDir = "$generationDir\emitter" $partitionsDir = "$scraperDir\Partitions" $sdkApiPath = "$rootDir\ext\sdk-api" $sdkGeneratedSourceDir = "$emitterDir\generated" +$defaultArtifactsDir = "$rootDir\artifacts" if (Test-Path -Path $binDir -PathType leaf) { diff --git a/scripts/GenerateMetadataSource.ps1 b/scripts/GenerateMetadataSource.ps1 index 7917a53bd..23bf28a12 100644 --- a/scripts/GenerateMetadataSource.ps1 +++ b/scripts/GenerateMetadataSource.ps1 @@ -56,10 +56,11 @@ function Replace-Text if (!$artifactsDir) { - $artifactsDir = "$rootDir\artifacts" - Create-Directory $artifactsDir + $artifactsDir = $defaultArtifactsDir } +Create-Directory $artifactsDir + Write-Output "`e[36m*** Generating source files`e[0m" Write-Output "Making sure cpp NuGet packages are installed..."