Commit f2e8469
authored
# Java codegen: clean output directory before generating to prevent orphan accumulation (#1623)
## Summary
Add a clean step to `java/scripts/codegen/java.ts` that removes the entire
generated output directory before writing new files. This ensures that when
upstream schema types are renamed or removed, the previously-generated `.java`
files are automatically deleted rather than silently accumulating as orphans.
## Changes
- **`java/scripts/codegen/java.ts`** — At the start of `main()`, recursively
delete `src/generated/java/com/github/copilot/generated/` and recreate the
empty directory before invoking any generators.
- **`java/src/generated/java/`** — 204 orphan files removed (types no longer
emitted by the current schema). These accumulated over multiple
`@github/copilot` releases as types were renamed or removed upstream.
- **`GeneratedRpcRecordsCoverageTest.java`** — Removed test methods that
exercised deleted generated types (`SessionWorkspaceCreateFileParams`,
`SessionModeGetResult`, `SessionModeSetResult`, `DiscoveredMcpServerSource`,
and 16 others).
- **`GeneratedRpcApiCoverageTest.java`** — Removed test method for the deleted
`SessionAgentDeselectResult` type.
## Why this works going forward
The CI workflow (`java-codegen-check.yml`) runs codegen and then checks
`git status --porcelain`. Because codegen now cleans before writing, any future
orphans will appear as deletions in the diff and the check will fail —
preventing orphan accumulation without any additional workflow changes.
Fixes #16191 parent 53ffb24 commit f2e8469
207 files changed
Lines changed: 6 additions & 8492 deletions
File tree
- java
- scripts/codegen
- src
- generated/java/com/github/copilot/generated
- rpc
- test/java/com/github/copilot/generated/rpc
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2059 | 2059 | | |
2060 | 2060 | | |
2061 | 2061 | | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
2062 | 2068 | | |
2063 | 2069 | | |
2064 | 2070 | | |
| |||
Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 0 additions & 27 deletions
This file was deleted.
java/src/generated/java/com/github/copilot/generated/PermissionDeniedByContentExclusionPolicy.java
Lines changed: 0 additions & 44 deletions
This file was deleted.
0 commit comments