-
Couldn't load subscription status.
- Fork 242
Select custom executable for 'capnp' command #181
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
Conversation
|
Thanks! My inclination is to add this as another option in the builder pattern, like this: Is there any reason that your |
One approach might be to run the code generator outside of the main build process and check in the generated code.
I'm not sure what the best approach would be. I'd be interested to hear any thought you have about how we could better support such things. Note that although "write the capnp tool in Rust" is within the realm of possibility, it would require a large amount of work. |
That's definitely also an option, and maybe fits the fluent API even more, in the sense that you would always finish the chain with To keep it generically working with
True, but I was thinking of a scenario where you collaborate in a team, and different members have different OSes. It's of course nicer if a project "directly works" 🙂
I assume the generator itself is also (together with the library) part of https://github.com/capnproto/capnproto? Yes, I agree that even if it's a common heard phrase, "rewrite it in Rust" is not necessarily the best choice, especially since you then need to maintain 2 tools (or have the same problem in C++). For example, Prost, a Rust library for protobuf, ships the precompiled binaries for most common platforms: https://github.com/danburkert/prost/tree/master/prost-build/third-party/protobuf. |
Yep, that's what I had in mind. We're already storing a bunch of
Interesting! |
|
Thanks for the again super-fast answer! It was quite easy to avoid allocation in the default case. But I didn't want to go as far as storing only a unowned reference in I also allowed myself to add some
Just some thoughts: On https://capnproto.org/install.html, it looks like you provide binaries for Windows, while you suggest using package managers or building from source on Linux and OS X. One thing to keep in mind is that if binaries are shipped in the official crate, users might expect them to be always up-to-date with latest source. This could add a lot of work on your side or delay releases for only this reason. An alternative would be a dedicated crate just for the generator tool. Then, the version number would indicate whether the tool is up-to-date or not. Could even have its own Git repository to avoid every user pulling in large binary diffs. Might also simplify setting up things like CI or support for more platforms in the future, if that is ever requested. It's of course also possible to just start with the most compatible/common platforms (e.g. Win32 + Linux 64bit) and require others to install |
|
Looks good to me. Thanks! |
Thank you for starting this discussion about distribution of the |
I think the usual way the builder pattern works is that the last call wins. See https://doc.rust-lang.org/std/process/struct.Command.html for example. Like, imagine I want to provide you with a command that has some default configuration, allowing you to add some more configuration. It would be surprising if your configuration caused a panic -- you would expect it to instead override the existing configuration. For these reasons, I think I am probably going to remove the |
|
Thanks for the merge! Good point about the assert. The only thing to keep in mind is that some of the options can't be "undone" (e.g. I'll create a separate issue for the distribution of |
Select custom executable for 'capnp' command
Hello! There seems to be no current API for selecting the
capnpexecutable that is used to run the schema generation. Instead, theCompilerCommand.run()method assumes acapnpname is visible either relative to the Rust working directory, or in PATH. This disallows use cases such as shipping thecapnpexecutable in a custom directory within the project.I added the following method to
CompilerCommand:which allows
build.rsconfigurations with custom paths, such as:The 2nd commit fixes some warnings regarding explicit lifetime annotations, which can be elided. Let me know if you prefer keeping those, and I'll remove the commit.
Maybe a general question related to the
capnpgenerator: what is considered best practice for a self-contained and portable Rust project using Cap'n'Proto? Would you recommend providing binaries for the major platforms (Windows, Linux, Mac OS)? I fear a custom C++ build step might add a lot of complexity.