3123 Commits

Author SHA1 Message Date
Derek Bailey
a2cd1ea3b6
FlatBuffers Version 24.12.23 (#8459)
* FlatBuffers Release 24.12.23

* Fixed missing generated file version checks

* Run generate_code and fix cpp17 tests
v24.12.23
2024-12-23 12:55:07 -08:00
Derek Bailey
32e63af684
Kotlin MacOs switch to macos-13
Switch off of macos-latest which no longer has the 14.3 xcode installed. Version macos-13 does.

We should probably update our kotlin though.
2024-12-23 09:10:46 -08:00
mustiikhalil
1f4a9038ce
[Swift] Improves vectors performance & arrays within lib (#8415)
* Improves vectors performance and adds a benchmark to vectors of offsets in swift

Improves performance for all arrays and for loops

Uses a tuple instead of allocating a struct each time we start iterating over fieldloc

Updates benchmark library

* Fixing swift Wasm ci
2024-11-19 07:02:47 +01:00
Ivan Dlugos
a9df44828d
dart: use enhanced enums (#8313)
* dart: rename enums.fbs

* feat: use dart enhanced enums

* generate code

---------

Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
2024-11-18 17:31:19 +00:00
Cameron Mulhern
5f453ef738
Removes 'size' and 'alignment' as Rust keywords (#8139)
* Adds fields for possibly reserved words to rust_namer_test

* Removes size and alignment as rust reserved words
2024-11-12 05:13:02 +00:00
Benjamin Kietzman
49061f8c7c
use ALIGN for Push::alignment in struct types (#8398)
* use ALIGN for Push::alignment in struct types

* regenerate and add a test for struct alignment
2024-10-28 08:42:55 -07:00
Wouter van Oortmerssen
807adb73b2
FlexBuffers: support "natural utf8" output in ToString (#8426) 2024-10-12 14:34:06 -07:00
Mikhail
2f59a0319b
Update grpc-core version (#8412)
* Update grpc-core version

io.grpc:grpc-core package in version 1.36.0 contains multiple [CVE's](https://mvnrepository.com/artifact/io.grpc/grpc-core/1.36.0).
Bump grpc-core version to latest 1.68.0 version to mitigate potential vulnerabilities.

* Update grpc version to 1.67.1

grpc was mistakenly released to maven under version 1.68.0 whenever a real release was done for version 1.67.1 [1]. The mistake was fixed later.

[1] https://github.com/grpc/grpc-java/releases
2024-10-05 18:24:05 -07:00
mustiikhalil
6a8898573c
[Swift] Updates CocoaPods author info & fixes bug with versioning not working as expected (#8328)
* Fix versioning not being able to parse vX.Y.Z and updates author

* Adds BUILD_LIBRARY_FOR_DISTRIBUTION flag for cocoapods
2024-10-05 00:17:05 +02:00
mustiikhalil
d7a70db6ac
(fix): #8408 fixes a bug where the capacity of the buffer isnt verified before trying to verify the ID (#8413) 2024-10-05 00:16:41 +02:00
mustiikhalil
b127c57ff0
Fixes spelling mistake in the word position (#8330) 2024-10-05 00:16:28 +02:00
Wouter van Oortmerssen
2436bd8175
Attempt to fix Rust CI (#8411)
by undoing what appears to have broken it: https://github.com/google/flatbuffers/pull/8372
2024-09-30 09:39:38 -07:00
Wouter van Oortmerssen
69a53e495d
Use actions/upload-artifact@v4 on CI (#8410) 2024-09-27 15:39:44 -07:00
Ikko Eltociear Ashimine
c7a8102b12
docs: update README.md (#8383)
compliation -> compilation
2024-09-05 18:50:35 -07:00
Mikhail
2146bacd2e
Update libs.versions.toml (#8387)
Fix CVE-2022-25647

The package com.google.code.gson:gson before 2.8.9 is vulnerable to Deserialization of Untrusted Data via the writeReplace() method in internal classes, which may lead to denial of service attacks.

Bump up version of the gson package.

https://github.com/advisories/GHSA-4jrv-ppp4-jm57
2024-09-06 01:26:51 +00:00
nolen777
8db59321d9
Add a unit test for odd-sized small structs (for #8117) (#8363)
* add an odd sized test

* formatting

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-08-20 00:27:32 -04:00
pkasting
42879f6ea6
[jumbo] Add begin()/end() to DetachedBuffer. (#8370)
This allows this type to meet the requirements of e.g.
std::ranges::range, which is necessary for it to work with the
std::span range constructor, or the "non-legacy" constructor for
Chromium's base::span.

Bug: none

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-08-20 04:12:35 +00:00
Gunnar Schulze
7833affd7e
Upgrade Rust dependencies (#8372)
* [Rust] Upgrade bitflags to version 2.6.0

* [Rust] Upgrade num_enum to version 0.7.3

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-08-20 04:04:09 +00:00
LamTrinh.Dev
c065e972db
Remove unused comment and fix typo. (#8366)
* Update NativeObject.swift

Correct the word.

* Update ByteBuffer.swift

Type parameter does not existing, remove it.

* Update ByteBuffer.swift

Correct the word.
2024-08-19 23:22:00 -04:00
alphalex-google
06b12d55ea
Add "empty()" to vector (#8369)
This is just another `std`-ism that is being added.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-08-19 20:22:30 -04:00
Marcin Lewandowski
baddf90599
Add parentheses in FLATBUFFERS_MAX_BUFFER_SIZE, FLATBUFFERS_MAX_64_BUFFER_SIZE to avoid preprocessor definition collision (#8377)
In case when flatbuffers are being used along with other project that defines "max" preprocessor macro, the ::max() in FLATBUFFERS_MAX_BUFFER_SIZE and FLATBUFFERS_MAX_64_BUFFER_SIZE is incorrectly being expanded to the macro. Adding parentheses enforces function-like interpretation.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-08-19 19:51:15 -04:00
Derek Bailey
8b35a6bc32 Bazel: Just target flatc and flatbuffers_test for presubmit 2024-08-19 16:42:51 -07:00
Derek Bailey
6cb4d671a8 Fixes LICENSE file in python
Fixes: #8376
2024-08-19 16:09:27 -07:00
Anton Bobukh
fb9afbafc7
[gRPC] Update the code generator for Python to produce typed handlers (#8326)
* Move `namer.h` and `idl_namer.h` to `include/codegen` so they can be reused from `grpc` dirqectory.

* [gRPC] Update the Python generator to produce typed handlers and Python stubs if requested.

* [gRPC] Document the newly added compiler flags.
2024-06-18 16:02:57 -07:00
Felix
dafd2f1f29
[Python] Render enums as Python IntEnum (#8145)
This allows enums to be type check with mypy.
They will still behave like ints ->
> IntEnum is the same as Enum,
> but its members are also integers and can be used anywhere
> that an integer can be used.
> If any integer operation is performed with an IntEnum member,
> the resulting value loses its enumeration status.
https://docs.python.org/3/library/enum.html#enum.IntEnum

Only if the --python-typing flag is set.
2024-06-03 08:39:14 -07:00
Anton Bobukh
6ede1ccc9e
[BinaryAnnotator] Add more options that control the generation of .afb files (#8323)
* [BinaryAnnotator] Add more options that control the generation of `.afb` files.

* [BinaryAnnotator] Update the include paths.
2024-05-29 13:34:38 -07:00
Anton Bobukh
8755c35a18
[C++] Update the validator to skip structs in namespaces other than the current one. (#8324)
* [Python] Generate `.pyi` stub files when `--python-typing` is on.

To support this change, the following modifications were made:

-  added a new option to disable `numpy` helpers generation;
-  added a new flag to control the target Python version:

   `--python-version` can be one of the following:

   - `0.x.x` – compatible with any Python version;
   - `2.x.x` – compatible with Python 2;
   - `3.x.x` – compatible with Python 3.
-  added codegen utilities for Python;
-  added a note that the generated .py file is empty.

* [C++] Update the validator to skip structs in namespaces other than the current one.
2024-05-29 13:16:37 -07:00
mustiikhalil
75f05d6389
Sets Swift minimum version to 5.8 (#8228)
Updates copyright from 2023 to 2024 & formats code - updates formatting rules

Updates CI to run with swift 5.8

Adds wasmer & updates command to run carton as a swift plugin

Update bazelci to also accept swift 5.8

Adds swift 5.10 to the test matrix
2024-05-29 13:07:54 -07:00
Anton Bobukh
3b27f5396e
[Python] Generate .pyi stub files when --python-typing is on. (#8312)
* [Python] Generate `.pyi` stub files when `--python-typing` is on.

To support this change, the following modifications were made:

-  added a new option to disable `numpy` helpers generation;
-  added a new flag to control the target Python version:

   `--python-version` can be one of the following:

   - `0.x.x` – compatible with any Python version;
   - `2.x.x` – compatible with Python 2;
   - `3.x.x` – compatible with Python 3.
-  added codegen utilities for Python;
-  added a note that the generated .py file is empty.

* [Python] Update Bazel build rules.

* [Python] Update Bazel build rules.

* [Python] Run buildifier on BUILD.bazel files.

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 12:47:29 -07:00
Dominik Lohmann
58c8eb5847
[C++] Allow using FLATBUFFERS_MIN_BUFFER_SIZE in other namespaces (#8229)
This is a small change that makes `FLATBUFFERS_MIN_BUFFER_SIZE` usable
outside of the `flatbuffers` namespace.
2024-05-29 03:59:03 +00:00
Felix
0e034ecdba
[C++] Make code compile with -Wfloat-equal (#8221)
This will allow the code to be compiled with `-Wfloat-equal`
as this would result in the folowing warning/error:
vendor/flatbuffers/include/flatbuffers/base.h:465:69:
  error: comparing floating point with == or != is unsafe [-Werror,-Wfloat-equal]
template<typename T> inline bool IsTheSameAs(T e, T def) { return e == def; }

But the way it is used in flatbuffers it is ok to compare floating
points with ==.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 02:52:14 +00:00
iS_lANDER
0f8b71180f
[FIX] fix the behavior of flatbuffers::Optional to match std::optional when lhs and rhs are both nullopt (#8223)
Co-authored-by: islander <mikudehuane@gmail.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 02:40:04 +00:00
Derek Bailey
a5a2da0161
Update release.sh (#8322)
* Update release.sh

Update release script to update rust flexbuffers

* Update Cargo.toml
2024-05-28 18:44:37 -07:00
Derek Bailey
28783927af
Update release.yml
Fix pathing in Crates.io publishing.
2024-05-28 18:36:11 -07:00
Derek Bailey
a1378fbd16
Update release.yml
Remove extra -
2024-05-28 18:34:26 -07:00
Derek Bailey
dcacfc5b11
Update release.yml
Use explicit paths in publish-crates. Also adds flexbuffers publishing.
2024-05-28 18:33:04 -07:00
Derek Bailey
f9dabf511a
Update release.yml
Update working directory of crates.io publishing
2024-05-28 18:28:18 -07:00
Ricardo Delfin
5ba66f71c5
Added automatic publishing to crates.io on publish (#8263)
* Added automatic publishing to crates.io on publish

* Fixed indentation

* Update release.yml

Change secret name.

* Update release.yml

remove extra space added in merge

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 01:19:41 +00:00
Tyler Dunn
5adfac9fc3
dart: Fix incorrect write in Float64 write method (#8290)
Co-authored-by: Llamadmiral <Llamadmiral@users.noreply.github.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 01:13:10 +00:00
Paulo Pinheiro
c6fce30e9b
[Kotlin] Update to kotlin 1.9.10 (#8307)
Update was needed to fix compilation issues on XCode 15.
See more:
https://youtrack.jetbrains.com/issue/KT-60230/Native-unknown-options-iossimulatorversionmin-sdkversion-with-Xcode-15-beta-3

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-28 18:08:01 -07:00
Björn Harrtell
ef30729a71
[.NET] Add netstandard2.0 as target (#8295)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-28 18:07:43 -07:00
Ben J
30ae5f189c
Add more operators. (#8309)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-29 01:07:34 +00:00
Derek Bailey
299725fe2e
Update build.yml (#8321)
Add a scheduled cron job to run all the main tests at 4:45 A.M. to catch dependency regressions.
2024-05-28 18:01:00 -07:00
mustiikhalil
a41fefa1a8
Trying to fix bazel on macOS and Xcode 14.3 (#8304)
* Fixes Bazel issues for windows and ci

Fetching boringssl within the flatbuffers repository, to patch the issues
of not being able to upgrade to Xcode 14.3 due to buildkite throwing
errors. The patch was inspired by the tenserflow patch
https://github.com/tensorflow/tensorflow/issues/60191#issuecomment-1496073147

Removes references of swift from the windows pipeline for bazel

Sets github actions to use xcode 14.3 for kotlin and sets the macOS
build for intel cpus.

* Update build.yml

Remove comment that is not relevant any longer.

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-05-28 17:29:41 -07:00
Derek Bailey
d89f611f6f
Update build.yml to ubuntu-24.04 (#8319)
* Update build.yml to ubuntu-24.04

Apparently g++-13 was removed from the ubuntu-22.04 runners.

We also don't have enterprise runners at 24.04 yet, so just use the free ones for now until we get support for those. CI builds might take longer now.

* Update build.yml

Downgrade to g++12 and revert change to using normal runners

* Update build.yml

Go back to ubuntu-24.04 and update both gcc and clang to their latest versions according to [this](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md?plain=1#L16-L20).

* Update build.yml

Go back to g++13 for now, as we get some exotic warning in g++14 for newer C++ standards.

* Update build.yml

Fix the other issues with `macos-latest` going to arm: https://github.com/actions/runner-images/tree/main?tab=readme-ov-file#available-images and that Swift wasn't installed in the ubuntu-24.04 by default.

* Update build.yml

Disable Kotlin MacOs CI
2024-05-28 17:18:00 -07:00
Anton Bobukh
150644d7f4
[gRPC] Add new options to control the gRPC code generation. (#8298)
The new options are:

-  `--grpc-filename-suffix` controls the suffix of the generated files;
-  `--grpc-use-system-headers` controls the type of C++ includes generated;
-  `--grpc-search-path` controls the directory that contains gRPC runtime;
-  `--grpc-additional-header` allows to provide additional dependencies for the generated code.
2024-05-15 08:17:40 -07:00
Anton Bobukh
c696275eaf
[Python] Fix various codegen problems (#8292)
* [Python] Fix various codegen problems.

This includes:

-  escaping keywords happens **after** converting the case:
   - currently, `table ClassT` generate `class = Class()` which is invalid Python;
-  imports in `one_file` mode use the filename rather than the type name when resolving module names;
-  use `filename_suffix` instead of the hardcoded `_generated` one;
-  generate empty files if no structs or enums are available. This makes the set of output files more predictable for Bazel.

* [Python] Fix various codegen problems.

This includes:

-  escaping keywords happens **after** converting the case:
   - currently, `table ClassT` generate `class = Class()` which is invalid Python;
-  imports in `one_file` mode use the filename rather than the type name when resolving module names;
-  use `filename_suffix` instead of the hardcoded `_generated` one;
-  generate empty files if no structs or enums are available. This makes the set of output files more predictable for Bazel.
2024-05-01 14:39:47 -07:00
Philipp Schrader
7106d86685
Remove npm/rules_js dependency for C++ only use cases (#7990)
When flatbuffers is being used from a project that has no use for
JavaScript, users encounter an error similar to the following:

    ERROR: Skipping '@com_github_google_flatbuffers//:flatbuffers': error loading package '@com_github_google_flatbuffers//': Unable to find package for @npm//:defs.bzl: The repository '@npm' could not be resolved: Repository '@npm' is not defined.
    WARNING: Target pattern parsing failed.
    ERROR: error loading package '@com_github_google_flatbuffers//': Unable to find package for @npm//:defs.bzl: The repository '@npm' could not be resolved: Repository '@npm' is not defined.
    INFO: Elapsed time: 0.023s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (0 packages loaded)
        currently loading: @com_github_google_flatbuffers//

That's not ideal. Users that only care about C++ for example
shouldn't be forced to deal with rules_js and friends.

This patch attempts to fix that by moving the rules_js-specific things
into the `ts` and `tests/ts` directories. This should allow
non-JavaScript projects to ignore rules_js and friends completely.

Here I basically followed the `rules_foo` example from rules_js:
https://github.com/aspect-build/rules_js/tree/main/e2e/rules_foo

The idea is that flatbuffers has its own npm dependencies regardless
of what other projects may have. This means we should not force the
user to import flatbuffers's npm dependencies. The new
`ts/repositories.bzl` file is used by dependents to import
flatbuffers's dependencies. They can still import their own
dependencies. This cleanup allowed me to move all
JavaScript-specific stuff from the top-level directory into
subdirectories.

There should be no changes in this patch in terms of functionality.
It's just a refactor of the rules_js call sites. Users will have to
add a call to the function in `ts/repositories.bzl` in their own
`WORKSPACE` file. They can use
`tests/ts/bazel_repository_test/WORKSPACE` as an example.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-04-18 05:06:06 +00:00
Paulo Pinheiro
da6472013f
[Kotlin] Add workflow to release kotlin multiplatform version (#8014)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2024-04-17 17:10:39 -07:00
Derek Bailey
e646392647 flatbuffer_builder: Fix GetTemporaryPointer constantness 2024-04-17 16:06:26 +00:00