* CMake find_package fixes (#7323)
Rename FlatbuffersConfigVersion.cmake to match CMake project name
* CMake find_package fixes (#7323)
Rename FlatBuffersTargets to match CMake project name
* grpc/compiler: Respect filename suffix and extension during code generation
grpc compiler is not respecting filename suffix and extension passed to
flatc CLI. This causes compiler to spit out incorrect code, which then
cannot be compiled without modification.
Following patch fixes the problem.
Note, I ended up removing some code introduced #6954 ("Have grpc include
file with correct filename-suffix given to flatc") in favour of keeping
sanity of the generator code.
Signed-off-by: Aman Priyadarshi <aman.eureka@gmail.com>
* tests: Add filename-suffix and filename-ext test files
* Test 1: Filename extension changed to "hpp".
* Test 2: Filename suffix changed to "_suffix".
* Test 3: Filename extension changed to "hpp" and suffix changed to "_suffix"
Signed-off-by: Aman Priyadarshi <aman.eureka@gmail.com>
Introduce a MSVC_LIKE variable in the CMake scripts, set that variable to
true only if the compiler is either MSVC or tries to emulate the MSVC
command line, and test that variable when setting compiler arguments.
Tested with cmake .. -G Ninja -DCMAKE_C_COMPILER:PATH="clang-cl.exe" -DCMAKE_CXX_COMPILER:PATH="clang-cl.exe" -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_CPP17=ON
Co-authored-by: Kaiyi Li <kaiyili@google.com>
* Move reflection_ts_fbs into a separate directory (#7342)
Right now, reflection_ts_fbs target is in reflection/BUILD.bazel.
This is not ideal because reflection:reflection_fbs_schema is referenced
from :flatc in the root. Thus, for any Bazel projects that want to
include flatbuffers, they need to include npm / yarn_install and nodejs
support all because reflection/BUILD.bazel loads typescript.bzl and that
requires all TypeScript things.
This PR separated that target into a different subdirectory, freeing
root BUILD.bazel from that dependency.
* Minor improvements to typescript.bzl
* Uses @...// dependencies so that flatbuffers can actually
be used as an external repo (had forgotten to upstream this earlier).
* Allows using flatbuffer_ts_library to generate reflection schemas
in the same way that flatbuffer_cc_library does (but default it
to off to avoid behavioral changes).
* Pass through a package_name attribute to flatbuffer_ts_library to
allow non-relative imports of generated typescript code.
Co-authored-by: Liu Liu <i@liuliu.me>
Presently flatc generates a placeholder for the unused synchronous varient of client-side streaming gRPCs which includes the name of an unused parameter in the method.
To avoid warnings, comment out the parameter name (in a manner similar to other gRPCS).
The logic to manage generating typescript in a single file was
generating self imports and unused local names, which triggered some
linters.
This resolves#7191
There was a step in the compilation process where benchmark data is
downloaded before starting the kotlin compilation process.
Since we are not running benchmark on CI anymore, we remove the
dependency. To run benchmarks the download task needs to be executed
manually.
* Implement optional scalars for JSON
* Add optional scalars JSON test
* Extend JSON optional scalars test to test without defaults
* Fix optional scalars in JSON for binary schema
Co-authored-by: Caleb Zulawski <caleb.zulawski@caci.com>
Right now, reflection_ts_fbs target is in reflection/BUILD.bazel.
This is not ideal because reflection:reflection_fbs_schema is referenced
from :flatc in the root. Thus, for any Bazel projects that want to
include flatbuffers, they need to include npm / yarn_install and nodejs
support all because reflection/BUILD.bazel loads typescript.bzl and that
requires all TypeScript things.
This PR separated that target into a different subdirectory, freeing
root BUILD.bazel from that dependency.
* Implement optional scalars for Python
* Use == for integer comparison, remove empty line
* Fix optional type hint
Co-authored-by: Caleb Zulawski <caleb.zulawski@caci.com>
Fixes#7320.
I realize that Rust doesn't really follow the Namer convention, since
it uses Field case for methods... that's a future problem.
Co-authored-by: Casper Neo <cneo@google.com>
* Add explicit return types to lobster generated code
* Add support for optional fields.
Convert to bool explicitly from int8 to match type signature
Fix whitespace
I think these changes reflect the current state, but I found it hard to
track the state of some of the planned work. Hence why it'd be good to
have it documented :)
I also expanded some sections that I found misleading, as somebody
familiar with Rust and FlatBuffers separately. Parts of these pages seem
to be aimed at people familiar with FlatBuffers (ie via the other
documentation pages) but not each language, which I'm trying to
preserve. However, Rust does some things differently, and as somebody
with expectations about how typical Rust APIs work the discussion of
threading made me wonder what was different.
std::span lacks these; make the flatbuffers STL emulation and tests
match. This fixes a compile error in C++20 mode when using std::span.
Bug: chromium:1284275
* Set an explicit 2018 edition for Rust tests
* Replace all `std` usage with `core` and `alloc` in Rust code generator
* Update the generated files
* Make Rust tests actually use no_std when the corresponding feature is enabled