For developers: Supports running plugin.py standalone so its possible to debug it. Run protoc (or generate.py) with BETTERPROTO_DUMP="yourfile.bin" to write the request to a file. Then run plugin.py from your IDE in debugging mode, and redirect stdin to the file.
(dump_file: str, request: CodeGeneratorRequest)
| 38 | |
| 39 | |
| 40 | def dump_request(dump_file: str, request: CodeGeneratorRequest) -> None: |
| 41 | """ |
| 42 | For developers: Supports running plugin.py standalone so its possible to debug it. |
| 43 | Run protoc (or generate.py) with BETTERPROTO_DUMP="yourfile.bin" to write the request to a file. |
| 44 | Then run plugin.py from your IDE in debugging mode, and redirect stdin to the file. |
| 45 | """ |
| 46 | with open(str(dump_file), "wb") as fh: |
| 47 | sys.stderr.write(f"\033[31mWriting input from protoc to: {dump_file}\033[0m\n") |
| 48 | fh.write(request.SerializeToString()) |
| 49 | |
| 50 | |
| 51 | if __name__ == "__main__": |
no test coverage detected