James Newton-King
67b9c76752
Add .NET debugging attributes ( #14097 )
...
I've been working with a large Protobuf model and noticed debugging issues that can easily be improved.
Add debugging attributes to collections, `ByteString`, and descriptors. No impact on runtime behavior. Debugger type proxies are what the debugger displays by default, but full data is available by selecting "Raw View".
`RepeatedField` and `MapField` now display their item count. This is standard across .NET collections. For example, .NET's list and dictionary both display `Count = {Count}`.
Note that previously, Protobuf collections displayed the result of `ToString`, which returned JSON. The JSON debug view isn't useful when there is too much content to display at once because it's truncated. That experience will be fairly common.
Count benefits:
* Always useful
* Makes debugging Protobuf collections feel more like regular .NET collections
* Collection contents is now easier to access with debugger type proxies
No dependency between this PR and https://github.com/protocolbuffers/protobuf/pull/13838 . Each can be merged independently.
**MapField before:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/9dd3baa9-4432-446e-9049-1f7268d5be4c )
**MapField after:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/ac4aea33-e339-49e0-9a67-c174d2608393 )
**RepeatedField before:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/16353785-bef4-4489-a3ab-de2437d51d4e )
**RepeatedField after:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/f3de7680-ded9-41d8-aac0-84a9e7b65c98 )
**ByteString before:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/4febc400-1eb7-46ee-911e-a7698783a358 )
**ByteString after:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/7635080e-9bb0-4f61-9a39-afbb9e575051 )
**Descriptor before:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/5b89792b-a16a-4641-a50c-5355b5230b5d )
**Descriptor after:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/5047dc1e-c93b-43d5-bb8c-a6976a9ae6da )
**TypeRegistry before:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/d4aedf19-22cc-49b5-8717-9299e00abc85 )
**TypeRegistry after:**
![image](https://github.com/protocolbuffers/protobuf/assets/303201/4a473595-74b9-40e2-96b8-2b103d5f44b0 )
Closes #14097
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14097 from JamesNK:jamesnk/debugging f0dea3464d
PiperOrigin-RevId: 568444117
1 year ago
Adam Cozzette
34bbf3162d
Upgrade Docker image in upb test run for building Python wheels
...
This should ensure that we have access to Bazel 6.
PiperOrigin-RevId: 568354486
1 year ago
Mike Kruskal
4ce04206fc
Update our tests to use a custom checkout action.
...
This will retry up to 3 times if we hit networks flakes updating our submodules. It will also allow us to easily inject other stability fixes to this step in the future.
PiperOrigin-RevId: 568306356
1 year ago
Mike Kruskal
6166a68077
Increase our continuous tests by 4x to track down more flakes.
...
This will be rolled back after a few days.
PiperOrigin-RevId: 568304089
1 year ago
Mike Kruskal
1210eac457
Don't check out submodules in tests that don't need them.
...
This will help prevent network flakes.
PiperOrigin-RevId: 568287969
1 year ago
Thomas Van Lenten
6b30163526
[ObjC] Clean up enum fields when not using fwd decls.
...
Honor the generation option to create the minimal property for enum fields.
PiperOrigin-RevId: 568239992
1 year ago
Hong Shin
f4b102316e
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 568239714
1 year ago
Arwalk
7491a573f3
Update third_party.md with Zig implementation ( #14192 )
...
Proposition to add my own implementation of protobuf for the Zig programming language.
Closes #14192
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14192 from Arwalk:patch-1 d48281d61a
PiperOrigin-RevId: 568232767
1 year ago
Protobuf Team Bot
b86b9ff337
Internal change.
...
PiperOrigin-RevId: 568232318
1 year ago
Thomas Van Lenten
d58ed887ff
[ObjC] Wire the generation options through all the Field generators.
...
Nothing uses this yet, just gets things wired through.
PiperOrigin-RevId: 568230626
1 year ago
Adam Cozzette
cde00514e9
Expand lunit visibility to enable moving lua directory ( #14199 )
...
We will soon be moving the upb/lua directory up to the top level, so
this commit updates lunit's visibility to enable that.
1 year ago
Martijn Vels
617e1912b2
Optimize RepeatedPtrField to use copy constructors where possible
...
The most common MergeFrom() scenario is that items are newly appended to an existing repeated field that has never been shrunk. For these cases copy constructing new entries is the cheapest option. This change overloads MergeFrom<> for `std::string`, `StringPiece`, `Message` and `MessageLite`, leaving the remaining templated implementation for all concrete message types supporting arena enabled copy construction, which is implemented as an out of line factory functor implementation.
Going forward we should change `Arena::CreateMaybeMessage()` to return MessageLite* and accept const MessageLite& for copy construction. This will allow us to directly pass Arena::CreateMaybeMessage<T>() into these out of line functions.
PiperOrigin-RevId: 568220325
1 year ago
Thomas Van Lenten
cce7fc4f06
[ObjC] Wire generation options through Enum, Extension, Message, Oneof generators.
...
Swap out where the bool for stripping custom options was passed for
direct access to the generation options.
PiperOrigin-RevId: 568217321
1 year ago
Protobuf Team Bot
e57166b65a
Fix upb_MiniTable_Equals, add test.
...
PiperOrigin-RevId: 567806459
1 year ago
Protobuf Team Bot
cdc5f6484b
Auto-generate files after cl/567705458
1 year ago
Protobuf Team Bot
996268a345
Remove some function overrides from MapEntry and use the ones from Message.
...
This saves on binary size.
Plus, some other minor fixes to make the object more like normal codegen'd types.
PiperOrigin-RevId: 567705458
1 year ago
Sandy Zhang
c50e89217d
Require Python >=3.8 and add 3.11 to test matrix
...
Dropping 3.7 support was already announced in https://protobuf.dev/news/2023-07-06/ and meant to be dropped in
https://github.com/protocolbuffers/protobuf/pull/13219 but tests / setup.py were missed.
PiperOrigin-RevId: 567691335
1 year ago
Adam Cozzette
0f7a0b6c98
Update upb wheel tests to use ubuntu-latest
...
It appears that ubuntu-18 and ubuntu-20 don't exist anymore, and using
ubuntu-latest seems better for consistency anyway.
PiperOrigin-RevId: 567675738
1 year ago
Thomas Van Lenten
7824a4f0cd
[ObjC] Handle transtive public imports in minimal imports mode
...
If using minimal imports, a non direct import might be needed because
it is a public import of an other wise not required header; ensure
the import makes it into the generated code to type definitions can
be found.
PiperOrigin-RevId: 567672195
1 year ago
Protobuf Team Bot
2babd72727
Auto-generate files after PR #13838
1 year ago
Protobuf Team Bot
73b7f06faf
Verify closed enums rather than fallback to eager parsing.
...
PiperOrigin-RevId: 567666569
1 year ago
Adam Cozzette
87fcc79861
Internal change
...
PiperOrigin-RevId: 567664389
1 year ago
James Newton-King
e519c62f82
Improve .NET debugging of Protobuf messages ( #13838 )
...
Generated .NET protobuf messages override `ToString` and return JSON. By default, the .NET debugger displays the result from `ToString` and wraps it in curly braces, e.g. `{{ "Message": "Hello world" }}`. The double curly braces is an ugly result. People expecting JSON here are confused.
This PR adds a [DebuggerDisplayAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerdisplayattribute?view=net-7.0 ) to generated messages. The attribute tells the debugger to not quote the ToString value with `nq`.
Before:
![image](https://github.com/protocolbuffers/protobuf/assets/303201/b1cc5f45-4064-4ba0-b266-8894ca0f35c8 )
After:
![image](https://github.com/protocolbuffers/protobuf/assets/303201/70f6ffc0-9421-428d-bc22-ead7aa82c37f )
I haven't touched the protoc compiler in a long time. I'm guessing I need to build it and then run it to regenerate the checked-in code. I don't suppose someone else could do that? It would save me a lot of time 😬
Closes #13838
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13838 from JamesNK:jamesnk/csharp-message-debuggerdisplay 5222b82cf9
PiperOrigin-RevId: 567659327
1 year ago
Protobuf Team Bot
a30d71d873
Auto-generate files after cl/567400017
1 year ago
Protobuf Team Bot
ddc654e0bd
Fix several ClangTidy warnings in the codegen.
...
PiperOrigin-RevId: 567400017
1 year ago
Protobuf Team Bot
bfbc95d41e
Faster swap.
...
Arena never changes, so no need to swap it.
Also explicitly instantiated memswap template to reduce code size.
```
name old INSTRUCTIONS/op new INSTRUCTIONS/op delta
BM_ProtoSwap<TestAllTypes> 356 ± 0% 300 ± 0% -15.73% (p=0.000 n=100+100)
BM_ProtoSwap<NestedTestAllTypes> 67.0 ± 0% 63.0 ± 0% -5.97% (p=0.000 n=100+100)
BM_ProtoSwap<ForeignMessage> 31.0 ± 0% 31.0 ± 0% ~ (all samples are equal)
BM_ProtoSwap<TestAllExtensions> 52.0 ± 0% 52.0 ± 0% ~ (all samples are equal)
```
PiperOrigin-RevId: 567379442
1 year ago
Adam Cozzette
9b46ed520e
Add CI runs for testing upb Python wheels
...
This restores the Python wheel CI runs from the old upb repo with only minor
changes. I had to update a path in one of the `py_wheel` rules and also make a
slight tweak to ensure that the `descriptor.upb_minitable.{h,c}` files make it
into the source wheels. The change in text_format_test.py is not strictly
necessary but is a small simplification I made while I was trying to debug an
issue with CRLF newlines.
I had to update test_util.py to use `importlib` to access the golden files from
the installed `protobuftests` package. I suspect the previous incarnation of
thse test runs was somehow reading the goldens from the repo checkout, but I
think the intention is to read them from `protobuftests` instead. This was a
bit tricky to get working because Python versions before 3.9 do not support
`importlib.resources.files()`. I set up the code to fall back on
`importlib.resources.open_binary()` in that case, but that function does not
support subdirectories, so this required putting an `__init__.py` file inside
the `testdata` directory to make sure it is treated as a Python package.
PiperOrigin-RevId: 567366695
1 year ago
Protobuf Team Bot
301dfc5aeb
Add missing debugging version info to Protobuf Java gencode when multiple files are generated.
...
PiperOrigin-RevId: 567358666
1 year ago
Protobuf Team Bot
450e065fa5
Auto-generate files after cl/567343651
1 year ago
Eric Salo
70eeedd3b2
upb: clean up the headers in upb/mini_table/
...
PiperOrigin-RevId: 567343651
1 year ago
Eric Salo
fc75bf3fdc
upb: fix most of the ClangTidy warnings in util/required_fields.?
...
PiperOrigin-RevId: 567333328
1 year ago
Hong Shin
a36deef052
clean up spacing near message.cc::new_thunk
...
PiperOrigin-RevId: 567329421
1 year ago
Hong Shin
ec0eabe801
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 567327283
1 year ago
Protobuf Team Bot
e699aa601a
Automated rollback of commit baab809422
.
...
PiperOrigin-RevId: 567322048
1 year ago
Protobuf Team Bot
f7f42e3f0f
Auto-generate files after cl/567293489
1 year ago
Protobuf Team Bot
1de33336cd
InternalSwap does not need two arenas, since they are required to be the same
...
one.
PiperOrigin-RevId: 567293489
1 year ago
Protobuf Team Bot
e71ce645d2
Move some processing off to a secondary noinline function. This significantly
...
reduces the stack usage of the recursive function.
PiperOrigin-RevId: 567286733
1 year ago
Protobuf Team Bot
1180543de9
Internal Code Change
...
PiperOrigin-RevId: 567181574
1 year ago
Protobuf Team Bot
baab809422
Internal
...
PiperOrigin-RevId: 567175482
1 year ago
zhangskz
981aeb1ef8
Update to latest absl LTS patch 20230802.1 ( #14145 )
...
Closes #14145
PiperOrigin-RevId: 567165127
1 year ago
Protobuf Team Bot
ab53bda703
Removed unused variable.
...
PiperOrigin-RevId: 567157437
1 year ago
Adam Cozzette
9df1d76970
Prepare to reorganize upb file structure
...
I am getting ready to move almost everything under the upb/ directory up one
level to integrate upb better into its new location in the protobuf repo. This
change makes a few tweaks to prepare for that:
- Delete upb's LICENSE and CONTRIBUTING.md files since we already have similar
files at the top level.
- Rename `//python:python_version` so that it won't conflict later with
`//upb/python:python_version`.
- Move the contents of python/BUILD.bazel out to a Bazel macro to facilitate
merging that BUILD.bazel file with upb/python/BUILD.
PiperOrigin-RevId: 567119840
1 year ago
Protobuf Team Bot
33b78e67a9
Move Status error construction to helper NOINLINE functions to reduce stack
...
cost in the recursive functions.
Reduce the number of temporaries in the stack frame.
PiperOrigin-RevId: 567087381
1 year ago
Hong Shin
5fc9a3befd
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 567074295
1 year ago
Protobuf Team Bot
5d042f1af5
Auto-generate files after cl/567023292
1 year ago
Hong Shin
aa41f50562
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 567023292
1 year ago
Protobuf Team Bot
3892ab4fbb
Auto-generate files after cl/566724420
1 year ago
Jin Chao
9471a88225
`__NDK_MAJOR` should be `__NDK_MAJOR__` ( #14046 )
...
compilation error occurs when compiling on Android system.
Closes #14046
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/14046 from thejinchao:main 68d79d01b2
PiperOrigin-RevId: 566773496
1 year ago
Mike Kruskal
b577d8d1b9
Internal changes
...
PiperOrigin-RevId: 566724420
1 year ago
Protobuf Team Bot
ccdc27f8e0
Auto-generate files after cl/566724420
1 year ago