Skip to content

Ship kit-rpc's generated code as ordinary source, with no build script - #315

Draft
marthendalnunes wants to merge 4 commits into
mainfrom
kit-0110-lane-rpc-generated-code
Draft

marthendalnunes wants to merge 4 commits into
mainfrom
kit-0110-lane-rpc-generated-code

Conversation

@marthendalnunes

@marthendalnunes marthendalnunes commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

kit-rpc already kept its generated protocol code in generated/, but a build script staged it into OUT_DIR and carried buffa-build and connectrpc-build as build dependencies. Every crate that depends on kit-rpc built those generators and their tree, though only the regeneration scripts ever used them.

Change

  • kit-rpc includes generated/ directly. build.rs and the [build-dependencies] are gone, and connectrpc-build leaves the transport feature.
  • The generators move to a new unpublished crate, kit-rpc-codegen (publish = false, nothing depends on it). scripts/regen-rpc-proto.sh and scripts/regen-transport-proto.sh run it, so the existing "generated code is fresh" job (scripts/check-generated-fresh.sh) checks the same output as before. There is one way to generate, not two.
  • The old OUT_DIR marker plumbing (scripts/codegen-out-dir.py and its test) is removed.

Code lives in kit-rpc (consumer side) and kit-rpc-codegen (tool); kit-core is untouched.

Generated bytes

Same buffa 0.9.2 and connectrpc-build 0.9.0, same proto inputs. Regenerating changes only 7 lines in two wrapper files (_includes.rs, transport/_connectrpc.rs): include!(concat!(env!("OUT_DIR"), "/x.rs")) becomes include!("x.rs"), because there is no OUT_DIR without a build script. Every other generated file is byte-identical. No wire change; buf lint and buf breaking are unaffected.

Build dependencies

cargo tree -e normal,build for a crate that depends on kit-rpc:

  • kit-rpc build-dependencies: 1 before (buffa-build; 2 with transport, plus connectrpc-build), 0 after.
  • Packages a dependent builds only because of them: 4 before (buffa-build, buffa-codegen, buffa-descriptor, prettyplease), 0 after. With the transport feature, 8 before (those plus connectrpc-build, connectrpc-codegen, anyhow, heck), 0 after.
  • The shipped kit binary (kit-bin): 7 fewer packages in the release list (scripts/release/kit-packages.golden: the 7 above), now 283.
  • kit-client: 94 packages before, 90 after. kit-serve 86 to 82, kit-sync 117 to 113.

Checked on the Studio: freshness script clean, clippy (workspace lints) on kit-rpc, kit-rpc-codegen, kit-client, kit-serve, kit-sync and kit-transport-connect, kit-rpc nextest (25 of 25), rustdoc with warnings denied, wasm32 check of kit-rpc with transport and of kit-client.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant