summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2023-05-26FlatBuffers Version 23.5.26 (#7976)Derek Bailey4-4/+4
2023-05-17don't emit flatbuffers include in bfbs generated output (#7968)Derek Bailey1-4/+2
2023-05-17Fix python tests (#7960)Chih-Hsuan Yen1-6/+11
* Don't generate types unless --python-typing specified Fixes https://github.com/google/flatbuffers/issues/7944 * Fix incorrect import statements Fixes https://github.com/google/flatbuffers/issues/7951 * Fix $PYTHONPATH in PythonTest.sh Regressed from https://github.com/google/flatbuffers/pull/7529 * PythonTest: fail if something goes wrong GitHub Actions runs `bash PythonTest.sh`, and thus failures were not visible. * Build flatc for Python tests * Regenerate codes --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-05-17fix(rust): fixed rust namer isses, resolve #7865 and ##7782 (#7964)sssooonnnggg1-1/+2
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-05-15feat: Support union underlying type for TS/JS (#7961)sssooonnnggg2-6/+23
2023-05-14feat(C++): Support underlying_type for union (#7954)sssooonnnggg2-17/+51
* feat(C++): support underlying type for union * chore: add conform checks for underlying type changes
2023-05-12fix(TS): fixed incorrect function name when importing unionTo functions (#7958)sssooonnnggg1-2/+2
2023-05-11Rename GenerateTextWouter van Oortmerssen1-10/+8
to make it a compile-time breaking change, to alert any users to the new meaning of the return value
2023-05-11run `scripts/clang-format-all.sh`Derek Bailey6-48/+61
2023-05-09fixed bfbs gen to pass extra options (#7949)Derek Bailey20-299/+354
2023-05-09removed extern code generation declarations preferring direct includes (#7948)Derek Bailey21-951/+95
* removed extern code generation definitions, preferring direct includes * add static to functions * remove idl_gen_lua
2023-05-09fix --conform raising `No generators registered` errorDerek Bailey1-1/+1
2023-05-09FlatBuffers Version 23.5.9 (#7945)Derek Bailey4-4/+4
2023-05-09FlatBuffers 64 for C++ (#7935)Derek Bailey7-186/+508
* First working hack of adding 64-bit. Don't judge :) * Made vector_downward work on 64 bit types * vector_downward uses size_t, added offset64 to reflection * cleaned up adding offset64 in parser * Add C++ testing skeleton for 64-bit * working test for CreateVector64 * working >2 GiB buffers * support for large strings * simplified CreateString<> to just provide the offset type * generalize CreateVector template * update test_64.afb due to upstream format change * Added Vector64 type, which is just an alias for vector ATM * Switch to Offset64 for Vector64 * Update for reflection bfbs output change * Starting to add support for vector64 type in C++ * made a generic CreateVector that can handle different offsets and vector types * Support for 32-vector with 64-addressing * Vector64 basic builder + tests working * basic support for json vector64 support * renamed fields in test_64bit.fbs to better reflect their use * working C++ vector64 builder * Apply --annotate-sparse-vector to 64-bit tests * Enable Vector64 for --annotate-sparse-vectors * Merged from upstream * Add `near_string` field for testing 32-bit offsets alongside * keep track of where the 32-bit and 64-bit regions are for flatbufferbuilder * move template<> outside class body for GCC * update run.sh to build and run tests * basic assertion for adding 64-bit offset at the wrong time * started to separate `FlatBufferBuilder` into two classes, 1 64-bit aware, the other not * add test for nested flatbuffer vector64, fix bug in alignment of big vectors * fixed CreateDirect method by iterating by Offset64 first * internal refactoring of flatbufferbuilder * block not supported languages in the parser from using 64-bit * evolution tests for adding a vector64 field * conformity tests for adding/removing offset64 attributes * ensure test is for a big buffer * add parser error tests for `offset64` and `vector64` attributes * add missing static that GCC only complains about * remove stdint-uintn.h header that gets automatically added * move 64-bit CalculateOffset internal * fixed return size of EndVector * various fixes on windows * add SizeT to vector_downward * minimze range of size changes in vector and builder * reworked how tracking if 64-offsets are added * Add ReturnT to EndVector * small cleanups * remove need for second Array definition * combine IndirectHelpers into one definition * started support for vector of struct * Support for 32/64-vectors of structs + Offset64 * small cleanups * add verification for vector64 * add sized prefix for 64-bit buffers * add fuzzer for 64-bit * add example of adding many vectors using a wrapper table * run the new -bfbs-gen-embed logic on the 64-bit tests * remove run.sh and fix cmakelist issue * fixed bazel rules * fixed some PR comments * add 64-bit tests to cmakelist
2023-05-09FlatBuffers Version 23.5.8 (#7943)RishabhDeep Singh4-4/+4
2023-05-04Add binary schema reflection (#7932)Derek Bailey1-0/+22
* Add binary schema reflection * remove not-used parameter * move logic from object API to base API * forward declare * remove duplicate code gen that was stompping on the edits * reduce to just typedef generation * fixed bazel rules to not stomp * more bazel fixes to support additional generated files
2023-05-03Fix missing return error string for GenerateTextWouter van Oortmerssen1-1/+1
2023-05-03GenerateText gives text error on failureWouter van Oortmerssen2-70/+77
2023-05-03Migrate from rules_nodejs to rules_js/rules_ts (take 2) (#7928)Philipp Schrader1-0/+11
* Migrate from rules_nodejs to rules_js/rules_ts (take 2) This is the second version of patch #7923. The first version got reverted because bazel query was failing: $ bazel --nosystem_rc --nohome_rc query tests(set('//...')) except tests(attr("tags", "manual", set('//...'))) ERROR: Traceback (most recent call last): File "/workdir/tests/ts/bazel_repository_test_dir/BUILD", line 6, column 22, in <toplevel> npm_link_all_packages(name = "node_modules") File "/var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/external/npm/defs.bzl", line 188, column 13, in npm_link_all_packages fail(msg) Error in fail: The npm_link_all_packages() macro loaded from @npm//:defs.bzl and called in bazel package 'tests/ts/bazel_repository_test_dir' may only be called in bazel packages that correspond to the pnpm root package '' and pnpm workspace projects '' This was happening because the `.bazelrc` file only added `--deleted_packages` to the `build` command. We also need it for the `query` command. This second version of the patch fixes that. Original commit message: This patch migrates the current use of rules_nodejs to the new rules_js. rules_js is the intended replacement of rules_nodejs as per this note: https://github.com/aspect-build/rules_js#relationship-to-rules_nodejs > rules_js is an alternative to the build_bazel_rules_nodejs Bazel module > and accompanying npm packages hosted in > https://github.com/bazelbuild/rules_nodejs, which is now > unmaintained. All users are recommended to use rules_js instead. There are a few notable changes in this patch: 1. The `flatbuffer_ts_library` macro no longer accepts a `package_name` attribute. This is because rules_js appears to manage the import naming of dependencies via top-level `npm_link_package` targets. Users will have to migrate. 2. I added a few more arguments to `flatbuffer_library_public()`. These helped with exposing esbuild to `ts/compile_flat_file.sh`. 3. I pinned the version of `typescript` in `package.json` so that rules_ts can download the exact same version. rules_ts doesn't know what to do if the version isn't exact. 4. Since rules_js uses the pnpm locking mechanism, we now have a `pnpm-lock.yaml` file instead of a yarn lock file. 4. I added bazel targets for a few of the existing tests in `tests/ts`. They can be run with `bazel test //test/ts:all`. Since there is no flexbuffers bazel target, I did not add a bazel target for the corresponding test. 5. I added a separate workspace in `tests/ts/bazel_repository_test_dir/` to validate that the flatbuffers code can be imported as an external repository. You can run the test with `bazel test //test/ts:bazel_repository_test`. For this to work, I needed to expose a non-trivial chunk of the flatbuffers code to the test. I achieved this through some recursive `distribution` filegroups. This is inspired by rules_python's workspace tests. I did not do anything special to validate that the `gen_reflections` parameter works the same. This patch doesn't change anything about the TypeScript generation. As a side note: I am not an expert with rules_js. This patch is my attempt based on my limited understanding of the rule set. Fixes #7817 * Fix the query --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-05-02fix possible null dereference for nested_root accessorDerek Bailey1-20/+24
2023-04-29more window fixesDerek Bailey3-6/+8
2023-04-28fixed some windows warnings (#7929)Derek Bailey1-12/+13
2023-04-28inject no long for FBS generation to remove logs in flattests (#7926)Derek Bailey3-30/+72
* inject no long for FBS generation to remove logs in flattests * updated blaze rules
2023-04-28Revert "Migrate from rules_nodejs to rules_js/rules_ts (#7923)" (#7927)Derek Bailey1-11/+0
This reverts commit 4172c3f0bd6a62cd29ef160f9236352466b634ca.
2023-04-28Migrate from rules_nodejs to rules_js/rules_ts (#7923)Philipp Schrader1-0/+11
* Start using pnpm * Add @npm * get more stuff set up * Get the analysis phase passing. * Get esbuild working? * Get it compiling? $ bazel build //tests/ts/... * Try to get the test working * test is passing * Get the other tests working * clarify comment * clean up a bit * Try to add another test * Add another test * clean up more * remove unused reference * Add e2e test * Get more of the test working * add lock file * Get test working on its own * Get e2e test passing * fix infinite recursion * Add comments * clean up some more * clean up more again * Source typescript version from package.json * run buildifier * lint * Fix unset `extra_env` * Incorporate feedback * run buildifier --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-28Only generate @kotlin.ExperimentalUnsigned annotation on create*Vector ↵Aaron Riekenberg1-2/+3
methods having an unsigned array type parameter. (#7881) Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-28Optionally generate Python type annotations (#7858)Max Burke2-78/+296
* optionally generate type prefixes and suffixes for python code * fix codegen error when qualified name is empty * WIP: Python typing * more progress towards python typing * Further iterate on Python generated code typing * clang-format * Regenerate code * add documentation for Python type annotations option * generate code with Python type annotations * handle forward references * clang-format
2023-04-26Make JSON supporting advanced union features (#7869)Adam Oleksy1-1/+2
This change allows user to decode binary with given schema to JSON representation when schema defines union with struct. Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-26Go: make generated code more compliant to "go fmt" (#7907)Jeroen Demeyer1-16/+17
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-26Support file_identifier in Go (#7904)Jeroen Demeyer1-0/+28
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-25Optionally generate type prefixes and suffixes for python code (#7857)Max Burke2-30/+47
* optionally generate type prefixes and suffixes for python code * fix codegen error when qualified name is empty * generated code updated
2023-04-06Add a FileWriter interface (#7821)Khanh Nguyen5-0/+153
* Add a FileWriter interface * Change interface * Provide 2 impl for File interface: FileManager & FileNameManager * Update * update * Update * Add file_writer file * Update * Format files * Update based on review * Update * Format bzl file * Add LoadFile function * Format --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-06TS/JS: Use minvalue from enum if not found (#7888)Björn Harrtell1-8/+7
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-04-06[CS] Verifier (#7850)tira-misu1-0/+244
* Fix C/C++ Create<Type>Direct with sorted vectors If a struct has a key the vector has to be sorted. To sort the vector you can't use "const". * Changes due to code review * Improve code readability * Add generate of JSON schema to string to lib * option indent_step is supported * Remove unused variables * Fix break in test * Fix style to be consistent with rest of the code * [TS] Fix reserved words as arguments (#6955) * [TS] Fix generation of reserved words in object api (#7106) * [TS] Fix generation of object api * [TS] Fix MakeCamel -> ConvertCase * [C#] Fix collision of field name and type name * [TS] Add test for struct of struct of struct * Update generated files * Add missing files * [TS] Fix query of null/undefined fields in object api * Add .Net verfier * Add some fuzz tests for .Net * Remove additional files * Fix .net test * Changes due to PR * Fix generated files --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-27use Bool for flatbuffers bool instead of Byte (#7876)blindspotbounty1-3/+3
Add test for Bool type in swift Co-authored-by: mustiikhalil <26250654+mustiikhalil@users.noreply.github.com>
2023-03-15ToCamelCase() when kLowerCamel now converts first char to lower. (#7838)Paulo Pinheiro2-5/+12
ToCamelCase(input, true) converts first char to upper case, but ToCamelCase(input, false) keeps the case of the first char. We are changing its behavior to force a lower case. Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-09Fix help output for --java-checkerframework (#7854)Ben Beasley1-1/+1
2023-03-03FlatBuffers Version 23.3.3 (#7852)Derek Bailey4-4/+4
2023-03-02TS/JS: Export object based classes on entry (#7822)José Luis Millán1-2/+8
* TS/JS: Export object based classes on entry Along with the non object ones, for consistency. This is a regression introduced recently. Before: `export { UpdateSettingsRequest } from './worker/update-settings-request.js';` Now: `export { UpdateSettingsRequest, UpdateSettingsRequestT } from './worker/update-settings-request.js';` * only export object based classes for structs Enums are not elegible. --------- Co-authored-by: Björn Harrtell <bjornharrtell@users.noreply.github.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-02Add a --java-package-prefix option to flatc (#7848)Chuck Atkins2-19/+58
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-02[CS] Naming collision if field has same name as table and used as key (#7842)tira-misu1-4/+6
* Fix C/C++ Create<Type>Direct with sorted vectors If a struct has a key the vector has to be sorted. To sort the vector you can't use "const". * Changes due to code review * Improve code readability * Add generate of JSON schema to string to lib * option indent_step is supported * Remove unused variables * Fix break in test * Fix style to be consistent with rest of the code * [TS] Fix reserved words as arguments (#6955) * [TS] Fix generation of reserved words in object api (#7106) * [TS] Fix generation of object api * [TS] Fix MakeCamel -> ConvertCase * [C#] Fix collision of field name and type name * [TS] Add test for struct of struct of struct * Update generated files * Add missing files * [TS] Fix query of null/undefined fields in object api * Fix collision if field name is equal to table name and used as key in an array --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-02Add Code Generator for idl_gen_fbs to parse .proto files (#7832)Khanh Nguyen5-16/+112
* Add code generator for proto files * Update * Add --proto to script * Remove cmt * Move proto parsing logic into else block to share same set up logic for code_generator * Remove IsValidCodeGenerator
2023-02-17Move defined part to idl.h (#7823)Saman1-10/+1
2023-02-06fixed bad math for --annotate-sparse-vectorsDerek Bailey1-4/+4
2023-02-06[Annotated Buffers] Improve efficiency (#7820)Derek Bailey3-83/+105
* AnnotatedBinaryTextGen switch to ofstream instead of building giant string * Add --annotate-sparse-vectors to reduce AFB size
2023-02-05use switch statements for BASE_TYPE_ lookups (#7813)Derek Bailey3-44/+34
2023-02-03explicitly declare enum values (#7811)Derek Bailey1-1/+1
2023-02-02Fixed vtable duplication for binary annotator (#7809)Derek Bailey3-44/+69
2023-02-01Parsing from proto should keep field ID. (fixes #7645) (#7655)Saman3-18/+299
* Parsing from proto should keep field ID. (fixes #7645) * Fix failed tests * Fix windows warning * Improve attribute generation in proto to fbs * Check if id is used twice. fix Some clang-format problems * Test if fake id can solve the test problem * Validate proto file in proto -> fbs generation. * Fix error messages * Ignore id in union * Add keep proto id for legacy and check gap flag have been added. Reserved id will be checked. * Add needed flags * unit tests * fix fromat problem. fix comments and error messages. * clear * More unit tests * Fix windows build * Fix include problems * Fake commit to invoke rebuild * Fix buzel build * Fix some issues * Fix comments, fix return value and sort for android NDK * Fix return type * Break down big function * Place todo --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-01-31Final refactor for bfsb_generator* and text generator (#7806)Khanh Nguyen25-166/+370
* Refactor BfbsGenerator to use CodeGenerator interface * Update * Refactor bfbs generator * Refactor bfbs generator for lua and nim. Remove old code that use Generator interface. * Update import * Update CMakeLists * Update BUILD file * Update BUILD file for src * Remove from Android CMakeLists and add error message * Update * Add generate root file function to Code Generator interface * Update * Update * Minor format fix