diff --git a/packages/http-client-csharp/eng/scripts/Generate.ps1 b/packages/http-client-csharp/eng/scripts/Generate.ps1 index de0bd2347f..6185449403 100644 --- a/packages/http-client-csharp/eng/scripts/Generate.ps1 +++ b/packages/http-client-csharp/eng/scripts/Generate.ps1 @@ -9,6 +9,8 @@ Import-Module "$PSScriptRoot\Generation.psm1" -DisableNameChecking -Force; $packageRoot = Resolve-Path (Join-Path $PSScriptRoot '..' '..') $solutionDir = Join-Path $packageRoot 'generator' +# absolute path to locally built emitter module +$emitterPath = Resolve-Path (Join-Path $PSScriptRoot '..' '..' 'dist' 'emitter\') if (-not $LaunchOnly) { Refresh-Build @@ -20,7 +22,7 @@ if (-not $LaunchOnly) { $unbrandedTypespecTestProject = Join-Path $testProjectsLocalDir "Unbranded-TypeSpec" $unbrandedTypespecTestProject = $unbrandedTypespecTestProject - Invoke (Get-TspCommand "$unbrandedTypespecTestProject/Unbranded-TypeSpec.tsp" $unbrandedTypespecTestProject) + Invoke (Get-TspCommand "$unbrandedTypespecTestProject/Unbranded-TypeSpec.tsp" $unbrandedTypespecTestProject $false $emitterPath) # exit if the generation failed if ($LASTEXITCODE -ne 0) { @@ -124,7 +126,7 @@ foreach ($directory in $directories) { continue } Write-Host "Generating $subPath" -ForegroundColor Cyan - Invoke (Get-TspCommand $specFile $generationDir $stubbed) + Invoke (Get-TspCommand $specFile $generationDir $stubbed $emitterPath) # exit if the generation failed if ($LASTEXITCODE -ne 0) { diff --git a/packages/http-client-csharp/eng/scripts/Generation.psm1 b/packages/http-client-csharp/eng/scripts/Generation.psm1 index 6720dba72d..5cefe7ff26 100644 --- a/packages/http-client-csharp/eng/scripts/Generation.psm1 +++ b/packages/http-client-csharp/eng/scripts/Generation.psm1 @@ -1,6 +1,4 @@ $repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..') -# absolute path to locally built emitter module -$emitterPath = Resolve-Path (Join-Path $PSScriptRoot '..' '..' 'dist' 'emitter\') function Invoke($command, $executePath=$repoRoot) { @@ -26,11 +24,12 @@ function Get-TspCommand { param ( [string]$specFile, [string]$generationDir, - [bool]$generateStub = $false + [bool]$generateStub = $false, + [string]$emitterNameOrPath = "@typespec/http-client-csharp" ) $command = "npx tsp compile $specFile" $command += " --trace @typespec/http-client-csharp" - $command += " --emit $emitterPath" + $command += " --emit $emitterNameOrPath" $configFile = Join-Path $generationDir "tspconfig.yaml" if (Test-Path $configFile) { $command += " --config=$configFile"