Repository navigation
Replace typespec-java PowerShell automation with TypeScript - #5170
Conversation
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
commit: |
|
Copilot rename core-source.ts to core-commit.ts |
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A few newly updated docs/messages are now inaccurate or non-actionable (referencing non-existent files or suggesting running a .ts path directly), and should be corrected before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR migrates @azure-tools/typespec-java build/regeneration/e2e automation from PowerShell scripts to Node-native TypeScript entrypoints to avoid terminal control output issues that have impacted Turbo/CI.
Changes:
- Replaced PowerShell-based automation (copy sources, build generator, regenerate, sync tests, run Spector e2e) with TypeScript scripts using
execaand Node fs APIs. - Updated CI (GitHub Actions + ADO pipeline job) to invoke the new scripts via standard
scriptsteps andnode ...tsentrypoints. - Added focused unit tests for the pinned-core extraction logic (
core-commit.ts) and updated Java emitter-test documentation accordingly.
File summaries
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lockfile entries for new script dependencies (execa, tar). |
| packages/typespec-java/vitest.config.ts | Expands Vitest include globs to run new eng/**/*.test.ts tests. |
| packages/typespec-java/SyncTests.ps1 | Removes PowerShell sync script (replaced by TS). |
| packages/typespec-java/Spector-Tests.ps1 | Removes PowerShell Spector test runner (replaced by TS). |
| packages/typespec-java/package.json | Switches scripts to node ./eng/scripts/*.ts and adds execa/tar dev deps. |
| packages/typespec-java/Generate.ps1 | Removes PowerShell regeneration script (replaced by TS). |
| packages/typespec-java/eng/scripts/sync-tests.ts | New TS implementation for syncing core test sources and applying core.test.patch. |
| packages/typespec-java/eng/scripts/spector-tests.ts | New TS implementation for starting/stopping Spector server, running Maven tests, staging coverage. |
| packages/typespec-java/eng/scripts/generate.ts | New TS implementation of regeneration workflow with concurrency and per-spec options. |
| packages/typespec-java/eng/scripts/core-commit.ts | New shared TS helper to read sources from pinned core commit via git archive without mutating submodule checkout. |
| packages/typespec-java/eng/scripts/core-commit.test.ts | Adds unit tests validating pin-absent behavior, pinned extraction, and cleanup. |
| packages/typespec-java/eng/scripts/copy-sources.ts | New TS copy+patch flow for emitter+generator sources from core/. |
| packages/typespec-java/eng/scripts/build-generator.ts | New TS wrapper to build the patched generator JAR via Maven. |
| packages/typespec-java/emitter-tests/spector.config.yaml | Updates comment to reference TS regenerator instead of PowerShell. |
| packages/typespec-java/emitter-tests/resolve-spector-specs.js | Updates header comments to reference TS regenerator. |
| packages/typespec-java/emitter-tests/readme.md | Updates contributor docs/commands and clarifies the TS-based workflow. |
| packages/typespec-java/CoreCommit.ps1 | Removes PowerShell pinned-core helper (replaced by TS). |
| packages/typespec-java/Copy-Sources.ps1 | Removes PowerShell copy+patch script (replaced by TS). |
| packages/typespec-java/CONTRIBUTING.md | Updates contributor docs to reference TS scripts/commands instead of PowerShell. |
| packages/typespec-java/Build-Generator.ps1 | Removes PowerShell generator build script (replaced by TS). |
| eng/pipelines/jobs/spector-coverage.yml | Replaces pwsh steps with script steps for Java spector coverage. |
| .github/workflows/ci-java.yml | Updates workflow comments to reference TS regenerator. |
| .chronus/changes/copilot-move-away-from-powershell-script-2026-7-6-3-2-25.md | Adds changelog entry for the automation migration. |
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
packages/typespec-java/CONTRIBUTING.md:153
emitter-tests/package.jsonis referenced as needing version/.tgz updates, butemitter-tests/has no package.json and the tests consume the workspace build directly. The instructions should be updated to avoid pointing people at a non-existent file.
submodule stays unchanged. The bump must also be reflected in `emitter-tests/package.json` (its
`version` and the `*.tgz` dependency) — rerun `pnpm sync-tests` or update it manually.
- Files reviewed: 22/23 changed files
- Comments generated: 3
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new spector-tests.ts currently swallows some ENOENT failures during coverage staging, which can hide real setup/CI problems.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
packages/typespec-java/eng/scripts/spector-tests.ts:40
- The ENOENT handler around copyFile() will also swallow failures where the destination path is missing (e.g., node_modules/@azure-tools/azure-http-specs isn’t installed), which would silently skip staging the coverage file. It should only ignore ENOENT when the source coverage report wasn’t produced, and still fail if the destination can’t be written.
try {
await copyFile(
join(emitterTestsRoot, "tsp-spector-coverage-java.json"),
join(packageRoot, "node_modules", "@azure-tools", "azure-http-specs", "spec-coverage.json"),
);
- Files reviewed: 22/23 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
You can try these changes here
|
PowerShell terminal control output can disrupt Turbo builds and has previously caused CI failures through stderr handling. Move Java emitter automation to Node-native TypeScript.
Build automation
execafor Git, Maven, pnpm, and TypeSpec commands.CI integration
Coverage and documentation