Closed JParisFerrer closed 3 years ago
awesome - thanks for finding this This seems related to #67 - adding CI support for windows.
For what it's worth - pb-jelly's codegen definitely works on Windows (and we use it on windows at DBX) - however, pb_jelly_gen seems like it does not.
If you directly invoke protoc with --rust_out referencing the codegen.bat - it'll work.
After messing around with file encoding, BOM, etc etc I worked around it via reinstalling all the deps in WSL and running the gen there. Not ideal, but easier (although probably not faster) than building/writing down some protoc command somewhere.
Note an issue I noticed: protos/myproto.proto fails with a confusing error message (see below), but moving it into protos/myproto/myproto.proto seemed to fix that. Should that be filed separately? The comment here right above the error sort of suggests its not expected
[/home/jordi/.cargo/registry/src/github.com-1ecc6299db9ec823/pb-jelly-gen-0.0.4/src/lib.rs:169] output.status.code() = Some(
1,
)
stdout=
stderr=Traceback (most recent call last):
File "/tmp/codegenMIlOse/codegen.py", line 1783, in <module>
generate_code(request, response)
File "/tmp/codegenMIlOse/codegen.py", line 1768, in generate_code
generate_single_crate(ctx, "", to_generate, response)
File "/tmp/codegenMIlOse/codegen.py", line 1683, in generate_single_crate
mod_name = mod_parts[-1]
IndexError: list index out of range
--rust_out: protoc-gen-rust: Plugin failed with status code 1.
Yep - codegen.py appears to expect that it is in a directory which implies the crate name. file something separately for that.
one option
I haven't really thought it through to decide which case to prefer. Feel free to fix it! It seems like it would be hard to add a unit test in our testing framework for error situations (first option) - but we could certainly test the second option.
@JParisFerrer - just added windows support! Fixed the bugs in #74
Creating a -gen create using pb-jelly-gen does not work on Windows due to unix-specific imports.
Output of
cargo run --bin proto-gen
(proto-gen is the gen crate in a cargo workspace):