Commit Graph

2785 Commits

Author SHA1 Message Date
Derek Bailey 359e0f9d66
Revert "grpc/compiler: Respect filename suffix and extension during code generation (#7343)" (#7406)
This reverts commit 97e89c5acd.
2022-08-05 23:20:33 -07:00
Derek Bailey ebbed05137
Delete cpp-linter.yml
Linter was not that useful, so removing it.
2022-08-05 22:56:00 -07:00
Chris Langhans aa395e5a59
(#7323) Rename CMake files according to project name (#7378)
* 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
2022-08-05 22:19:17 -07:00
SF-Zhou 32328075d8
Fix error msg format when generate GRPC failed (#7350) 2022-08-05 22:12:15 -07:00
Aman Priyadarshi 97e89c5acd
grpc/compiler: Respect filename suffix and extension during code generation (#7343)
* 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>
2022-08-05 22:11:45 -07:00
06393993 5f6672be44
Fix Clang-Cl compile on Windows (#7308)
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>
2022-08-05 22:08:36 -07:00
James Kuszmaul 28e858c855
[TS/Bazel] Minor improvements to typescript.bzl (#7300)
* 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>
2022-08-05 22:04:05 -07:00
sssooonnnggg 987bebe678
[TS] fix incorrect reverse when writting array of structs (#7271) 2022-08-05 22:00:16 -07:00
Wouter van Oortmerssen ec0129369c Fix FlexBuffers Verifier tracking vectors reuse at wrong offset
See test for an example.
Found in: https://github.com/aardappel/lobster/pull/193
2022-08-05 10:45:01 -07:00
Atil Kurtulmus 50dd385b30
Add missing const (#7401) 2022-08-05 11:11:00 -04:00
Ivan Shynkarenka da702cfd8f
Compilation issue msys2 (#7403)
* Compilation issue msys2 #7399

* Fix flatbuffers compilation issue
2022-08-05 10:10:58 -04:00
Derek Bailey 6e2791640e
keep-prefix keeps relative pathing (#7394) 2022-07-26 15:11:54 -07:00
godcong 52fce5e532
fix(#7360): grpc used deprecated functions (#7361) 2022-07-26 15:10:13 -07:00
Yasser Shalabi b7f13cd8e8
cpp_generator: comment out unused parameter to avoid warnings (#7381)
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).
2022-07-26 15:05:01 -07:00
Derek Bailey e42985e5aa
Updated Newtonsoft.Json to 13.0.1 (#7393) 2022-07-26 13:22:18 -07:00
Ian Hickson 0a80646371
Fix references to LICENSE file (#7377)
* Fix references to LICENSE file

This was broken by https://github.com/google/flatbuffers/pull/7073

* Update flat_buffers_test.dart
2022-07-07 16:06:19 -07:00
Will Hughes b9eea76a86
[Dart] Implement putBool to fix errors when serializing structs with bools (#7359)
* [Dart] Implement putBool to fix errors when serializing structs with bools

* Add tests
2022-06-28 11:16:47 -04:00
dependabot[bot] 1b90300150
Bump Newtonsoft.Json from 12.0.3 to 13.0.1 in /tests/FlatBuffers.Test (#7363)
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 12.0.3 to 13.0.1.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/12.0.3...13.0.1)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-23 15:03:07 -04:00
Caleb Zulawski 83a43fc797
Reenable optional json (#7352)
* Revert "Revert "Implement optional scalars for JSON (#7322)" (#7351)"

This reverts commit 9a1913a87a.

* Add optional scalars json to bazel

Co-authored-by: Caleb Zulawski <caleb.zulawski@caci.com>
2022-06-16 09:26:44 -07:00
Derek Bailey 5f01376027
Only include direct included filed (#7348) 2022-06-15 12:10:39 -07:00
Derek Bailey 9a1913a87a
Revert "Implement optional scalars for JSON (#7322)" (#7351)
This reverts commit a18ea40d6a.
2022-06-15 00:32:28 -07:00
Derek Bailey b4647beb8f
Revert "Move reflection_ts_fbs into a separate directory (#7342)" (#7349)
This reverts commit 090caa2809.
2022-06-14 20:58:00 -07:00
Derek Bailey d6060977ad Remove asserting in verifier for flattests 2022-06-14 20:53:28 -07:00
Derek Bailey 987aa5b5ee move -Wextra-semi to GCC 8.0+ 2022-06-14 16:32:10 -07:00
James Kuszmaul 42acdb63c3
[TS] Don't generate self-imports with --ts-flat-file (#7340)
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
2022-06-14 15:51:12 -07:00
Timo Sturm 0cc1aeb8ca
[golang] Create missing namespace directory structure (#7324) (#7325) 2022-06-14 15:50:05 -07:00
Paulo Pinheiro ba6c671705
[Kotlin] Remove download benchmark files dependency (#7314)
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.
2022-06-14 15:49:42 -07:00
Derek Bailey d2f33fc454
Disable Android on Linux CI build 2022-06-14 15:46:48 -07:00
sssooonnnggg 0d1b72cbc2
[TS] fix ts import path issue (#7298) 2022-06-14 15:25:35 -07:00
Koya IWAMURA 9fce2fbf2a
replace io/ioutil to os (#7281) 2022-06-14 15:10:57 -07:00
Caleb Zulawski a18ea40d6a
Implement optional scalars for JSON (#7322)
* 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>
2022-06-14 18:00:24 -04:00
Liu Liu 090caa2809
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.
2022-06-13 09:36:52 -04:00
Caleb Zulawski 49e1ea3335
Implement optional scalars for Python (#7318)
* 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>
2022-06-13 09:16:00 -04:00
mustiikhalil 11a1988705
Started implementation for private flags in rust (#7269)
Adds flag to the cpp to fix bad annotations in all the languages

Addresses comments to the PR, and fixes logic for leaking annotations
2022-06-05 23:04:05 +02:00
mustiikhalil 967df08b1d
Adds full supposed for Wasm in the swift lib (#7328)
Adds tests for wasm module & github action
2022-05-29 20:56:33 +02:00
Casper 9aa08a429e
Use keep case for Rust union discriminant type. (#7321)
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>
2022-05-23 15:53:00 -04:00
Bart van der Werf 9e8c758f54
Add explicit return types to lobster generated code (#7312)
* 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
2022-05-23 10:50:01 -07:00
Björn Harrtell 74a25536be
Add size check to fix out of bounds read risk (#7304) 2022-05-13 15:15:00 -07:00
Brian Silverman 12917af8a2
Update Rust docs page (#7296)
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.
2022-05-12 10:02:14 -07:00
mr-swifter 1ea2472f7a
[swift] add had<ArrayName> property for arrays to check presence in a message (#7280) 2022-05-11 15:35:53 +02:00
pkasting 0fe13cb28c
Remove span ConstIterator/cbegin()/cend(). (#7295)
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
2022-05-10 13:53:38 -07:00
Casper 385dddc66a
Namerkot (#7245)
* Namer for Kotlin

* delete unread cur_name_space_ and apply Namer to filename

Co-authored-by: Casper Neo <cneo@google.com>
2022-04-26 21:54:49 -04:00
Bogdan Opanchuk 750dde7669
Make `flatc` generate Rust files not requiring `std` (#7273)
* 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
2022-04-26 21:40:03 -04:00
Keith Smiley 9917a168cd
[swift] Make swift module public (#7274) 2022-04-26 18:58:51 +02:00
Bogdan Opanchuk 76d3cca19c
Rust: fix a name conflict when building with "no_std" feature (#7268)
* Fix a name conflict when building with "no_std" feature

* Bump patch version
2022-04-25 13:09:41 -04:00
Derek Bailey c86e6d0e30 json inf parsing 2022-04-22 12:24:26 -07:00
Derek Bailey d34dc32c20 fix include order 2022-04-22 11:19:04 -07:00
Derek Bailey 234d86c92a fixed off-by-one in parser 2022-04-21 21:22:20 -07:00
Derek Bailey 746c73b910 Add Annotations for Monster schema and example buffer 2022-04-21 20:43:55 -07:00
Derek Bailey 0bbfd4b2e3 fixes for annotator 2022-04-21 11:46:16 -07:00