Skip to content

Run code generation on build - #64400

Open
Wesley Wigham (weswigham) wants to merge 5 commits into
microsoft:mainfrom
weswigham:generate-on-build
Open

Wesley Wigham (weswigham) wants to merge 5 commits into
microsoft:mainfrom
weswigham:generate-on-build

Conversation

@weswigham

Copy link
Copy Markdown
Member

So that you never need to remember "oh, I changed X so need to regenerate Y" ever again.

Also fixes build:watch to do code generation, too, if people are using that.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Watch reruns can bypass schema validations and mark stale generator output as current.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Runs code generation automatically before builds and during watch mode.

Changes:

  • Adds generated-output metadata and schema reloading.
  • Integrates generation into build, API, validation, watch, and release tasks.
  • Adds watch-mode coverage and updates contributor guidance.
File Description
Herebyfile.mjs Integrates generation with build and watch tasks.
CONTRIBUTING.md Documents the revised workflow.
tools/​scripts/​gen/​generatedFile.test.mts Tests repeated watch generation.
tools/​scripts/​tsc/​schema.ts Supports schema reloading.
tools/​scripts/​tsc/​generate.ts Reloads schema before generation.
tools/​scripts/​tsc/​generate-ts-ast.ts Refreshes schema-derived state and exports outputs.
tools/​scripts/​tsc/​generate-go-ast.ts Exports generated output paths.
tools/​scripts/​tsc/​generate-enums.ts Exports enum output paths.
tools/​scripts/​tsc/​generate-encoder.ts Exports encoder output paths.
tsc/​internal/​stringutil/​_scripts/​generate-unicode-data.mts Exports Unicode output paths.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Herebyfile.mjs Outdated
Comment thread tools/scripts/tsc/generate.ts
@weswigham

Copy link
Copy Markdown
Member Author

It's a bit of a tangent, but I also just went ahead and deleted all the tests in generatedFile.test.mts that were more like npx hereby task integration tests than caching functionality tests - while I get where they came from, if they have a place (though I think they do not), it's not there. They were getting progressively weirder in how specifically they were trying to introspect and lock-down task functionality with every new test, but I fundamentally don't think there's a good place to "test" top-level task definition functionality like that.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants