From b8e6aa1fbda075fece9be0dbca4ef3b0a1025fb2 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 22 May 2023 14:18:52 -0700 Subject: [PATCH] move the cleanup config to -SaveInputs parameter on the cli (#4646) Co-authored-by: m-nash --- eng/common/scripts/TypeSpec-Project-Generate.ps1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eng/common/scripts/TypeSpec-Project-Generate.ps1 b/eng/common/scripts/TypeSpec-Project-Generate.ps1 index feba00d37..d8845d60d 100644 --- a/eng/common/scripts/TypeSpec-Project-Generate.ps1 +++ b/eng/common/scripts/TypeSpec-Project-Generate.ps1 @@ -5,8 +5,8 @@ param ( [Parameter(Position=0)] [ValidateNotNullOrEmpty()] [string] $ProjectDirectory, - [Parameter(Position=1)] - [string] $typespecAdditionalOptions ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2 + [string] $TypespecAdditionalOptions = $null, ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2 + [switch] $SaveInputs = $false ## saves the temporary files during execution, default false ) $ErrorActionPreference = "Stop" @@ -80,12 +80,17 @@ try { } } $typespecCompileCommand = "npx tsp compile $mainTypeSpecFile --emit $emitterName$emitterAdditionalOptions" - if ($typespecAdditionalOptions) { - $options = $typespecAdditionalOptions.Split(";"); + if ($TypespecAdditionalOptions) { + $options = $TypespecAdditionalOptions.Split(";"); foreach ($option in $options) { $typespecCompileCommand += " --option $emitterName.$option" } } + + if ($SaveInputs) { + $typespecCompileCommand += " --option $emitterName.save-inputs=true" + } + Write-Host($typespecCompileCommand) Invoke-Expression $typespecCompileCommand @@ -95,7 +100,7 @@ finally { Pop-Location } -$shouldCleanUp = $configuration["cleanup"] ?? $true +$shouldCleanUp = !$SaveInputs if ($shouldCleanUp) { Remove-Item $tempFolder -Recurse -Force }