Skip to content

capnpc-rust: make CLI plugin aware of default_parent_module #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Jun 23, 2025

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

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
```
Copy link

codecov bot commented Jun 23, 2025

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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

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