Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c9345d0
emitter
XiaofeiCao Jun 25, 2026
ec9a34d
reorganize structure and add tests
XiaofeiCao Jun 26, 2026
f47516c
adapt pipelines
XiaofeiCao Jun 26, 2026
8fc4d6e
drop 1es for sync-sdk
XiaofeiCao Jun 26, 2026
8f478e0
readme and changelog
XiaofeiCao Jun 26, 2026
6b076ee
Merge branch 'main' into autorest_to_typespec_java
XiaofeiCao Jun 26, 2026
413836d
Fix spell check for typespec-java
XiaofeiCao Jun 26, 2026
511bad4
fix pnpm-locl
XiaofeiCao Jun 26, 2026
6af0b27
format
XiaofeiCao Jun 26, 2026
a351c95
fix oom
XiaofeiCao Jun 26, 2026
70d77f1
fix azure-core dependencies
XiaofeiCao Jun 26, 2026
e0e8e05
add nightly
XiaofeiCao Jun 26, 2026
d8a9028
use dev for nightly build
XiaofeiCao Jun 26, 2026
599a5c3
fix security check for java nightly
XiaofeiCao Jun 26, 2026
438501e
ignore whitespace when applying git diff
XiaofeiCao Jun 26, 2026
35ca6e3
add liftr-base
XiaofeiCao Jun 27, 2026
576ad42
fix dependencies
XiaofeiCao Jun 29, 2026
4d876f7
flatten emitter code to the root
XiaofeiCao Jun 29, 2026
554bbf5
Merge branch 'main' into autorest_to_typespec_java
XiaofeiCao Jun 29, 2026
dd397d0
format
XiaofeiCao Jun 30, 2026
3e3c0f5
Merge upstream/main; keep this branch's typespec-java migration (over…
XiaofeiCao Jun 30, 2026
7698a5c
Move Copy-Sources.ps1 to typespec-java root
XiaofeiCao Jun 30, 2026
440de3d
Drop redundant build:full script from typespec-java
XiaofeiCao Jun 30, 2026
8630726
Restore architect changelog; retarget ours to flatten/cleanup
XiaofeiCao Jun 30, 2026
839ded7
Bump typespec-java Node engine to >=22
XiaofeiCao Jun 30, 2026
0261db3
address comments
XiaofeiCao Jul 1, 2026
2f35cca
fix CI
XiaofeiCao Jul 1, 2026
617f3c7
fix label
XiaofeiCao Jul 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .chronus/changes/add-typespec-java-2026-6-25-0-0-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: internal
packages:
- "@azure-tools/typespec-java"
---

[Java] Flatten the `typespec-java` emitter folder structure and clean up autorest.java-specific tooling.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't matter because its internal but you shouldn't add the package in the scope here or it will get included in the changelog for that package

@XiaofeiCao XiaofeiCao Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you elaborate? I've tried to remove the package, CI will complain: https://github.com/Azure/typespec-azure/actions/runs/28504252500/job/84488633473?pr=4721

or other than adding new one here, I should update existing one Srikanta added instead?


1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/docs/howtos/DataPlane*/ @lmazuel @m-nash @iscai-msft @srnagar @joheredi

/packages/typespec-python @iscai-msft @msyyc @tadelesh @l0lawrence @ChenxiJiang333 @kashifkhan
/packages/typespec-java @weidongxu-microsoft @haolingdong-msft @XiaofeiCao
11 changes: 11 additions & 0 deletions .github/actions/setup-java/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Setup Java
description: Setup JDK and Maven for typespec-java package development and CI

runs:
using: composite

steps:
- name: Setup mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
install_args: "java maven"
62 changes: 51 additions & 11 deletions .github/workflows/ci-java.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "typespec-java / CI"
name: "java / test e2e"

on:
pull_request:
Expand All @@ -8,35 +8,75 @@ on:
paths:
- "packages/typespec-java/**"
- ".github/workflows/ci-java.yml"
- ".github/actions/setup-java/**"
merge_group:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
name: "Build & Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: recursive

- uses: ./.github/actions/setup

- uses: ./.github/actions/setup-java

- name: Install dependencies
run: pnpm install
- name: Build typespec-java package

# Build the emitter (build:generator builds emitter.jar from the core
# generator after applying core.patch; build:emitter copies sources + tsc)
# together with the peer packages it compiles against.
- name: Build
run: pnpm turbo run --filter "@azure-tools/typespec-java..." build
lint:
name: Lint
runs-on: ubuntu-latest

- name: Test (emitter unit tests)
run: pnpm run test
working-directory: packages/typespec-java

