@@ -67,9 +67,14 @@ parameters:
67
67
type : object
68
68
default : []
69
69
70
- - name : EmitterPackageJsonPath
70
+ # The path to the emitter package json file.
71
+ - name : EmitterPackageJsonOutputPath
72
+ type : string
73
+ default : " eng/emitter-package.json"
74
+
75
+ # The relative path to the emitter package.
76
+ - name : EmitterPackagePath
71
77
type : string
72
- default : " "
73
78
74
79
extends :
75
80
template : /eng/pipelines/templates/stages/1es-redirect.yml
@@ -98,7 +103,17 @@ extends:
98
103
inputs :
99
104
pwsh : true
100
105
filePath : $(Build.SourcesDirectory)/eng/scripts/typespec/Initialize-WorkingDirectory.ps1
101
- arguments : -UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
106
+ ${{ if parameters.BuildPrereleaseVersion }} :
107
+ arguments : >
108
+ -PrereleaseSuffix "-alpha.$(Build.BuildNumber)"
109
+ -OutputDirectory "$(Build.ArtifactStagingDirectory)"
110
+ -UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
111
+ -EmitterPackagePath:${{ parameters.EmitterPackagePath }}
112
+ ${{ else }} :
113
+ arguments : >
114
+ -OutputDirectory "$(Build.ArtifactStagingDirectory)"
115
+ -UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
116
+ -EmitterPackagePath:${{ parameters.EmitterPackagePath }}
102
117
103
118
- task : PowerShell@2
104
119
displayName : ' Run build script'
@@ -107,10 +122,9 @@ extends:
107
122
pwsh : true
108
123
filePath : $(Build.SourcesDirectory)/eng/scripts/typespec/Build-Emitter.ps1
109
124
arguments : >
110
- -BuildNumber "$(Build.BuildNumber)"
111
- -OutputDirectory "$(Build.ArtifactStagingDirectory)"
125
+ -OutputDirectory "$(Build.ArtifactStagingDirectory)/packages"
112
126
-TargetNpmJsFeed:$${{ parameters.PublishPublic }}
113
- -Prerelease:$$ {{ parameters.BuildPrereleaseVersion }}
127
+ -EmitterPackagePath:$ {{ parameters.EmitterPackagePath }}
114
128
115
129
- pwsh : |
116
130
$sourceBranch = '$(Build.SourceBranch)'
@@ -138,7 +152,7 @@ extends:
138
152
# Publish stage
139
153
# Responsible for publishing the packages in `build_artifacts/packages` and producing `emitter-package-lock.json`
140
154
# Produces the artifact `publish_artifacts` which contains the following:
141
- # emitter-package.json: Created using the package json from the build step.
155
+ # emitter-package.json: Created using the package json from the build step.
142
156
# emitter-package-lock.json: Created by calling `npm install` using `emitter-package.json`
143
157
- ${{ if parameters.ShouldPublish }} :
144
158
- stage : Publish
@@ -198,20 +212,25 @@ extends:
198
212
displayName: Install tsp-client
199
213
200
214
- pwsh : |
201
- if (Test-Path -Path '$(buildArtifactsPath)/overrides.json') {
215
+ Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
216
+
217
+ if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
202
218
Write-Host "Using overrides.json to generate emitter-package.json"
203
219
tsp-client generate-config-files `
204
220
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
205
- --output-dir '$(Build.ArtifactStagingDirectory )' `
206
- --emitter-package-json-path '${{ parameters.EmitterPackageJsonPath }}' `
207
- --overrides '$(buildArtifactsPath)/overrides.json'
221
+ --output-dir '$(Build.SourcesDirectory )' `
222
+ --emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
223
+ --overrides '$(buildArtifactsPath)/packages/ overrides.json'
208
224
} else {
225
+ Write-Host "No overrides.json found. Running tsp-client without overrides."
226
+
209
227
tsp-client generate-config-files `
210
228
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
211
- --output-dir '$(Build.ArtifactStagingDirectory )' `
212
- --emitter-package-json-path '${{ parameters.EmitterPackageJsonPath }}'
229
+ --output-dir '$(Build.SourcesDirectory )' `
230
+ --emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
213
231
}
214
232
displayName: Generate emitter-package.json and emitter-package-lock files
233
+ workingDirectory: $(Build.SourcesDirectory)
215
234
216
235
- template : /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
217
236
parameters :
@@ -243,11 +262,8 @@ extends:
243
262
displayName : Download pipeline artifacts
244
263
245
264
- pwsh : |
246
- Write-Host "Copying emitter-package.json to $(Build.SourcesDirectory)/eng"
247
- Copy-Item $(publishArtifactsPath)/emitter-package.json $(Build.SourcesDirectory)/eng/ -Force
248
-
249
- Write-Host "Copying emitter-package-lock.json to $(Build.SourcesDirectory)/eng"
250
- Copy-Item $(publishArtifactsPath)/emitter-package-lock.json $(Build.SourcesDirectory)/eng/ -Force
265
+ Write-Host "Copying *emitter-package*.json to $(Build.SourcesDirectory)/eng"
266
+ Copy-Item $(publishArtifactsPath)/*emitter-package*.json $(Build.SourcesDirectory)/eng/ -Force
251
267
displayName: Copy emitter-package json files
252
268
253
269
- ${{ parameters.InitializationSteps }}
@@ -294,7 +310,7 @@ extends:
294
310
Paths :
295
311
- " /*"
296
312
- " !SessionRecords"
297
-
313
+
298
314
- download : current
299
315
displayName : Download pipeline artifacts
300
316
@@ -435,7 +451,9 @@ extends:
435
451
inputs :
436
452
pwsh : true
437
453
filePath : $(Build.SourcesDirectory)/eng/scripts/typespec/Initialize-WorkingDirectory.ps1
438
- arguments : -BuildArtifactsPath '$(buildArtifactsPath)'
454
+ arguments : >
455
+ -BuildArtifactsPath '$(buildArtifactsPath)/lock-files'
456
+ -EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
439
457
440
458
- task : PowerShell@2
441
459
displayName : ' Run test script'
@@ -445,6 +463,7 @@ extends:
445
463
arguments : >
446
464
$(TestArguments)
447
465
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
466
+ -EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
448
467
449
468
- template : /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
450
469
parameters :
0 commit comments