Swift importing ObjC drops methods/properties if the type is only a forward
declaration since the type is incomplete. Historically the generator has always
use forward declarations to reduce how much will have rebuild when a proto file
does change; but that puts it at odds with Swift. If ObjC Protos end up spanning
Swift modules, the Swift import behavior could become a problem; so this option
provides a control for the behavior. The current behavior is to continue forward
declarations, but eventually the default will be changed.
Generate the WKTs using imports instead of forward decls.
Fix a few issues with the Emacs mode definition.
First, in 1ab7789f3 (2021-10-13, Emacs: Protobuf mode should be derived from
prog-mode) we made `protobuf-mode' a derived mode of `prog-mode' using the
`define-derived-mode' macro[1]. However, the definition body was not updated
accordingly. So in this commit, we:
- Remove the superfluous `(interactive)' form;
- Remove the unnecessary call of `kill-all-local-variables', which is already
handled by `define-derived-mode' and could cause a few issues, for example,
it prevents `prog-mode-hook' from being run;
- Remove forms that set `major-mode' and `mode-name', which are automatically
set to the first and third arguments respectively;
- Remove forms that set key map, syntax table, and abbrev table, which are
already handled automatically;
- Do not run `protobuf-mode-hook' explicitly in the body. It is already arranged
to be run after the body.
Second, the call to `c-make-emacs-variables-local' is removed. It is called
inside `c-init-language-vars' already. Calling it again should do no harm now,
but to be future-proof it might be better to just remove it.
Finally, we move the `c-update-modeline' form to the :after-hook argument to
ensure it is run at the very end, so that the mode line will reflect all user
customizations done in various mode hooks. Similarly, we run
`c-mode-common-hook' also at the very end to leave a place for user
customizations (for example, set `imenu-generic-expression' in
`c-mode-common-hook').
[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Derived-Modes.html
Re: https://github.com/protocolbuffers/protobuf/issues/7316
Re: https://github.com/protocolbuffers/protobuf/pull/9076
Overdue followup to https://github.com/protocolbuffers/protobuf/pull/7173
Since all the files are at the same level as the runtime headers, there is no
need for things to be framework based imports, they should all just work like
the other headers do.
- Directly generate the bundled header imports into the preamble section when
generating for a bundled proto.
- Update the preamble generation to skip the CPP wrapper when generating for a
bundled proto file.
- Regenerate the WKTs.
- Update GPBProtocolBuffer.h/GPBWellKnownTypes.h to also skip the CPP wrapping.
GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS in the podspec and non bundled files still
has to exist because that comes into play for those files to find the runtime
headers.
This version defaults all the options, so folks don't have to pass it.
Since Options never had a PROTOC_EXPORT, it isn't immediately clear how well the
existing api worked for any shared lib cases, so this should give a simpler api
for the basic usage (if anyone wants to use it).
The other generation options never were in the Options structure and
ImportWriter was the only thing that needed some the non validation options and
it already required directly passing the options. So refine Options to just be
validation options and bundle all the File related generation options into
a new FileGenerator specific GenerationOptions.
This PR tells git to ignore ephemeral files that are created when
developers use clangd.
clangd needs a `compile_commands.json` file at the root of the repo (or
in a `build/` directory) to tell it how to compile each file. CMake can
generate this file with something like the following:
```console
$ cmake -Scmake -B.build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-Dprotobuf_BUILD_TESTS=OFF
$ ln -sf .build/compile_commands.json .
```
Then clangd will compile and index files into the `.cache` directory.
Two small fixes to update_version.py:
- The regex for updating SOVERSION in cmake files was not quite right. I
fixed it to reflect that the value is a plain integer and not of the
form x.y.z
- For some reason the code for updating PHP_PROTO_VERSION appeared 3
times and led to a spurious warning, so I removed the extra calls
there.
Now that two files use the format, tweak the naming to the format for the file
vs. the usage(s).
Also add a "usage" param so the two places can provide a little context for any
error messages generated while parsing.
Soname was set for libprotobuf.so in commit a9cf69a0ed,
but similar changes for libprotobuf-lite.so and libprotoc.so were missed.
Fixes: #8635
Co-authored-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@GMail.Com>