e2e:
name: "Regen & Spector Tests"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: recursive

- uses: ./.github/actions/setup

- uses: ./.github/actions/setup-java

- name: Install dependencies
run: pnpm install
- name: Run linters
working-directory: packages/typespec-java
run: pnpm lint

# The emitter compiles against these peer packages; Generate.ps1 -> Setup.ps1
# -> Build-TypeSpec.ps1 runs `pnpm build` for the emitter, which needs them
# already built.
- name: Build dependencies
run: pnpm turbo run --filter "@azure-tools/typespec-java^..." build

# emitter-tests is a standalone npm+Maven project (not in the pnpm
# workspace). Generate.ps1 calls Setup.ps1 (builds the emitter + Azure jar,
# npm install) and regenerates the SDK from the spector specs into the
# gitignored src/main/java. Spector-Tests.ps1 then runs the JUnit tests
# against the Spector mock server.
- name: Regenerate
shell: pwsh
run: ./Generate.ps1
working-directory: packages/typespec-java/emitter-tests

- name: Spector tests
shell: pwsh
run: ./Spector-Tests.ps1
working-directory: packages/typespec-java/emitter-tests
8 changes: 8 additions & 0 deletions .github/workflows/nightly-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ jobs:
working-directory: packages/typespec-ts
run-prepare: false
run-regenerate: false
- name: Java
lang: java
package-filter: "@azure-tools/typespec-java"
working-directory: packages/typespec-java/emitter-tests
mise-install-args: "java maven"
run-prepare: false
run-regenerate: true

