Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fergushenderson authored Jan 7, 2025
2 parents 90be086 + 8694806 commit 7e82d67
Show file tree
Hide file tree
Showing 301 changed files with 3,947 additions and 914 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,15 @@ jobs:

build-kotlin-macos:
name: Build Kotlin MacOS
runs-on: macos-latest
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
# Force Xcode 14.3 since Xcode 15 doesnt support older versions of
# kotlin. For Xcode 15, kotlin should be bumpped to 1.9.10
# https://stackoverflow.com/a/77150623
# For now, run with macos-13 which has this 14.3 installed:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode
- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_14.3.app/Contents/Developer
- uses: gradle/[email protected]
Expand Down Expand Up @@ -508,17 +510,16 @@ jobs:
name: Build Swift Wasm
runs-on: ubuntu-24.04
container:
image: ghcr.io/swiftwasm/carton:0.15.3
image: ghcr.io/swiftwasm/carton:0.20.1
steps:
- uses: actions/checkout@v3
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v2
- uses: swiftwasm/setup-swiftwasm@v1
with:
swift-version: "wasm-5.9.2-RELEASE"
- name: Test
working-directory: tests/swift/Wasm.tests
run: swift run carton test
- uses: actions/checkout@v3
- uses: bytecodealliance/actions/wasmtime/setup@v1
- uses: swiftwasm/setup-swiftwasm@v1
with:
swift-version: "wasm-6.0.2-RELEASE"
- name: Test
working-directory: tests/swift/Wasm.tests
run: swift run carton test

build-ts:
name: Build TS
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: docs
on:
# For manual pushes.
workflow_dispatch:

# Pushes to main that touch the documentation directory.
push:
branches:
- master
paths:
- 'docs/**'

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force -f docs/mkdocs.yml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ _deps/
kotlin/**/generated
MODULE.bazel
MODULE.bazel.lock

# Ignore the generated docs
docs/site
4 changes: 2 additions & 2 deletions CMake/Version.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(VERSION_MAJOR 24)
set(VERSION_MINOR 3)
set(VERSION_PATCH 25)
set(VERSION_MINOR 12)
set(VERSION_PATCH 23)
set(VERSION_COMMIT 0)

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
Expand Down
2 changes: 1 addition & 1 deletion FlatBuffers.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FlatBuffers'
s.version = '24.3.25'
s.version = '24.12.23'
s.summary = 'FlatBuffers: Memory Efficient Serialization Library'

s.description = "FlatBuffers is a cross platform serialization library architected for
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/cpp/generated/animal_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 21,
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
"Non-compatible flatbuffers version included");

