From 32b5014ed808b4b9715cba5384de14d85ddf83e3 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 28 Feb 2023 19:55:38 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 5540 (#1485) * add parameter to set cadl emitter options * remove emitter name in the additional parameter --------- Co-authored-by: chunyu3 --- eng/common/scripts/Cadl-Project-Generate.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/Cadl-Project-Generate.ps1 b/eng/common/scripts/Cadl-Project-Generate.ps1 index d6adc59ce..3e7ee781b 100644 --- a/eng/common/scripts/Cadl-Project-Generate.ps1 +++ b/eng/common/scripts/Cadl-Project-Generate.ps1 @@ -4,7 +4,9 @@ param ( [Parameter(Position=0)] [ValidateNotNullOrEmpty()] - [string] $ProjectDirectory + [string] $ProjectDirectory, + [Parameter(Position=1)] + [string] $CadlAdditionalOptions ## addtional cadl emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2 ) $ErrorActionPreference = "Stop" @@ -78,6 +80,12 @@ try { } } $cadlCompileCommand = "npx cadl compile $mainCadlFile --emit $emitterName$emitterAdditionalOptions" + if ($CadlAdditionalOptions) { + $options = $CadlAdditionalOptions.Split(";"); + foreach ($option in $options) { + $cadlCompileCommand += " --option $emitterName.$option" + } + } Write-Host($cadlCompileCommand) Invoke-Expression $cadlCompileCommand