This required enabling the feature in the code generator and fixing a few edge cases around label and type.
Also added tests to verify the special cases, and to verify that required fields work as expected.
PiperOrigin-RevId: 580263087
This makes the file layout a bit more consistent with the `protos ->
protos_generator` pattern. I also replaced the `upbc` namespace with
`upb::generator`.
PiperOrigin-RevId: 569264372
This change moves almost everything in the `upb/` directory up one level, so
that for example `upb/upb/generated_code_support.h` becomes just
`upb/generated_code_support.h`. The only exceptions I made to this were that I
left `upb/cmake` and `upb/BUILD` where they are, mostly because that avoids
conflict with other files and the current locations seem reasonable for now.
The `python/` directory is a little bit of a challenge because we had to merge
the existing directory there with `upb/python/`. I made `upb/python/BUILD` into
the BUILD file for the merged directory, and it effectively loads the contents
of the other BUILD file via `python/build_targets.bzl`, but I plan to clean
this up soon.
PiperOrigin-RevId: 568651768
Unfortunately in OSS with Bazel it appears that we must include this empty file, otherwise we get compile errors. More info in: b/300637173
PiperOrigin-RevId: 565699708
The new rules are:
- `upb_minitable_proto_library()`: contains the MiniTables only
- `upb_c_proto_library()`: Contains the C API. Depends on the MiniTables
This involved splitting upb code generation into two separate aspects, one for MiniTables and one for the C API.
PiperOrigin-RevId: 565518070
A couple weeks ago we moved upb into the protobuf Git repo, and this change
continues the merger of the two repos by making them into a single Bazel repo.
This was mostly a matter of deleting upb's WORKSPACE file and fixing up a bunch
of references to reflect the new structure.
Most of the changes are pretty mechanical, but one thing that needed more
invasive changes was the Python script for generating CMakeLists.txt,
make_cmakelists.py. The WORKSPACE file it relied on no longer exists with this
change, so I updated it to hardcode the information it needed from that file.
PiperOrigin-RevId: 564810016
This is the second attempt to fix our Git history. This should allow
"git blame" to work correctly in the upb/ directory even though our
automation unexpectedly blew away that directory.
Prior to this change, all sub-messages and sub-enums were initialized to NULL. Going forward, sub-messages will need to be initialized differently than sub-enums.
To facilitate this, we change the order of subs, so that sub-messages always come before sub-enums. Then when we allocate the subs, we can initialize them in two separate loops.
This unfortunately requires one extra iteration over the fields if any closed enums are present, to adjust the `submsg_index` according to how many sub-messages were seen.
This CL is the first step towards changing how we handle unlinked sub-messages.
PiperOrigin-RevId: 529100966