namespace com {
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/generated/com/fbs/app/Animal.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Animal : Table() {
return if(o != 0) bb.getShort(o + bb_pos).toUShort() else 0u
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_24_3_25()
fun validateVersion() = Constants.FLATBUFFERS_24_12_23()
fun getRootAsAnimal(_bb: ByteBuffer): Animal = getRootAsAnimal(_bb, Animal())
fun getRootAsAnimal(_bb: ByteBuffer, obj: Animal): Animal {
_bb.order(ByteOrder.LITTLE_ENDIAN)
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/cpp/flatbuffers/bench_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
FLATBUFFERS_VERSION_MINOR == 0 &&
FLATBUFFERS_VERSION_REVISION == 6,
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
"Non-compatible flatbuffers version included");

namespace benchmarks_flatbuffers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,24 @@ let benchmarks = {
let root = Offset(offset: fb.endTable(at: start))
fb.finish(offset: root)
}

Benchmark("Vector of Offsets") { benchmark in
let rawSize = ((16 * 5) * benchmark.scaledIterations.count) / 1024
var fb = FlatBufferBuilder(initialSize: Int32(rawSize * 1600))
benchmark.startMeasurement()
for _ in benchmark.scaledIterations {
let offsets = [
fb.create(string: "T"),
fb.create(string: "2"),
fb.create(string: "3"),
]
let off = fb.createVector(ofOffsets: [
fb.createVector(ofOffsets: offsets),
fb.createVector(ofOffsets: offsets),
])
let s = fb.startTable(with: 2)
fb.add(offset: off, at: 2)
blackHole(fb.endTable(at: s))
}
}
}
2 changes: 1 addition & 1 deletion benchmarks/swift/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let package = Package(
.package(path: "../.."),
.package(
url: "https://github.com/ordo-one/package-benchmark",
from: "1.12.0"),
from: "1.27.0"),
],
targets: [
.executableTarget(
Expand Down
4 changes: 2 additions & 2 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: flat_buffers
version: 24.3.25
version: 24.12.23
description: FlatBuffers reading and writing library for Dart. Based on original work by Konstantin Scheglov and Paul Berry of the Dart SDK team.
homepage: https://github.com/google/flatbuffers
documentation: https://google.github.io/flatbuffers/index.html

environment:
sdk: '>=2.12.0 <4.0.0'
sdk: '>=2.17.0 <4.0.0'

dev_dependencies:
test: ^1.17.7
Expand Down
2 changes: 1 addition & 1 deletion dart/test/bool_structs_generated.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names

import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,43 +1,33 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names

import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;


class OptionsEnum {
enum OptionsEnum {
A(1),
B(2),
C(3);

final int value;
const OptionsEnum._(this.value);
const OptionsEnum(this.value);

factory OptionsEnum.fromValue(int value) {
final result = values[value];
if (result == null) {
throw StateError('Invalid value $value for bit flag enum OptionsEnum');
switch (value) {
case 1: return OptionsEnum.A;
case 2: return OptionsEnum.B;
case 3: return OptionsEnum.C;
default: throw StateError('Invalid value $value for bit flag enum');
}
return result;
}

static OptionsEnum? _createOrNull(int? value) =>
static OptionsEnum? _createOrNull(int? value) =>
value == null ? null : OptionsEnum.fromValue(value);

static const int minValue = 1;
static const int maxValue = 3;
static bool containsValue(int value) => values.containsKey(value);

static const OptionsEnum A = OptionsEnum._(1);
static const OptionsEnum B = OptionsEnum._(2);
static const OptionsEnum C = OptionsEnum._(3);
static const Map<int, OptionsEnum> values = {
1: A,
2: B,
3: C};

static const fb.Reader<OptionsEnum> reader = _OptionsEnumReader();

@override
String toString() {
return 'OptionsEnum{value: $value}';
}
}

class _OptionsEnumReader extends fb.Reader<OptionsEnum> {
Expand Down
28 changes: 14 additions & 14 deletions dart/test/flat_buffers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';

import './monster_test_my_game.example_generated.dart' as example;
import './monster_test_my_game.example2_generated.dart' as example2;
import './list_of_enums_generated.dart' as example3;
import 'enums_generated.dart' as example3;
import './bool_structs_generated.dart' as example4;

main() {
Expand Down Expand Up @@ -63,11 +63,11 @@ class CheckOtherLangaugesData {
expect(
mon.toString(),
'Monster{'
'pos: Vec3{x: 1.0, y: 2.0, z: 3.0, test1: 3.0, test2: Color{value: 2}, test3: Test{a: 5, b: 6}}, '
'pos: Vec3{x: 1.0, y: 2.0, z: 3.0, test1: 3.0, test2: Color.Green, test3: Test{a: 5, b: 6}}, '
'mana: 150, hp: 80, name: MyMonster, inventory: [0, 1, 2, 3, 4], '
'color: Color{value: 8}, testType: AnyTypeId{value: 1}, '
'color: Color.Blue, testType: AnyTypeId.Monster, '
'test: Monster{pos: null, mana: 150, hp: 100, name: Fred, '
'inventory: null, color: Color{value: 8}, testType: null, '
'inventory: null, color: Color.Blue, testType: null, '
'test: null, test4: null, testarrayofstring: null, '
'testarrayoftables: null, enemy: null, testnestedflatbuffer: null, '
'testempty: null, testbool: false, testhashs32Fnv1: 0, '
Expand All @@ -82,18 +82,18 @@ class CheckOtherLangaugesData {
'coOwningReference: 0, vectorOfCoOwningReferences: null, '
'nonOwningReference: 0, vectorOfNonOwningReferences: null, '
'anyUniqueType: null, anyUnique: null, anyAmbiguousType: null, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race{value: -1}, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race.None, '
'testrequirednestedflatbuffer: null, scalarKeySortedTables: null, '
'nativeInline: null, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
'longEnumNonEnumDefault: LongEnum._default, '
'longEnumNormalDefault: LongEnum.LongOne, nanDefault: NaN, '
'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
'-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}, '
'test4: [Test{a: 10, b: 20}, Test{a: 30, b: 40}], '
'testarrayofstring: [test1, test2], testarrayoftables: null, '
'enemy: Monster{pos: null, mana: 150, hp: 100, name: Fred, '
'inventory: null, color: Color{value: 8}, testType: null, '
'inventory: null, color: Color.Blue, testType: null, '
'test: null, test4: null, testarrayofstring: null, '
'testarrayoftables: null, enemy: null, testnestedflatbuffer: null, '
'testempty: null, testbool: false, testhashs32Fnv1: 0, '
Expand All @@ -108,11 +108,11 @@ class CheckOtherLangaugesData {
'coOwningReference: 0, vectorOfCoOwningReferences: null, '
'nonOwningReference: 0, vectorOfNonOwningReferences: null, '
'anyUniqueType: null, anyUnique: null, anyAmbiguousType: null, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race{value: -1}, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race.None, '
'testrequirednestedflatbuffer: null, scalarKeySortedTables: null, '
'nativeInline: null, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
'longEnumNonEnumDefault: LongEnum._default, '
'longEnumNormalDefault: LongEnum.LongOne, nanDefault: NaN, '
'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
'-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}, '
Expand All @@ -137,12 +137,12 @@ class CheckOtherLangaugesData {
'vectorOfNonOwningReferences: null, '
'anyUniqueType: null, anyUnique: null, '
'anyAmbiguousType: null, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race{value: -1}, '
'anyAmbiguous: null, vectorOfEnums: null, signedEnum: Race.None, '
'testrequirednestedflatbuffer: null, scalarKeySortedTables: [Stat{id: '
'miss, val: 0, count: 0}, Stat{id: hit, val: 10, count: 1}], '
'nativeInline: Test{a: 1, b: 2}, '
'longEnumNonEnumDefault: LongEnum{value: 0}, '
'longEnumNormalDefault: LongEnum{value: 2}, nanDefault: NaN, '
'longEnumNonEnumDefault: LongEnum._default, '
'longEnumNormalDefault: LongEnum.LongOne, nanDefault: NaN, '
'infDefault: Infinity, positiveInfDefault: Infinity, infinityDefault: '
'Infinity, positiveInfinityDefault: Infinity, negativeInfDefault: '
'-Infinity, negativeInfinityDefault: -Infinity, doubleInfDefault: Infinity}');
Expand Down
2 changes: 1 addition & 1 deletion dart/test/include_test1_generated.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names

import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;
Expand Down
28 changes: 9 additions & 19 deletions dart/test/include_test2_my_game.other_name_space_generated.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names

library my_game.other_name_space;

Expand All @@ -9,35 +9,25 @@ import 'package:flat_buffers/flat_buffers.dart' as fb;

import './include_test1_generated.dart';

class FromInclude {
enum FromInclude {
IncludeVal(0);

final int value;
const FromInclude._(this.value);
const FromInclude(this.value);

factory FromInclude.fromValue(int value) {
final result = values[value];
if (result == null) {
throw StateError('Invalid value $value for bit flag enum FromInclude');
switch (value) {
case 0: return FromInclude.IncludeVal;
default: throw StateError('Invalid value $value for bit flag enum');
}
return result;
}

static FromInclude? _createOrNull(int? value) =>
static FromInclude? _createOrNull(int? value) =>
value == null ? null : FromInclude.fromValue(value);

static const int minValue = 0;
static const int maxValue = 0;
static bool containsValue(int value) => values.containsKey(value);

static const FromInclude IncludeVal = FromInclude._(0);
static const Map<int, FromInclude> values = {
0: IncludeVal};

static const fb.Reader<FromInclude> reader = _FromIncludeReader();

@override
String toString() {
return 'FromInclude{value: $value}';
}
}

class _FromIncludeReader extends fb.Reader<FromInclude> {
Expand Down
Loading

0 comments on commit 7e82d67

Please sign in to comment.