Commit Graph

2853 Commits

Author SHA1 Message Date
sssooonnnggg 4be605604e
[C++] Set StructDef::has_key property when deserializing from binary schema (#7386) (#7428) 2022-08-12 09:27:17 -07:00
Marcel Krüger fc5d86f1e7
[C++] Make template parameter in stl_emulation.h more explicit to avoid conflicts with cpprestsdk U macro (#7424)
* [C++] Rename template parameter U in make_span of stl_emulation.h

CPPRESTSDK defines a U macro therefore, calls to U() are problematic.
Rename U to W to avoid conflict.

* [C++] Make typenames of span_convertable and make_span more expressive

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-08-10 13:22:08 -07:00
Yashasvi Chaurasia 9dce287adb
Issue#6959 :Updated Automatically generated rust files. (#7425)
* test

* only rust files

* updated idl_gen_rust.cpp
2022-08-10 09:15:35 -04:00
sssooonnnggg 7798be3bb6
avoid zero-as-null-pointer warning (#7423)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-08-08 21:32:13 -07:00
Derek Bailey 966362e074
[C++] Vector of Tables equality (#7415)
* Vector of Tables equality

* support nullptr and fix for not being able to use auto in lambda

* use different std::equal overload

* use flatbuffers::unique_ptr

* go back to auto and clang-format fix
2022-08-08 21:22:57 -07:00
Andrei Burdulescu a89c279ed6
[golang] Perform keyword escaping after case conversion (#7421)
Change config.escape_keywords to AfterConvertingCase.

It avoids unecessay escaping since the generated native
structs have fields starting with a uppercase letter
and Go's keywords start with lowercase letters.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-08-08 20:46:35 -07:00
Derek Bailey a212b3c036
Turn of fail fast for C++ CI
Prevent failing fast if one of the two c++ compilers fail
2022-08-08 19:12:18 -07:00
Derek Bailey 9230f600d7
Remove stringop-overflow from error (#7422) 2022-08-08 19:08:32 -07:00
Andrei Burdulescu c793621567
[golang] Add support for text parsing with json struct tags (#7353)
* [golang] Add support for text parsing with json struct tags

Add struct tags to Go native structs generated when object API is used.

This allows to use the same JSON file as for C++ text
parsing(i.e. snake_case vs CamelCase) and thus enabling text parsing
for Go(when using object API).

* [golang] Add test for text parsing

Added small test to check and demonstrate text parsing in Go.
Also, ran clang-format on cpp file changes.
2022-08-08 11:30:06 -07:00
Derek Bailey ee2ced236d
Moved TypeScriptTests to python script (#7411)
* Moved TypeScriptTests to python script

* fixed CI issue with out-dated generated file

* Build flatc for TS CI

* reverting yarn.lock
2022-08-07 11:42:02 -07:00
Aman Priyadarshi 468c00a3fe
Rebased: grpc/compiler: Respect filename suffix and extension during code generation (#7414)
* 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-07 11:32:53 -07:00
Derek Bailey 47c757f714
Add tests for flatc (#7405) 2022-08-06 21:11:03 -07:00
Derek Bailey 9a5ff89003
Add FLATBUFFERS_STRICT_MODE (#7408) 2022-08-06 21:06:14 -07:00
Björn Harrtell 950444a343
[TS] Use TextEncoder and TextDecoder (#7400)
* [TS] Use TextEncoder

TextEncoder is well supported these days, see https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#browser_compatibility.

* Reuse instance

* Also use TextDecoder

* Forgot to add text_decoder_ member

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-08-06 22:00:30 +00:00
Ivan Shynkarenka 30d76198c7
Compilation issue msys2 #7399 (#7409)
* Compilation issue msys2 #7399

* Compilation issue msys2 #7399
2022-08-06 14:56:22 -07:00
Derek Bailey cce3a66f0d
Delete .travis directory
We don't use travis anymore.
2022-08-06 12:30:13 -07:00
Derek Bailey 8d1cc6ac7d
Revert "Compilation issue msys2 (#7403)" (#7407)
This reverts commit da702cfd8f.
2022-08-06 10:19:50 -07:00
Derek Bailey 5b207639a1
Update readme.md
Add scorecard badge via: https://github.com/ossf/scorecard-action#view-results
2022-08-05 23:41:06 -07:00
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