Emit build-graph.json for editor tooling - #486
Conversation
Add SerializeBuildGraphAttribute, which writes a machine-readable projection of the target graph to <temp>/build-graph.json on every build init: target names, descriptions, declaring type, default/listed flags, and the four relation kinds (dependsOn/after/triggeredBy/triggers). Reuses the same graph data as the --plan renderer. Runs at priority 20 so --plan and --help runs also refresh it. Best-effort: wrapped so a serialization failure can never fail a build. Consumed by the VS Code extension's targets view and dependency graph. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ITaluone
left a comment
There was a problem hiding this comment.
Very cool! :)
Just these two little issues.
been cooking this for a while, when we release 10.4 i also intend to release a set of IDE extensions starting with VS Code |
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
Co-authored-by: ITaluone <44049228+ITaluone@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a build-initialization extension that emits a machine-readable build-graph.json into the build temporary directory so editor tooling can consume target metadata and relationships.
Changes:
- Registers a new build extension (
[SerializeBuildGraph(Priority = 20)]) ahead of--plan/--help. - Introduces
SerializeBuildGraphAttributeto serialize a deterministic, sorted schema-v1 target graph model to<temp>/build-graph.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Fallout.Build/FalloutBuild.cs | Registers the new build extension early in initialization. |
| src/Fallout.Build/Execution/Extensions/SerializeBuildGraphAttribute.cs | Implements best-effort JSON emission of the target graph for tooling consumption. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Move the target-graph projection and JSON serialization out of SerializeBuildGraphAttribute into a pure BuildGraphUtility, so the build-graph.json contract the VS Code extension consumes can be snapshot-tested without driving a full build. The attribute keeps only the build-lifecycle hook and the file write. Add BuildGraphUtilitySpecs: Verify snapshots that lock the emitted JSON shape, plus unit coverage for target/dependency ordering, relation-kind mapping, declaredIn, null handling, and version normalization. Address review feedback: rename ResolveFalloutVersion -> FindFalloutVersion (it can return null) and brace the null guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Out of curiosity: do you have knowledge building Rider plugins? Would like to help with those, but cannot know where to start |
Adds
SerializeBuildGraphAttribute(priority 20, ahead of--plan/--help) that writes<temp>/build-graph.jsonon build initialization — a machine-readable projection of the target graph for editor tooling (the VS Code extension's targets view + dependency graph).{ version, falloutVersion, targets[] }; each target carriesname,description,declaredIn,default,listed, anddependsOn/after/triggeredBy/triggers.--planrenderer; deterministic output (targets and relation lists sorted).Restores an emitter that previously existed (a stale
.fallout/temp/build-graph.jsonwas still checked into the tree) but was no longer in source. Verified by dogfooding: regenerated output matches the prior file except for the advanced build height and a since-removed target.🤖 Generated with Claude Code