Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions eng/common/pipelines/templates/archetype-typespec-emitter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,27 +259,38 @@ extends:
displayName: Download pipeline artifacts

- pwsh: |
npm install -g @azure-tools/typespec-client-generator-cli@latest
npm ci
displayName: Install tsp-client
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client

- pwsh: |
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
$emitterPath = '${{ parameters.EmitterPackageJsonOutputPath }}'
if (-not [System.IO.Path]::IsPathRooted($emitterPath)) {
$emitterPath = Join-Path '$(Build.SourcesDirectory)' $emitterPath
}
Write-Host "##vso[task.setvariable variable=ResolvedEmitterPath]$emitterPath"
displayName: Resolve emitter package path
workingDirectory: $(Build.SourcesDirectory)

- pwsh: |
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
Write-Host "Resolved emitter package path: $(ResolvedEmitterPath)"

if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
Write-Host "Using overrides.json to generate emitter-package.json"
tsp-client generate-config-files `
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
--overrides '$(buildArtifactsPath)/packages/overrides.json'
npm exec --no -- tsp-client generate-config-files `
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
--emitter-package-json-path '$(ResolvedEmitterPath)' `
--overrides '$(buildArtifactsPath)/packages/overrides.json'
} else {
Write-Host "No overrides.json found. Running tsp-client without overrides."

tsp-client generate-config-files `
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
npm exec --no -- tsp-client generate-config-files `
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
--emitter-package-json-path '$(ResolvedEmitterPath)'
}
displayName: Generate emitter-package.json and emitter-package-lock files
workingDirectory: $(Build.SourcesDirectory)
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client

- ${{ parameters.InitializationSteps }}

Expand Down