tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
452 stars 87 forks source link

Allow build.rs to generate files in OUT_DIR #123

Closed tafia closed 6 years ago

tafia commented 6 years ago

close #122

@jimblandy would it work for you?

jimblandy commented 6 years ago

Yes, this would help, but I think it's more than I need!

I think the comments explaining what the Rust code was generated from could be quite valuable in large systems with more than a handful of generate files. The only problem that I know of is that they cannot be //! comments. So for my purposes, simply the one-character change to write_headers would suffice.

I'm not sure I would actually use the option to disable the headers, as long as they're just plain comments.

tafia commented 6 years ago

It is not just with the comment, it is also with all the module attributes.

If the file is in the OUT_DIR folder, one should assume that it was automatically generated. Knowing that it is from pb-rs could be done at library level by just renaming the file for instance. Of course we can also keep the comment as a regular one (not a module comment) and get rid of the attributes.

jimblandy commented 6 years ago

Right, //! comments are just one special case of inner attributes in general. No inner attributes are allowed in a file you're going to include!. So it'd have to avoid generating not just doc comments, but any other sort of module attribute. That's too bad.

nerdrew commented 6 years ago

Did you miss changing the MAGIC_COMMENT too?

tafia commented 6 years ago

Did you miss changing the MAGIC_COMMENT too?

Sorry I am not sure I follow. What is this?

nerdrew commented 6 years ago

Sorry I wasn't more clear. The MAGIC_COMENT const still uses //!