https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-breakfast-49010

06/19/2019, 6:31 PM
anyway regardless you can fix the problem with doctests with that bit of pseudo-markdown syntax, there's no reason to write docs that will fail doctests
💯 1
a

average-vr-56795

06/19/2019, 6:32 PM
The docs are generated from comments in a
.proto
file
I believe we already do a little preprocessing of
.proto
files (or possibly the generated code), so feel free to edit
src/rust/engine/process_execution/bazel_protos/build.rs
to make the codegen happen better!
h

hundreds-breakfast-49010

06/19/2019, 6:37 PM
sure, I'll take a look at that
I only know about this becuase I literally ran into it myself recently, but there is a fix 🙂
a

average-vr-56795

06/19/2019, 6:39 PM
Woo! Thanks! 😄 I would be very happy to have it fixed!
h

hundreds-breakfast-49010

06/19/2019, 7:23 PM
okay I dug into this for like half an hour, what's going on is that the markdown-style comments in
3rdparty/protobuf/googleapis/google/api/*.proto
have code in them, using the markdown four-spaces convention for code blocks
and this is getting put directly into rust comments
so I could change the comments in the .proto files to use the ```text syntax
but I don't know if that would break anything there
it looks like protoc_grpcio is the rust crate doing the protobuf conversion?
a

average-vr-56795

06/19/2019, 7:27 PM
If we can leave the files checked in as-is, and dynamically do a rewrite into a temporary directory with the “fixed” files which we then use for codegen, that would be amazing
h

hundreds-breakfast-49010

06/19/2019, 7:30 PM
might be doable
looks like you did most of the lines of code in this file
btw what does "tower" mean here?
a

average-vr-56795

06/19/2019, 7:31 PM
In build.rs? Yeah, sadly that’s mostly my baby
h

hundreds-breakfast-49010

06/19/2019, 7:31 PM
I see that a lot
I'm trying to figure out where hte paths to the protobuf files are specified
a

average-vr-56795

06/19/2019, 7:31 PM
h

hundreds-breakfast-49010

06/19/2019, 7:31 PM
I see some of them as just raw strings in the file, but not all
a

average-vr-56795

06/19/2019, 7:31 PM
In particular, they have a grpc library: https://github.com/tower-rs/tower-grpc
The proto files themselves have imports in them, which are all paths relative to a search root
So we list the entry-points as strings in the file, and then the proto compiler will read the files, and follow the imports; one of the arguments to the compiler is a list of search roots (or maybe we copy the files all to be descendants of one directory, pretty sure at times we’ve done both)
h

hundreds-breakfast-49010

06/19/2019, 8:08 PM
so, maybe one way to attack this is to walk the directory tree, copy every *proto file to an isomorphic directory tree in a temp directory, edit the files to have the right ```text syntax, then run the current code against that new path?
that does seem like kind of a lot of hacky effort to make this work though
a

average-vr-56795

06/19/2019, 8:09 PM
Sounds plausible 🙂
But yeah, that’s why I haven’t gotten around to it, and have just been using
--tests
🙂
h

hundreds-breakfast-49010

06/19/2019, 8:09 PM
yeah this is a harder problem than it seemed at first 🙂
I think I'll hold off on this for now myself and work on things that will get me more familiar with the codebase as a whole for now
but i'll keep a pin on this
a

average-vr-56795

06/19/2019, 8:10 PM
Sounds good!