Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 5540 (#20309)
Browse files Browse the repository at this point in the history
* add parameter to set cadl emitter options

* remove emitter name in the additional parameter

---------

Co-authored-by: chunyu3 <chunyu@microsoft.com>
  • Loading branch information
azure-sdk and chunyu3 authored Mar 1, 2023
1 parent 834001a commit a698b9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion eng/common/scripts/Cadl-Project-Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a698b9b

Please sign in to comment.