Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
85bf1b4
Add post-publish-sdk pipeline to regenerate TypeSpec SDKs
XiaofeiCao Jul 8, 2026
dd2e7c0
Simplify TypeSpecJavaPRId parameter displayName
XiaofeiCao Jul 8, 2026
813a81f
Update TypeSpecJavaPRId parameter displayName
XiaofeiCao Jul 8, 2026
90259c8
Use DevPackage boolean toggle with sentinel PRId default
XiaofeiCao Jul 8, 2026
08711ba
Build emitter from main when DevPackage=true and no PRId given
XiaofeiCao Jul 8, 2026
9438cc5
Shorten parameter displayNames
XiaofeiCao Jul 8, 2026
7896b12
Init typespec-azure submodules for dev build
XiaofeiCao Jul 8, 2026
ad234fb
Resolve catalog:/workspace: deps for dev emitter package
XiaofeiCao Jul 9, 2026
e10c21e
Make version-pinned regen the default route (post-publish)
XiaofeiCao Jul 9, 2026
377b2d8
Drop DevPackage; infer route from TypeSpecJavaVersion
XiaofeiCao Jul 9, 2026
7ea6d69
Default TypeSpecJavaVersion to 'none' sentinel
XiaofeiCao Jul 9, 2026
fc918d8
Refine parameter displayNames (Emitter Version)
XiaofeiCao Jul 9, 2026
2247118
Rename to post-publish-emitter.yaml and sync_emitter.py
XiaofeiCao Jul 9, 2026
fc517a5
Rename pipeline parameter TypeSpecJavaVersion to EmitterVersion
XiaofeiCao Jul 9, 2026
5de30fc
Use tsp-client generate-config-files for the published route
XiaofeiCao Jul 9, 2026
fc1b881
Pin dev-route emitter deps to exact versions
XiaofeiCao Jul 9, 2026
e0e3229
Revert "Pin dev-route emitter deps to exact versions"
XiaofeiCao Jul 9, 2026
d844208
Only update emitter version in emitter-package.json, not peer deps
XiaofeiCao Jul 10, 2026
7934a61
[Automation] Generate SDK based on TypeSpec 0.45.4
azure-sdk Jul 10, 2026
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
24 changes: 12 additions & 12 deletions eng/emitter-package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eng/emitter-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main": "dist/src/index.js",
"dependencies": {
"@azure-tools/typespec-java": "0.45.5"
"@azure-tools/typespec-java": "0.45.4"
},
"devDependencies": {
"@azure-tools/openai-typespec": "1.20.0",
Expand Down
157 changes: 157 additions & 0 deletions eng/pipelines/post-publish-emitter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Regenerates all TypeSpec-based SDKs in azure-sdk-for-java using the typespec-java emitter,
# then opens an automated draft PR with the results.
#
# The typespec-java emitter lives in Azure/typespec-azure (packages/typespec-java).
# Published route (EmitterVersion set): pins eng/emitter-package.json to that published
# @azure-tools/typespec-java version, then regenerates. This is the post-publish path and does
# not touch typespec-azure sources.
# Dev route (EmitterVersion is 'none'): builds the emitter dev package from source instead
# - from the typespec-azure PR given by PRId, or from the default branch (main) when PRId is 'none'.
trigger: none
pr: none

parameters:
# Set EmitterVersion for the default (post-publish) route. Leave it as 'none' to build the
# emitter from source, in which case PRId selects the typespec-azure PR (or main).
- name: EmitterVersion
displayName: 'Emitter Version — published @azure-tools/typespec-java to regenerate with (e.g. 0.45.4; none = build from source)'
type: string
default: 'none'
- name: PRId
displayName: 'typespec-azure PR ID — used only when Emitter Version is none (e.g. 43321; none = main)'
type: string
default: 'none'

jobs:
- job: Generate_SDK

timeoutInMinutes: 120

variables:
- template: /eng/pipelines/templates/variables/globals.yml
- template: /eng/pipelines/templates/variables/image.yml
- name: NodeVersion
value: '24.x'
# Local clone target for the (public) Azure/typespec-azure emitter repo (dev route only).
- name: TypeSpecAzureDirectory
value: $(Agent.BuildDirectory)/typespec-azure
# For the published route this is the given version. For the dev route it is overwritten at
# runtime from the built emitter's package.json (see 'Get Package Version').
- name: PackageVersion
${{ if ne(parameters.EmitterVersion, 'none') }}:
value: ${{ parameters.EmitterVersion }}
${{ else }}:
value: ''
- name: PullRequestTitleSuffix
${{ if eq(parameters.EmitterVersion, 'none') }}:
${{ if ne(parameters.PRId, 'none') }}:
value: " DEV (typespec-azure PR ${{ parameters.PRId }})"
${{ else }}:
value: " DEV (typespec-azure main)"
${{ else }}:
value: ""

pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
# azure-sdk-for-java (self) is the only repo resource, so it is checked out to
# $(Build.SourcesDirectory). Azure/typespec-azure is public, so it is cloned directly
# (below) instead of via a repository resource + GitHub service connection.
- checkout: self

- task: NodeTool@0
displayName: 'Install Node.js $(NodeVersion)'
inputs:
versionSpec: '$(NodeVersion)'

- template: /eng/pipelines/templates/steps/maven-authenticate.yml
parameters:
SourceDirectory: $(Build.SourcesDirectory)

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/

# Clone the public Azure/typespec-azure repo (dev route only; no service connection required).
# With a PRId specified, fetch and check out that PR ref (a bare number is expanded to
# refs/pull/<id>/merge; a full ref is used as-is). When PRId is 'none', the emitter is built
# from the default branch (main). Submodules are then initialized because typespec-azure
# vendors the TypeSpec compiler and the http-client-java generator via the 'core' submodule,
# which build:generator (Build-Generator.ps1) and tspd both require.
- task: PowerShell@2
displayName: 'Clone typespec-azure'
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
inputs:
pwsh: true
targetType: 'inline'
script: |
git clone https://github.com/Azure/typespec-azure.git "$(TypeSpecAzureDirectory)"
$prId = '${{ parameters.PRId }}'
if ($prId -and $prId -ne 'none') {
if ($prId -match '^\d+$') {
$ref = "refs/pull/$prId/merge"
} else {
$ref = $prId
}
Write-Host "Fetching typespec-azure ref $ref"
git -C "$(TypeSpecAzureDirectory)" fetch origin $ref
git -C "$(TypeSpecAzureDirectory)" checkout FETCH_HEAD
}
git -C "$(TypeSpecAzureDirectory)" submodule update --init --recursive

# Build the emitter dev package (.tgz) from the typespec-azure PR.
# typespec-java depends on other workspace packages (workspace:^). First build only those
# upstream dependencies with turbo (the `^...` filter selects dependencies but excludes
# typespec-java itself). Then Build-TypeSpec.ps1 builds and packs typespec-java (its
# build:generator step runs Build-Generator.ps1, which needs JDK 11+ and Maven), producing
# the .tgz next to the package.json for sync_emitter.py to pick up.
- task: PowerShell@2
retryCountOnTaskFailure: 1
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
displayName: 'Build typespec-java dev package'
inputs:
pwsh: true
targetType: 'inline'
script: |
corepack enable
pnpm install
pnpm turbo run build --filter "@azure-tools/typespec-java^..."
./packages/typespec-java/Build-TypeSpec.ps1
workingDirectory: $(TypeSpecAzureDirectory)

- script: |
npm install -g @azure-tools/typespec-client-generator-cli
displayName: 'Install tsp-client'

# Dev route only: the built emitter's version drives the PR title. For the published route
# PackageVersion is already the given EmitterVersion.
- task: PowerShell@2
displayName: 'Get Package Version'
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
inputs:
pwsh: true
targetType: 'inline'
script: |
$PACKAGE_VERSION = node -p -e "require('./packages/typespec-java/package.json').version"
Write-Host("##vso[task.setvariable variable=PackageVersion]$PACKAGE_VERSION")
workingDirectory: $(TypeSpecAzureDirectory)

- script: |
python3 ./eng/pipelines/scripts/sync_emitter.py --sdk-root=$(Build.SourcesDirectory) --emitter-version='${{ parameters.EmitterVersion }}' --package-json-path=$(TypeSpecAzureDirectory)/packages/typespec-java/package.json
displayName: 'Generate SDK'
workingDirectory: $(Build.SourcesDirectory)

- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
WorkingDirectory: $(Build.SourcesDirectory)
ScriptDirectory: $(Build.SourcesDirectory)/eng/common/scripts
RepoName: azure-sdk-for-java
BaseBranchName: 'refs/heads/main'
PRBranchName: typespec-java-generation-$(Build.BuildId)
CommitMsg: '[Automation] Generate SDK based on TypeSpec $(PackageVersion)$(PullRequestTitleSuffix)'
PRTitle: '[Automation] Generate SDK based on TypeSpec $(PackageVersion)$(PullRequestTitleSuffix)'
PRLabels: 'DPG'
OpenAsDraft: 'true'
Loading
Loading