From f78593f50cf8a9878ee0b8f0470e183d8aaf65bf Mon Sep 17 00:00:00 2001 From: chunyu3 Date: Wed, 22 Feb 2023 10:55:22 +0800 Subject: [PATCH] add parameter to set addtional 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 d6adc59cefe84..632396bdcf05e 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