From 2fb72bc9af7665411c58258b23e18d9cd462c91e Mon Sep 17 00:00:00 2001 From: chunyu3 Date: Wed, 22 Feb 2023 13:42:39 +0800 Subject: [PATCH] add parameter to set cadl emitter options --- 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 d6adc59cef..632396bdcf 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 ) $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 $option" + } + } Write-Host($cadlCompileCommand) Invoke-Expression $cadlCompileCommand