Skip to content

Commit 87ffef1

Browse files
azure-sdkchunyu3
andauthored
Sync eng/common directory with azure-sdk-tools for PR 5540 (Azure#34617)
* add parameter to set cadl emitter options * remove emitter name in the additional parameter --------- Co-authored-by: chunyu3 <[email protected]>
1 parent 8b788c5 commit 87ffef1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
param (
55
[Parameter(Position=0)]
66
[ValidateNotNullOrEmpty()]
7-
[string] $ProjectDirectory
7+
[string] $ProjectDirectory,
8+
[Parameter(Position=1)]
9+
[string] $CadlAdditionalOptions ## addtional cadl emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
810
)
911

1012
$ErrorActionPreference = "Stop"
@@ -78,6 +80,12 @@ try {
7880
}
7981
}
8082
$cadlCompileCommand = "npx cadl compile $mainCadlFile --emit $emitterName$emitterAdditionalOptions"
83+
if ($CadlAdditionalOptions) {
84+
$options = $CadlAdditionalOptions.Split(";");
85+
foreach ($option in $options) {
86+
$cadlCompileCommand += " --option $emitterName.$option"
87+
}
88+
}
8189
Write-Host($cadlCompileCommand)
8290
Invoke-Expression $cadlCompileCommand
8391

0 commit comments

Comments
 (0)