Skip to content

Commit fb11613

Browse files
azure-sdkm-nash
andauthored
move the cleanup config to -SaveInputs parameter on the cli (Azure#36422)
Co-authored-by: m-nash <prognash@gmail.com>
1 parent c931966 commit fb11613

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

eng/common/scripts/TypeSpec-Project-Generate.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ param (
55
[Parameter(Position=0)]
66
[ValidateNotNullOrEmpty()]
77
[string] $ProjectDirectory,
8-
[Parameter(Position=1)]
9-
[string] $typespecAdditionalOptions ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
8+
[string] $TypespecAdditionalOptions = $null, ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
9+
[switch] $SaveInputs = $false ## saves the temporary files during execution, default false
1010
)
1111

1212
$ErrorActionPreference = "Stop"
@@ -80,12 +80,17 @@ try {
8080
}
8181
}
8282
$typespecCompileCommand = "npx tsp compile $mainTypeSpecFile --emit $emitterName$emitterAdditionalOptions"
83-
if ($typespecAdditionalOptions) {
84-
$options = $typespecAdditionalOptions.Split(";");
83+
if ($TypespecAdditionalOptions) {
84+
$options = $TypespecAdditionalOptions.Split(";");
8585
foreach ($option in $options) {
8686
$typespecCompileCommand += " --option $emitterName.$option"
8787
}
8888
}
89+
90+
if ($SaveInputs) {
91+
$typespecCompileCommand += " --option $emitterName.save-inputs=true"
92+
}
93+
8994
Write-Host($typespecCompileCommand)
9095
Invoke-Expression $typespecCompileCommand
9196

@@ -95,7 +100,7 @@ finally {
95100
Pop-Location
96101
}
97102

98-
$shouldCleanUp = $configuration["cleanup"] ?? $true
103+
$shouldCleanUp = !$SaveInputs
99104
if ($shouldCleanUp) {
100105
Remove-Item $tempFolder -Recurse -Force
101106
}

0 commit comments

Comments
 (0)