capnproto-rust icon indicating copy to clipboard operation
capnproto-rust copied to clipboard

capnpc-rust: make CLI plugin aware of `default_parent_module`

Open lucab opened this issue 6 months ago • 2 comments

This enhances the capnpc-rust CLI plugin binary in order to make the default "parent module" value dynamic and controlled through an environment flag at runtime.

It matches the behavior which is already available for build.rs scripts through CompilerCommand::default_parent_module(). This only affects the default value, which can be still overridden by parentModule schema annotations as usual.

When using the Rust plugin through the capnp compiler, it is now possible to set the default parent module like this:

CAPNPC_RUST_DEFAULT_PARENT_MODULE="generated" capnp \
  compile \
  -orust:./src/generated/ \
  --src-prefix=src/schema \
  ./src/schema/poc.capnp

lucab avatar Jun 23 '25 08:06 lucab

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 50.64%. Comparing base (ab342b3) to head (1c8d645). Report is 159 commits behind head on master.

Files with missing lines Patch % Lines
capnpc/src/capnpc-rust.rs 0.00% 7 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #568      +/-   ##
==========================================
- Coverage   51.64%   50.64%   -1.00%     
==========================================
  Files          69       70       +1     
  Lines       33735    32239    -1496     
==========================================
- Hits        17422    16329    -1093     
+ Misses      16313    15910     -403     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 23 '25 08:06 codecov[bot]

My hope is that if we can implement #576, then we won't need this workaround.

dwrensha avatar Jul 28 '25 18:07 dwrensha