env:
TYPESPEC_VS_CI_BUILD: true
Expand Down Expand Up @@ -155,6 +162,7 @@ jobs:
"@azure-tools/typespec-azure-resource-manager",
"@azure-tools/typespec-autorest",
"@azure-tools/typespec-python",
"@azure-tools/typespec-java",
"@azure-tools/typespec-ts"
];
console.log("--- Dev versions (next tag on npm) ---");
Expand Down
25 changes: 20 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,23 @@ packages/typespec-python/tests/generated/**
packages/typespec-python/alpha

# java emitter
packages/typespec-java/src/typespec-extension/generator/**
packages/typespec-java/src/typespec-extension/test
packages/typespec-java/src/typespec-extension/src/*
packages/typespec-java/src/typespec-extension/generator/**
!packages/typespec-java/src/typespec-extension/options.ts
# Emitter TS sources copied from core/packages/http-client-java/emitter at build
# time (only src/options.ts is committed).
packages/typespec-java/src/**
!packages/typespec-java/src/options.ts
packages/typespec-java/test/**
# Java emitter.jar + assets staged from the core generator build.
packages/typespec-java/generator/**
# Packed tarball produced by Build-TypeSpec.ps1 (consumed by emitter-tests).
packages/typespec-java/*.tgz

# java emitter-tests (standalone Maven+npm spector suite)
# Generated SDK + generated tests are regenerated, never committed; only
# hand-written tests, specs, customization and the harness are tracked.
packages/typespec-java/emitter-tests/src/main/**
packages/typespec-java/emitter-tests/**/generated/**
packages/typespec-java/emitter-tests/tsp-output/**
packages/typespec-java/emitter-tests/specs/**
packages/typespec-java/emitter-tests/node_modules/**
packages/typespec-java/emitter-tests/package-lock.json
packages/typespec-java/emitter-tests/tsp-spector-coverage-*.json
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,13 @@ packages/typespec-ts/test/integration/generated/
packages/typespec-ts/test/azure-integration/generated/
packages/typespec-ts/test/modular-integration/generated/
packages/typespec-ts/test/azure-modular-integration/generated/

# typespec-java emitter-tests is a standalone npm project (excluded from the pnpm
# workspace) with its own .prettierrc.yaml that loads the typespec prettier plugin
# from its own node_modules. Those aren't installed in the root format job, so root
# prettier must not descend into it; the project formats itself via its own scripts.
packages/typespec-java/emitter-tests/
# Emitter TypeScript sources (except options.ts) are copied from core at build time.
packages/typespec-java/src/**
!packages/typespec-java/src/options.ts
packages/typespec-java/test/
101 changes: 9 additions & 92 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,175 +26,92 @@ ignorePaths:
- "*.lock.yml"
# temp ignore typespec-ts while repo move is inflight
- packages/typespec-ts/**
# typespec-java specs and hand-written tests are synced verbatim from
# core / autorest.java; don't spell-check upstream-sourced content.
- packages/typespec-java/emitter-tests/tsp/**
- packages/typespec-java/emitter-tests/src/**
# Developer/user docs ported verbatim from autorest.java's typespec-extension.
- packages/typespec-java/docs/**
useGitignore: true
enableFiletypes:
- tsp
- typespec
words:
- AADDS
- adtest
- alexa
- allof
- apim
- appinsightsappid
- apos
- armcontoso
- armId
- Arqs
- azcore
- azkeys
- azsdk
- azsecrets
- Bazs
- Bcff
- BNOT
- byos
- byval
- centralus
- centraluseuap
- chartjs
- Chenjie
- clazz
- clsx
- Cmek
- commitish
- contosobenchmark
- contosowidgetmanager
- DALMATION
- dcont
- deduplicator
- devcenter
- Dhttp
- discriminatorenum
- Dlocal
- Dmaven
- Chenjie
- DMSS
- Donezo
- DskipTests
- Dspotless
- Dtrim
- dynatrace
- Easm
- endpointlro
- ESRPRELPACMANTEST
- espt
- euap
- exampleapptenantid
- exampleid
- farchived
- fhir
- foos
- français
- Globa
- groupme
- GZRS
- healthdataaiservices
- horiz
- Howtos
- incentivizes
- infile
- ipconfigurations
- kvset
- kwargs
- liftr
- LINUXNEXTVMIMAGE
- LINUXOS
- LINUXVMIMAGE
- llcinitial
- llcresi
- llcupdate
- LNOT
- locationyaml
- logz
- LRO
- lropaging
- lroparameterizedendpoints
- Lucene
- luisappid
- MACVMIMAGE
- mgmt
- mkdirp
- mobo
- msaappid
- msaapptenantid
- msazure
- msdata
- mycert
- mycompany
- mylocation
- mysignalrservice
- ndash
- noflatten
- nonstringenum
- northcentralus
- notypedheadersmethods
- nsps
- nupkg
- odata
- okhttp
- olcmtest
- olcmtestcontainer
- Onco
- oncophenotype
- Pageble
- PAYG
- petstoreopgrp
- popd
- println
- prismjs
- propery
- psscriptanalyzer
- Ptest
- pushd
- pypi
- pystac
- pytest
- qnas
- RAGRS
- RAGZRS
- regionality
- responseasbool
- reinjected
- Reranker
- requiredfieldsascotrargstransformation
- requirexmsflattened
- responseasbool
- rpaasoneboxacr
- rpass
- Rscc
- Rscd
- Rsce
- Rscl
- Rsct
- sampleclientid
- scont
- Serv
- SERVICERP
- seti
- signalr
- Skus
- southcentralus
- stac
- strconv
- streamstyleserializationctorargs
- subid
- subscriptionidapiversion
- supportsnetworkacls
- tcgc
- testcmk
- tofile
- tsmv
- uknorth
- uksouth
- ukwest
- userrp
- vnet
- westcentralus
- WINDOWSVMIMAGE
- Xcognitive
- azcore
- azkeys
- azsecrets
- byval
- devcenter
- petstoreopgrp
- pypi
- Tsps
24 changes: 24 additions & 0 deletions eng/pipelines/jobs/build-for-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ jobs:
PackagePath: packages/typespec-python
GeneratorName: "@azure-tools/typespec-python"

# Java e2e tests and spector coverage upload. The emitter-tests project is a
# standalone npm+Maven project (not in the pnpm workspace). Generate.ps1
# builds the emitter jar + tgz (Build-TypeSpec.ps1), npm installs it and
# regenerates the SDK from the spector specs; Spector-Tests.ps1 starts the
# mock server, runs the JUnit tests and produces tsp-spector-coverage-java.json.
- script: pnpm turbo run --filter "@azure-tools/typespec-java^..." build
displayName: "Build typespec-java dependencies"

- pwsh: ./Generate.ps1
Comment thread
XiaofeiCao marked this conversation as resolved.
displayName: "Regenerate Java test code"
workingDirectory: packages/typespec-java/emitter-tests
env:
JAVA_HOME: $(JAVA_HOME_11_X64)

- pwsh: ./Spector-Tests.ps1
displayName: "Run Java spector tests"
workingDirectory: packages/typespec-java/emitter-tests
env:
JAVA_HOME: $(JAVA_HOME_11_X64)

- template: /eng/pipelines/templates/upload-spector-coverage.yml
parameters:
PackagePath: packages/typespec-java/emitter-tests
GeneratorName: "@azure-tools/typespec-java"
# TypeScript (typespec-ts) e2e tests and spector coverage upload.
# The emitter was migrated here from Azure/autorest.typescript; this replaces
# the coverage upload that previously ran in that (now deprecated) repo.
Expand Down
Loading
Loading