Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit df98100

Browse files
committed
Document how to recompile proto files
1 parent 9f3f198 commit df98100

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/development.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Development
2+
3+
## Recompiling the lib proto files
4+
5+
After some updates in the compiler, it might be useful to recompile the standard Google proto files. As the proto files
6+
are distributed with `protoc`, their path might depend on your installation.
7+
8+
```bash
9+
mkdir lib
10+
protoc \
11+
--python_betterproto2_opt=INCLUDE_GOOGLE \
12+
--python_betterproto2_out=lib \
13+
-I /usr/include/ \
14+
/usr/include/google/protobuf/*.proto
15+
```
16+
17+
The generated files should be distributed in the `betterproto2` package.
18+
19+
!!! warning
20+
These proto files are written with the `proto2` syntax, which is not supported by betterproto. For the compiler to
21+
work, you need to manually patch the generated file to mark the field `oneof_index` in `Field` and
22+
`FieldDescriptorProto` optional.
23+
24+
In the compiler, you also need to compile the [plugin.proto](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/plugin.proto)
25+
file in `src/betterproto2_compiler/lib/google.protobug/compiler/__init__.py`.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ nav:
1414
- Betterproto2 compiler:
1515
- index.md
1616
- Getting started: getting-started.md
17+
- Development: development.md
1718

1819
plugins:
1920
- mkdocstrings

0 commit comments

Comments
 (0)