Skip to content

Commit 2714212

Browse files
Sync eng/common directory with azure-sdk-tools for PR 10241 (Azure#49288)
* Use tsp-client in emitter CI * include arg * Check path * remove lock scirpt --------- Co-authored-by: jolov <[email protected]>
1 parent b7f9b69 commit 2714212

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ parameters:
6767
type: object
6868
default: []
6969

70+
- name: EmitterPackageJsonPath
71+
type: string
72+
default: ""
73+
7074
extends:
7175
template: /eng/pipelines/templates/stages/1es-redirect.yml
7276
parameters:
@@ -189,26 +193,25 @@ extends:
189193
ServiceEndpointUrl: https://api.esrp.microsoft.com
190194
MainPublisher: ESRPRELPACMANTEST
191195

192-
- task: PowerShell@2
193-
displayName: Create emitter-package.json
194-
inputs:
195-
pwsh: true
196-
filePath: ./eng/common/scripts/typespec/New-EmitterPackageJson.ps1
197-
arguments: >
198-
-PackageJsonPath '$(buildArtifactsPath)/lock-files/package.json'
199-
-OverridesPath '$(buildArtifactsPath)/overrides.json'
200-
-OutputDirectory '$(Build.ArtifactStagingDirectory)'
201-
workingDirectory: $(Build.SourcesDirectory)
196+
- pwsh: |
197+
npm install -g @azure-tools/typespec-client-generator-cli@latest
198+
displayName: Install tsp-client
202199
203-
- task: PowerShell@2
204-
displayName: Create emitter-package-lock.json
205-
inputs:
206-
pwsh: true
207-
filePath: ./eng/common/scripts/typespec/New-EmitterPackageLock.ps1
208-
arguments: >
209-
-EmitterPackageJsonPath '$(Build.ArtifactStagingDirectory)/emitter-package.json'
210-
-OutputDirectory '$(Build.ArtifactStagingDirectory)'
211-
workingDirectory: $(Build.SourcesDirectory)
200+
- pwsh: |
201+
if (Test-Path -Path '$(buildArtifactsPath)/overrides.json') {
202+
Write-Host "Using overrides.json to generate emitter-package.json"
203+
tsp-client generate-config-files
204+
--package-json '$(buildArtifactsPath)/lock-files/package.json'
205+
--output-dir '$(Build.ArtifactStagingDirectory)'
206+
--emitter-package-json-path '${{ parameters.EmitterPackageJsonPath }}'
207+
--overrides '$(buildArtifactsPath)/overrides.json'
208+
} else {
209+
tsp-client generate-config-files
210+
--package-json '$(buildArtifactsPath)/lock-files/package.json'
211+
--output-dir '$(Build.ArtifactStagingDirectory)'
212+
--emitter-package-json-path '${{ parameters.EmitterPackageJsonPath }}'
213+
}
214+
displayName: Generate emitter-package.json and emitter-package-lock files
212215
213216
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
214217
parameters:

0 commit comments

Comments
 (0)