Skip to content
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

WIP: Codegen option to create module hierarchy #688

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kriswuollett
Copy link

Work-in-progress PR for generating protobufs in a module hierarchy

TODO:

  • add tests
  • code generate the mod.rs files I'm currently writing by hand when testing in a another repo which uses a build.rs snippet like:
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
let out_dir = manifest_dir.join("src").join("test_pb");
codegen.out_dir(out_dir);
codegen.customize(
    Customize::default()
        .gen_mod_rs_hierarchy_out_dir_mod_name("test_pb".to_owned())
        .gen_mod_rs(false),
);

Need guidance on:

  • intended usage of idents, components in RustPath-like structures

@kriswuollett
Copy link
Author

Testing output in a tonic::Codec PR that I'll probably move to tonic repo once ready: appbiotic/code#21. I'll be checking in the generated tree of mod.rs files temporarily to show progress. The proto tree seems to compile OK but haven't done comprehensive tests yet.

@stepancheg
Copy link
Owner

Sorry the project is low support.

If you have some specific question, I'll try to answer.

@kriswuollett
Copy link
Author

No worries, the project really helped me get started with ffi this past year, both as user and reading the code. Thanks for checking in on me.

Wanted to do something that made includes like a monorepo. Just switched over to cbindgen this week so I could do a header file per crate and being able to specify adding things like the dependencies includes. Doesn't have all the nice types like safer-ffi, but I only need return and free raw mut ptr structs so works ok at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants