Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 6197 (Azure#25944)
Browse files Browse the repository at this point in the history
Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#6197 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

Co-authored-by: m-nash <[email protected]>
  • Loading branch information
2 people authored and minhanh-phan committed Jun 12, 2023
1 parent 234faeb commit 82e628e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions eng/common/scripts/TypeSpec-Project-Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand All @@ -95,7 +100,7 @@ finally {
Pop-Location
}

$shouldCleanUp = $configuration["cleanup"] ?? $true
$shouldCleanUp = !$SaveInputs
if ($shouldCleanUp) {
Remove-Item $tempFolder -Recurse -Force
}

0 comments on commit 82e628e

Please sign in to comment.