Skip to content

Commit

Permalink
fix Test-Package.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingzhe Huang (from Dev Box) committed Oct 12, 2024
1 parent 0b02283 commit a88dd9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions packages/http-client-csharp/eng/scripts/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 3 additions & 4 deletions packages/http-client-csharp/eng/scripts/Generation.psm1
Original file line number Diff line number Diff line change
@@ -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)
{
Expand All @@ -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"
Expand Down

0 comments on commit a88dd9a

Please sign in to comment.