Compare commits

..

2 Commits

Author SHA1 Message Date
Derek Bailey
ee848a02e1 FlatBuffers Version 23.1.21 (#7796) 2023-01-21 12:46:57 -08:00
Björn Harrtell
ef76b5ece4 [TS/JS] Entry point per namespace and reworked 1.x compatible single file build (#7510)
* [TS/JS] Entry point per namespace

* Fix handling of outputpath and array_test

* Attempt to fix generate_code

* Fix cwd for ts in generate_code

* Attempt to fixup bazel and some docs

* Add --ts-flat-files to bazel build to get bundle

* Move to DEFAULT_FLATC_TS_ARGS

* Attempt to add esbuild

* Attempt to use npm instead

* Remove futile attempt to add esbuild

* Attempt to as bazel esbuild

* Shuffle

* Upgrade bazel deps

* Revert failed attempts to get bazel working

* Ignore flatc tests for now

* Add esbuild dependency

* `package.json` Include esbuild

* `WORKSPACE` Add fetching esbuild binary

* Update WORKSPACE

* Unfreeze Lockfile

* Update WORKSPACE

* Update BUILD.bazel

* Rework to suggest instead of running external bundler

* Add esbuild generation to test script

* Prelim bundle test

* Run test JavaScriptTest from flatbuffers 1.x

* Deps upgrade

* Clang format fix

* Revert bazel changes

* Fix newline

* Generate with type declarations

* Handle "empty" root namespace

* Adjust tests for typescript_keywords.ts

* Separate test procedure for old node resolution module output

* Fix rel path for root level re-exports

* Bazel support for esbuild-based flatc

Unfortunately, we lose typing information because the new esbuild method
of generating single files does not generate type information.

The method used here is a bit hack-ish because it relies on parsing the
console output of flatc to figure out what to do.

* Try to fix bazel build for when node isn't present on host

* Auto formatting fixes

* Fix missing generated code

Co-authored-by: Derek Bailey <derekbailey@google.com>
Co-authored-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
2023-01-21 12:22:22 -08:00
411 changed files with 11731 additions and 16123 deletions

View File

@@ -38,8 +38,10 @@ jobs:
run: |
chmod +x flatc
./flatc --version
- name: flatc tests
run: python3 tests/flatc/main.py
# - name: flatc tests
# run: |
# yarn global add esbuild
# python3 tests/flatc/main.py
- name: upload build artifacts
uses: actions/upload-artifact@v1
with:
@@ -143,8 +145,8 @@ jobs:
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64
- name: test
run: Release\flattests.exe
- name: flatc tests
run: python3 tests/flatc/main.py --flatc Release\flatc.exe
# - name: flatc tests
# run: python3 tests/flatc/main.py --flatc Release\flatc.exe
- name: upload build artifacts
uses: actions/upload-artifact@v1
with:
@@ -245,8 +247,8 @@ jobs:
run: |
chmod +x Release/flatc
Release/flatc --version
- name: flatc tests
run: python3 tests/flatc/main.py --flatc Release/flatc
# - name: flatc tests
# run: python3 tests/flatc/main.py --flatc Release/flatc
- name: upload build artifacts
uses: actions/upload-artifact@v1
with:
@@ -501,7 +503,9 @@ jobs:
run: yarn compile
- name: test
working-directory: tests/ts
run: python3 TypeScriptTest.py
run: |
yarn global add esbuild
python3 TypeScriptTest.py
build-dart:
name: Build Dart

View File

@@ -4,9 +4,14 @@ All major or breaking changes will be documented in this file, as well as any
new features that should be highlighted. Minor fixes or improvements are not
necessarily listed.
## [23.1.21 (Jan 21 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.20)
* Reworked entry points for Typescript/Javascript and compatibility for single
file build (#7510)
## [23.1.20 (Jan 20 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.20)
* Removed go.mod files after some versioning issues were being report ([#7780](https://github.com/google/flatbuffers/issues/7780)).
* Removed go.mod files after some versioning issues were being report (#7780).
## [23.1.4 (Jan 4 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.4)

View File

@@ -1,6 +1,6 @@
set(VERSION_MAJOR 23)
set(VERSION_MINOR 1)
set(VERSION_PATCH 20)
set(VERSION_PATCH 21)
set(VERSION_COMMIT 0)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FlatBuffers'
s.version = '23.1.20'
s.version = '23.1.21'
s.summary = 'FlatBuffers: Memory Efficient Serialization Library'
s.description = "FlatBuffers is a cross platform serialization library architected for

View File

@@ -94,8 +94,12 @@ yarn_install(
name = "npm",
exports_directories_only = False,
# Unfreeze to add/remove packages.
frozen_lockfile = True,
frozen_lockfile = False,
package_json = "//:package.json",
symlink_node_modules = False,
yarn_lock = "//:yarn.lock",
)
load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")
esbuild_repositories(npm_repository = "npm")

View File

@@ -48,7 +48,7 @@ class Animal : Table() {
return if(o != 0) bb.getShort(o + bb_pos).toUShort() else 0u
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsAnimal(_bb: ByteBuffer): Animal = getRootAsAnimal(_bb, Animal())
fun getRootAsAnimal(_bb: ByteBuffer, obj: Animal): Animal {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -7,7 +7,7 @@ Rules for building C++ flatbuffers with Bazel.
load("@rules_cc//cc:defs.bzl", "cc_library")
flatc_path = "@com_github_google_flatbuffers//:flatc"
TRUE_FLATC_PATH = "@com_github_google_flatbuffers//:flatc"
DEFAULT_INCLUDE_PATHS = [
"./",
@@ -16,6 +16,14 @@ DEFAULT_INCLUDE_PATHS = [
"$(execpath @com_github_google_flatbuffers//:flatc).runfiles/com_github_google_flatbuffers",
]
def default_include_paths(flatc_path):
return [
"./",
"$(GENDIR)",
"$(BINDIR)",
"$(execpath %s).runfiles/com_github_google_flatbuffers" % (flatc_path),
]
DEFAULT_FLATC_ARGS = [
"--gen-object-api",
"--gen-compare",
@@ -32,13 +40,14 @@ def flatbuffer_library_public(
language_flag,
out_prefix = "",
includes = [],
include_paths = DEFAULT_INCLUDE_PATHS,
include_paths = None,
flatc_args = DEFAULT_FLATC_ARGS,
reflection_name = "",
reflection_visibility = None,
compatible_with = None,
restricted_to = None,
target_compatible_with = None,
flatc_path = "@com_github_google_flatbuffers//:flatc",
output_to_bindir = False):
"""Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
@@ -62,6 +71,7 @@ def flatbuffer_library_public(
for, instead of default-supported environments.
target_compatible_with: Optional, The list of target platform constraints
to use.
flatc_path: Bazel target corresponding to the flatc compiler to use.
output_to_bindir: Passed to genrule for output to bin directory.
@@ -69,6 +79,8 @@ def flatbuffer_library_public(
optionally a Fileset([reflection_name]) with all generated reflection
binaries.
"""
if include_paths == None:
include_paths = default_include_paths(flatc_path)
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
# '$(@D)' when given a single source target will give the appropriate
@@ -80,7 +92,7 @@ def flatbuffer_library_public(
genrule_cmd = " ".join([
"SRCS=($(SRCS));",
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
"$(location %s)" % (flatc_path),
"OUTPUT_FILE=\"$(OUTS)\" $(location %s)" % (flatc_path),
" ".join(include_paths_cmd),
" ".join(flatc_args),
language_flag,
@@ -104,7 +116,7 @@ def flatbuffer_library_public(
reflection_genrule_cmd = " ".join([
"SRCS=($(SRCS));",
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
"$(location %s)" % (flatc_path),
"$(location %s)" % (TRUE_FLATC_PATH),
"-b --schema",
" ".join(flatc_args),
" ".join(include_paths_cmd),
@@ -122,7 +134,7 @@ def flatbuffer_library_public(
srcs = srcs + includes,
outs = reflection_outs,
output_to_bindir = output_to_bindir,
tools = [flatc_path],
tools = [TRUE_FLATC_PATH],
compatible_with = compatible_with,
restricted_to = restricted_to,
target_compatible_with = target_compatible_with,
@@ -145,7 +157,7 @@ def flatbuffer_cc_library(
out_prefix = "",
deps = [],
includes = [],
include_paths = DEFAULT_INCLUDE_PATHS,
include_paths = None,
cc_include_paths = [],
flatc_args = DEFAULT_FLATC_ARGS,
visibility = None,

View File

@@ -1,5 +1,5 @@
name: flat_buffers
version: 23.1.20
version: 23.1.21
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

View File

@@ -321,9 +321,8 @@ Please be aware of the difference between `flatc` and `flatcc` tools.
<div class="language-javascript">
~~~{.sh}
cd flatbuffers/samples
./../flatc --ts monster.fbs
# customize your TS -> JS transpilation
tsc monster_generated.ts
./../flatc --ts-flat-files --ts monster.fbs
# produces ts/js modules and js bundle monster_generated.js
~~~
</div>
<div class="language-typescript">
@@ -2241,7 +2240,7 @@ before:
~~~{.ts}
// note: import flatbuffers with your desired import method
// note: the `./monster_generated.ts` file was previously generated by `flatc` above using the `monster.fbs` schema
// note: the `./monster_generated.js` file was previously generated by `flatc` above using the `monster.fbs` schema
import { MyGame } from './monster_generated';
~~~
</div>

View File

@@ -6,7 +6,7 @@ import FlatBuffers
public struct models_HelloReply: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
@@ -53,7 +53,7 @@ extension models_HelloReply: Encodable {
public struct models_HelloRequest: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table

View File

@@ -1,2 +1,3 @@
export { HelloReply } from './models/hello-reply';
export { HelloRequest } from './models/hello-request';
// automatically generated by the FlatBuffers compiler, do not modify
export * as models from './models.js';

View File

@@ -0,0 +1,4 @@
// automatically generated by the FlatBuffers compiler, do not modify
export { HelloReply } from './models/hello-reply.js';
export { HelloRequest } from './models/hello-request.js';

View File

@@ -140,7 +140,7 @@
#define FLATBUFFERS_VERSION_MAJOR 23
#define FLATBUFFERS_VERSION_MINOR 1
#define FLATBUFFERS_VERSION_REVISION 20
#define FLATBUFFERS_VERSION_REVISION 21
#define FLATBUFFERS_STRING_EXPAND(X) #X
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
namespace flatbuffers {

View File

@@ -658,7 +658,8 @@ struct IDLOptions {
bool json_nested_flatbuffers;
bool json_nested_flexbuffers;
bool json_nested_legacy_flatbuffers;
bool ts_flat_file;
bool ts_flat_files;
bool ts_entry_points;
bool ts_no_import_ext;
bool no_leak_private_annotations;
bool require_json_eof;
@@ -763,7 +764,8 @@ struct IDLOptions {
json_nested_flatbuffers(true),
json_nested_flexbuffers(true),
json_nested_legacy_flatbuffers(false),
ts_flat_file(false),
ts_flat_files(false),
ts_entry_points(false),
ts_no_import_ext(false),
no_leak_private_annotations(false),
require_json_eof(true),

View File

@@ -10,7 +10,7 @@
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 20,
FLATBUFFERS_VERSION_REVISION == 21,
"Non-compatible flatbuffers version included");
namespace reflection {

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>23.1.4</version>
<version>23.1.21</version>
<packaging>bundle</packaging>
<name>FlatBuffers Java API</name>
<description>

View File

@@ -46,7 +46,7 @@ public class Constants {
Changes to the Java implementation need to be sure to change
the version here and in the code generator on every possible
incompatible change */
public static void FLATBUFFERS_23_1_20() {}
public static void FLATBUFFERS_23_1_21() {}
}
/// @endcond

View File

@@ -32,6 +32,6 @@ namespace Google.FlatBuffers
Changes to the C# implementation need to be sure to change
the version here and in the code generator on every possible
incompatible change */
public static void FLATBUFFERS_23_1_20() {}
public static void FLATBUFFERS_23_1_21() {}
}
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
<Description>A cross-platform memory efficient serialization library</Description>
<PackageVersion>23.1.20</PackageVersion>
<PackageVersion>23.1.21</PackageVersion>
<Authors>Google LLC</Authors>
<PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl>
<RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl>

View File

@@ -1,6 +1,6 @@
{
"name": "flatbuffers",
"version": "23.1.20",
"version": "23.1.21",
"description": "Memory Efficient Serialization Library",
"files": [
"js/**/*.js",
@@ -9,8 +9,20 @@
"mjs/**/*.d.ts",
"ts/**/*.ts"
],
"main": "js/index.js",
"module": "mjs/index.js",
"main": "js/flatbuffers.js",
"module": "mjs/flatbuffers.js",
"exports": {
".": {
"node": {
"import": "./mjs/flatbuffers.js",
"require": "./js/flatbuffers.js"
},
"default": "./js/flatbuffers.js"
},
"./js/flexbuffers.js": {
"default": "./js/flexbuffers.js"
}
},
"directories": {
"doc": "docs",
"test": "tests"
@@ -18,7 +30,7 @@
"scripts": {
"test": "npm run compile && cd tests/ts && python3 ./TypeScriptTest.py",
"lint": "eslint ts",
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
"compile": "tsc && tsc -p tsconfig.mjs.json && esbuild js/flatbuffers.js --minify --global-name=flatbuffers --bundle --outfile=js/flatbuffers.min.js",
"prepublishOnly": "npm install --only=dev && npm run compile"
},
"repository": {
@@ -38,10 +50,10 @@
"devDependencies": {
"@bazel/typescript": "5.2.0",
"@types/node": "18.7.16",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"eslint": "^8.23.1",
"rollup": "^2.79.0",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"esbuild": "^0.16.4",
"eslint": "^8.29.0",
"typescript": "^4.8.3"
}
}

View File

@@ -14,4 +14,4 @@
# Placeholder, to be updated during the release process
# by the setup.py
__version__ = u"23.1.20"
__version__ = u"23.1.21"

View File

@@ -16,7 +16,7 @@ from setuptools import setup
setup(
name='flatbuffers',
version='23.1.20',
version='23.1.21',
license='Apache 2.0',
license_files='../LICENSE.txt',
author='Derek Bailey',

View File

@@ -11,6 +11,5 @@ flatbuffer_ts_library(
name = "reflection_ts_fbs",
package_name = "flatbuffers_reflection",
srcs = [":reflection.fbs"],
include_reflection = False,
visibility = ["//visibility:public"],
)

View File

@@ -1,8 +0,0 @@
export default {
input: 'mjs/index.js',
output: {
file: 'flatbuffers.js',
format: 'iife',
name: 'flatbuffers'
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "flatbuffers"
version = "23.1.20"
version = "23.1.21"
edition = "2018"
authors = ["Robert Winslow <hello@rwinslow.com>", "FlatBuffers Maintainers"]
license = "Apache-2.0"

View File

@@ -10,7 +10,7 @@
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 20,
FLATBUFFERS_VERSION_REVISION == 21,
"Non-compatible flatbuffers version included");
namespace MyGame {

View File

@@ -36,7 +36,7 @@ public enum MyGame_Sample_Equipment: UInt8, UnionEnum {
public struct MyGame_Sample_Vec3: NativeStruct, Verifiable, FlatbuffersInitializable {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
private var _x: Float32
private var _y: Float32
@@ -72,7 +72,7 @@ public struct MyGame_Sample_Vec3: NativeStruct, Verifiable, FlatbuffersInitializ
public struct MyGame_Sample_Vec3_Mutable: FlatBufferObject {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -88,7 +88,7 @@ public struct MyGame_Sample_Vec3_Mutable: FlatBufferObject {
public struct MyGame_Sample_Monster: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
@@ -200,7 +200,7 @@ public struct MyGame_Sample_Monster: FlatBufferObject, Verifiable {
public struct MyGame_Sample_Weapon: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_23_1_20() }
static func validateVersion() { FlatBuffersVersion_23_1_21() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table

View File

@@ -24,6 +24,7 @@ from util import flatc, root_path, tests_path, args, flatc_path
# Specify the other paths that will be referenced
swift_code_gen = Path(root_path, "tests/swift/tests/CodeGenerationTests")
ts_code_gen = Path(root_path, "tests/ts")
samples_path = Path(root_path, "samples")
reflection_path = Path(root_path, "reflection")
@@ -142,10 +143,10 @@ flatc(
flatc(
NO_INCL_OPTS
+ TS_OPTS,
schema="monster_test.fbs",
prefix="ts",
include="include_test",
data="monsterdata_test.json",
cwd=ts_code_gen,
schema="../monster_test.fbs",
include="../include_test",
data="../monsterdata_test.json",
)
flatc(
@@ -210,37 +211,31 @@ flatc(
flatc(
BASE_OPTS + TS_OPTS,
prefix="ts/union_vector",
schema="union_vector/union_vector.fbs",
cwd=ts_code_gen,
prefix="union_vector",
schema="../union_vector/union_vector.fbs",
)
flatc(
BASE_OPTS + TS_OPTS + ["--gen-name-strings", "--gen-mutable"],
include="include_test",
prefix="ts",
schema="monster_test.fbs",
)
# Generate the complete flat file TS of monster.
flatc(
["--ts", "--gen-all", "--ts-flat-files"],
include="include_test",
schema="monster_test.fbs",
prefix="ts/ts-flat-files"
cwd=ts_code_gen,
include="../include_test",
schema="../monster_test.fbs",
)
flatc(
BASE_OPTS + TS_OPTS + ["-b"],
include="include_test",
prefix="ts",
schema="monster_test.fbs",
data="unicode_test.json",
cwd=ts_code_gen,
include="../include_test",
schema="../monster_test.fbs",
data="../unicode_test.json",
)
flatc(
BASE_OPTS + TS_OPTS + ["--gen-name-strings"],
prefix="ts/union_vector",
schema="union_vector/union_vector.fbs",
cwd=ts_code_gen,
prefix="union_vector",
schema="../union_vector/union_vector.fbs",
)
flatc(
@@ -340,7 +335,7 @@ flatc(
# Optional Scalars
optional_scalars_schema = "optional_scalars.fbs"
flatc(["--java", "--kotlin", "--lobster"], schema=optional_scalars_schema)
flatc(TS_OPTS, schema=optional_scalars_schema, prefix="ts")
flatc(TS_OPTS, cwd=ts_code_gen, schema="../optional_scalars.fbs")
flatc(["--csharp", "--python", "--gen-object-api"], schema=optional_scalars_schema)

View File

@@ -230,7 +230,10 @@ const static FlatCOption flatc_options[] = {
"Allow a nested_flatbuffer field to be parsed as a vector of bytes "
"in JSON, which is unsafe unless checked by a verifier afterwards." },
{ "", "ts-flat-files", "",
"Only generated one typescript file per .fbs file." },
"Generate a single typescript file per .fbs file. Implies "
"ts_entry_points." },
{ "", "ts-entry-points", "",
"Generate entry point typescript per namespace. Implies gen-all." },
{ "", "annotate", "SCHEMA",
"Annotate the provided BINARY_FILE with the specified SCHEMA file." },
{ "", "no-leak-private-annotation", "",
@@ -607,7 +610,12 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
} else if (arg == "--json-nested-bytes") {
opts.json_nested_legacy_flatbuffers = true;
} else if (arg == "--ts-flat-files") {
opts.ts_flat_file = true;
opts.ts_flat_files = true;
opts.ts_entry_points = true;
opts.generate_all = true;
} else if (arg == "--ts-entry-points") {
opts.ts_entry_points = true;
opts.generate_all = true;
} else if (arg == "--ts-no-import-ext") {
opts.ts_no_import_ext = true;
} else if (arg == "--no-leak-private-annotation") {

View File

@@ -655,7 +655,7 @@ class CSharpGenerator : public BaseGenerator {
// Force compile time error if not using the same version runtime.
code += " public static void ValidateVersion() {";
code += " FlatBufferConstants.";
code += "FLATBUFFERS_23_1_20(); ";
code += "FLATBUFFERS_23_1_21(); ";
code += "}\n";
// Generate a special accessor for the table that when used as the root

View File

@@ -683,7 +683,7 @@ class JavaGenerator : public BaseGenerator {
// Force compile time error if not using the same version runtime.
code += " public static void ValidateVersion() {";
code += " Constants.";
code += "FLATBUFFERS_23_1_20(); ";
code += "FLATBUFFERS_23_1_21(); ";
code += "}\n";
// Generate a special accessor for the table that when used as the root

View File

@@ -524,7 +524,7 @@ class KotlinGenerator : public BaseGenerator {
// runtime.
GenerateFunOneLine(
writer, "validateVersion", "", "",
[&]() { writer += "Constants.FLATBUFFERS_23_1_20()"; },
[&]() { writer += "Constants.FLATBUFFERS_23_1_21()"; },
options.gen_jvmstatic);
GenerateGetRootAsAccessors(namer_.Type(struct_def), writer, options);

View File

@@ -1840,7 +1840,7 @@ class SwiftGenerator : public BaseGenerator {
}
std::string ValidateFunc() {
return "static func validateVersion() { FlatBuffersVersion_23_1_20() }";
return "static func validateVersion() { FlatBuffersVersion_23_1_21() }";
}
std::string GenType(const Type &type,

View File

@@ -17,6 +17,7 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
@@ -39,6 +40,14 @@ struct ImportDefinition {
const Definition *dependency = nullptr;
};
struct NsDefinition {
std::string path;
std::string filepath;
std::string symbolic_name;
const Namespace *ns;
std::map<std::string, const Definition *> definitions;
};
Namer::Config TypeScriptDefaultConfig() {
return { /*types=*/Case::kKeep,
/*constants=*/Case::kUnknown,
@@ -102,33 +111,26 @@ class TsGenerator : public BaseGenerator {
generateEnums();
generateStructs();
generateEntry();
if (!generateBundle()) return false;
return true;
}
bool IncludeNamespace() const {
// When generating a single flat file and all its includes, namespaces are
// important to avoid type name clashes.
return parser_.opts.ts_flat_file && parser_.opts.generate_all;
}
std::string GetTypeName(const EnumDef &def, const bool = false,
const bool force_ns_wrap = false) {
if (IncludeNamespace() || force_ns_wrap) {
return namer_.NamespacedType(def);
}
if (force_ns_wrap) { return namer_.NamespacedType(def); }
return namer_.Type(def);
}
std::string GetTypeName(const StructDef &def, const bool object_api = false,
const bool force_ns_wrap = false) {
if (object_api && parser_.opts.generate_object_based_api) {
if (IncludeNamespace() || force_ns_wrap) {
if (force_ns_wrap) {
return namer_.NamespacedObjectType(def);
} else {
return namer_.ObjectType(def);
}
} else {
if (IncludeNamespace() || force_ns_wrap) {
if (force_ns_wrap) {
return namer_.NamespacedType(def);
} else {
return namer_.Type(def);
@@ -144,58 +146,62 @@ class TsGenerator : public BaseGenerator {
std::string code;
if (!parser_.opts.ts_flat_file) {
code += "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
code += "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
for (auto it = bare_imports.begin(); it != bare_imports.end(); it++) {
for (auto it = bare_imports.begin(); it != bare_imports.end(); it++) {
code += it->second.import_statement + "\n";
}
if (!bare_imports.empty()) code += "\n";
for (auto it = imports.begin(); it != imports.end(); it++) {
if (it->second.dependency != &definition) {
code += it->second.import_statement + "\n";
}
if (!bare_imports.empty()) code += "\n";
for (auto it = imports.begin(); it != imports.end(); it++) {
if (it->second.dependency != &definition) {
code += it->second.import_statement + "\n";
}
}
if (!imports.empty()) code += "\n\n";
}
if (!imports.empty()) code += "\n\n";
code += class_code;
if (parser_.opts.ts_flat_file) {
flat_file_ += code;
flat_file_ += "\n";
flat_file_definitions_.insert(&definition);
return true;
} else {
auto dirs = namer_.Directories(*definition.defined_namespace);
EnsureDirExists(dirs);
auto basename = dirs + namer_.File(definition, SkipFile::Suffix);
auto dirs = namer_.Directories(*definition.defined_namespace);
EnsureDirExists(dirs);
auto basename = dirs + namer_.File(definition, SkipFile::Suffix);
return SaveFile(basename.c_str(), code, false);
return SaveFile(basename.c_str(), code, false);
}
void TrackNsDef(const Definition &definition, std::string type_name) {
std::string path;
std::string filepath;
std::string symbolic_name;
if (definition.defined_namespace->components.size() > 0) {
path = namer_.Directories(*definition.defined_namespace,
SkipDir::TrailingPathSeperator);
filepath = path + ".ts";
path = namer_.Directories(*definition.defined_namespace,
SkipDir::OutputPathAndTrailingPathSeparator);
symbolic_name = definition.defined_namespace->components.back();
} else {
auto def_mod_name = namer_.File(definition, SkipFile::SuffixAndExtension);
symbolic_name = file_name_;
filepath = path_ + symbolic_name + ".ts";
}
if (ns_defs_.count(path) == 0) {
NsDefinition nsDef;
nsDef.path = path;
nsDef.filepath = filepath;
nsDef.ns = definition.defined_namespace;
nsDef.definitions.insert(std::make_pair(type_name, &definition));
nsDef.symbolic_name = symbolic_name;
ns_defs_[path] = nsDef;
} else {
ns_defs_[path].definitions.insert(std::make_pair(type_name, &definition));
}
}
private:
IdlNamer namer_;
import_set imports_all_;
// The following three members are used when generating typescript code into a
// single file rather than creating separate files for each type.
// flat_file_ contains the aggregated contents of the file prior to being
// written to disk.
std::string flat_file_;
// flat_file_definitions_ tracks which types have been written to flat_file_.
std::unordered_set<const Definition *> flat_file_definitions_;
// This maps from import names to types to import.
std::map<std::string, std::map<std::string, std::string>>
flat_file_import_declarations_;
// For flat file codegen, tracks whether we need to import the flatbuffers
// library itself (not necessary for files that solely consist of enum
// definitions).
bool import_flatbuffers_lib_ = false;
std::map<std::string, NsDefinition> ns_defs_;
// Generate code for all enums.
void generateEnums() {
@@ -207,8 +213,9 @@ class TsGenerator : public BaseGenerator {
auto &enum_def = **it;
GenEnum(enum_def, &enumcode, imports, false);
GenEnum(enum_def, &enumcode, imports, true);
std::string type_name = GetTypeName(enum_def);
TrackNsDef(enum_def, type_name);
SaveType(enum_def, enumcode, imports, bare_imports);
imports_all_.insert(imports.begin(), imports.end());
}
}
@@ -219,76 +226,101 @@ class TsGenerator : public BaseGenerator {
import_set bare_imports;
import_set imports;
AddImport(bare_imports, "* as flatbuffers", "flatbuffers");
import_flatbuffers_lib_ = true;
auto &struct_def = **it;
std::string declcode;
GenStruct(parser_, struct_def, &declcode, imports);
std::string type_name = GetTypeName(struct_def);
TrackNsDef(struct_def, type_name);
SaveType(struct_def, declcode, imports, bare_imports);
imports_all_.insert(imports.begin(), imports.end());
}
}
// Generate code for a single entry point module.
void generateEntry() {
std::string code =
"// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
if (parser_.opts.ts_flat_file) {
if (import_flatbuffers_lib_) {
code += "import * as flatbuffers from 'flatbuffers';\n";
code += "\n";
}
// Only include import statements when not generating all.
if (!parser_.opts.generate_all) {
for (const auto &it : flat_file_import_declarations_) {
// Note that we do end up generating an import for ourselves, which
// should generally be harmless.
// TODO: Make it so we don't generate a self-import; this will also
// require modifying AddImport to ensure that we don't use
// namespace-prefixed names anywhere...
std::string file = it.first;
if (file.empty()) { continue; }
std::string noext = flatbuffers::StripExtension(file);
std::string basename = flatbuffers::StripPath(noext);
std::string include_file = GeneratedFileName(
parser_.opts.include_prefix,
parser_.opts.keep_prefix ? noext : basename, parser_.opts);
// TODO: what is the right behavior when different include flags are
// specified here? Should we always be adding the "./" for a relative
// path or turn it off if --include-prefix is specified, or something
// else?
std::string import_extension = parser_.opts.ts_no_import_ext ? "" : ".js";
std::string include_name =
"./" + flatbuffers::StripExtension(include_file) + import_extension;
code += "import {";
for (const auto &pair : it.second) {
code += namer_.EscapeKeyword(pair.first) + " as " +
namer_.EscapeKeyword(pair.second) + ", ";
}
code.resize(code.size() - 2);
code += "} from '" + include_name + "';\n";
}
code += "\n";
}
std::string code;
code += flat_file_;
const std::string filename =
GeneratedFileName(path_, file_name_, parser_.opts);
SaveFile(filename.c_str(), code, false);
} else {
for (auto it = imports_all_.begin(); it != imports_all_.end(); it++) {
code += it->second.export_statement + "\n";
}
if (imports_all_.empty()) {
// if the file is empty, add an empty export so that tsc doesn't
// complain when running under `--isolatedModules` mode
code += "export {}";
}
const std::string path =
GeneratedFileName(path_, file_name_, parser_.opts);
SaveFile(path.c_str(), code, false);
// add root namespace def if not already existing from defs tracking
std::string root;
if (ns_defs_.count(root) == 0) {
NsDefinition nsDef;
nsDef.path = root;
nsDef.symbolic_name = file_name_;
nsDef.filepath = path_ + file_name_ + ".ts";
nsDef.ns = new Namespace();
ns_defs_[nsDef.path] = nsDef;
}
for (const auto &it : ns_defs_) {
code = "// " + std::string(FlatBuffersGeneratedWarning()) + "\n\n";
// export all definitions in ns entry point module
int export_counter = 0;
for (const auto &def : it.second.definitions) {
std::vector<std::string> rel_components;
// build path for root level vs child level
if (it.second.ns->components.size() > 1)
std::copy(it.second.ns->components.begin() + 1,
it.second.ns->components.end(),
std::back_inserter(rel_components));
else
std::copy(it.second.ns->components.begin(),
it.second.ns->components.end(),
std::back_inserter(rel_components));
auto base_file_name =
namer_.File(*(def.second), SkipFile::SuffixAndExtension);
auto base_name =
namer_.Directories(it.second.ns->components, SkipDir::OutputPath) +
base_file_name;
auto ts_file_path = base_name + ".ts";
auto base_name_rel = std::string("./");
base_name_rel +=
namer_.Directories(rel_components, SkipDir::OutputPath);
base_name_rel += base_file_name;
auto ts_file_path_rel = base_name_rel + ".ts";
auto type_name = def.first;
code += "export { " + type_name + " } from '";
std::string import_extension =
parser_.opts.ts_no_import_ext ? "" : ".js";
code += base_name_rel + import_extension + "';\n";
export_counter++;
}
// re-export child namespace(s) in parent
const auto child_ns_level = it.second.ns->components.size() + 1;
for (const auto &it2 : ns_defs_) {
if (it2.second.ns->components.size() != child_ns_level) continue;
auto ts_file_path = it2.second.path + ".ts";
code += "export * as " + it2.second.symbolic_name + " from './";
std::string rel_path = it2.second.path;
code += rel_path + ".js';\n";
export_counter++;
}
if (export_counter > 0) SaveFile(it.second.filepath.c_str(), code, false);
}
}
bool generateBundle() {
if (parser_.opts.ts_flat_files) {
std::string inputpath;
std::string symbolic_name = file_name_;
inputpath = path_ + file_name_ + ".ts";
std::string bundlepath =
GeneratedFileName(path_, file_name_, parser_.opts);
bundlepath = bundlepath.substr(0, bundlepath.size() - 3) + ".js";
std::string cmd = "esbuild";
cmd += " ";
cmd += inputpath;
// cmd += " --minify";
cmd += " --format=cjs --bundle --outfile=";
cmd += bundlepath;
cmd += " --external:flatbuffers";
std::cout << "Entry point " << inputpath << " generated." << std::endl;
std::cout << "A single file bundle can be created using fx. esbuild with:"
<< std::endl;
std::cout << "> " << cmd << std::endl;
}
return true;
}
// Generate a documentation comment, if available.
@@ -839,28 +871,6 @@ class TsGenerator : public BaseGenerator {
const std::string object_name =
GetTypeName(dependency, /*object_api=*/true, has_name_clash);
if (parser_.opts.ts_flat_file) {
// In flat-file generation, do not attempt to import things from ourselves
// *and* do not wrap namespaces (note that this does override the logic
// above, but since we force all non-self-imports to use namespace-based
// names in flat file generation, it's fine).
if (dependent.file == dependency.file) {
name = import_name;
} else {
const std::string file =
RelativeToRootPath(StripFileName(AbsolutePath(dependent.file)),
dependency.file)
// Strip the leading //
.substr(2);
flat_file_import_declarations_[file][import_name] = name;
if (parser_.opts.generate_object_based_api &&
SupportsObjectAPI<DefinitionT>::value) {
flat_file_import_declarations_[file][import_name + "T"] = object_name;
}
}
}
const std::string symbols_expression = GenSymbolExpression(
dependency, has_name_clash, import_name, name, object_name);

View File

@@ -119,4 +119,4 @@ extension UInt64: Scalar, Verifiable {
public typealias NumericValue = UInt64
}
public func FlatBuffersVersion_23_1_20() {}
public func FlatBuffersVersion_23_1_21() {}

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
]#

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class LongFloatEntry extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb) { return getRootAsLongFloatEntry(_bb, new LongFloatEntry()); }
public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb, LongFloatEntry obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -45,7 +45,7 @@ class LongFloatEntry : Table() {
return (val_1 - val_2).sign
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsLongFloatEntry(_bb: ByteBuffer): LongFloatEntry = getRootAsLongFloatEntry(_bb, LongFloatEntry())
fun getRootAsLongFloatEntry(_bb: ByteBuffer, obj: LongFloatEntry): LongFloatEntry {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class LongFloatMap extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static LongFloatMap getRootAsLongFloatMap(ByteBuffer _bb) { return getRootAsLongFloatMap(_bb, new LongFloatMap()); }
public static LongFloatMap getRootAsLongFloatMap(ByteBuffer _bb, LongFloatMap obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -59,7 +59,7 @@ class LongFloatMap : Table() {
}
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsLongFloatMap(_bb: ByteBuffer): LongFloatMap = getRootAsLongFloatMap(_bb, LongFloatMap())
fun getRootAsLongFloatMap(_bb: ByteBuffer, obj: LongFloatMap): LongFloatMap {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -13,7 +13,7 @@ public struct KeywordsInTable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static KeywordsInTable GetRootAsKeywordsInTable(ByteBuffer _bb) { return GetRootAsKeywordsInTable(_bb, new KeywordsInTable()); }
public static KeywordsInTable GetRootAsKeywordsInTable(ByteBuffer _bb, KeywordsInTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -13,7 +13,7 @@ public struct Table2 : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static Table2 GetRootAsTable2(ByteBuffer _bb) { return GetRootAsTable2(_bb, new Table2()); }
public static Table2 GetRootAsTable2(ByteBuffer _bb, Table2 obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
]#

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct ArrayTable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb) { return GetRootAsArrayTable(_bb, new ArrayTable()); }
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "ARRT"); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class ArrayTable extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb) { return getRootAsArrayTable(_bb, new ArrayTable()); }
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "ARRT"); }

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -14,7 +14,7 @@ public struct Monster : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); }
public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool MonsterBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONS"); }

View File

@@ -24,7 +24,7 @@ import java.nio.ByteOrder;
*/
@SuppressWarnings("unused")
public final class Monster extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); }

View File

@@ -1003,7 +1003,7 @@ class Monster : Table() {
return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb)
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster())
fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct Referrable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); }
public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class Referrable extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -49,7 +49,7 @@ class Referrable : Table() {
return (val_1 - val_2).sign
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsReferrable(_bb: ByteBuffer): Referrable = getRootAsReferrable(_bb, Referrable())
fun getRootAsReferrable(_bb: ByteBuffer, obj: Referrable): Referrable {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct Stat : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); }
public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class Stat extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -74,7 +74,7 @@ class Stat : Table() {
return (val_1 - val_2).sign
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsStat(_bb: ByteBuffer): Stat = getRootAsStat(_bb, Stat())
fun getRootAsStat(_bb: ByteBuffer, obj: Stat): Stat {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ internal partial struct TestSimpleTableWithEnum : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
final class TestSimpleTableWithEnum extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -44,7 +44,7 @@ class TestSimpleTableWithEnum : Table() {
}
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum())
fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct TypeAliases : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb) { return GetRootAsTypeAliases(_bb, new TypeAliases()); }
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class TypeAliases extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb) { return getRootAsTypeAliases(_bb, new TypeAliases()); }
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -216,7 +216,7 @@ class TypeAliases : Table() {
}
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsTypeAliases(_bb: ByteBuffer): TypeAliases = getRootAsTypeAliases(_bb, TypeAliases())
fun getRootAsTypeAliases(_bb: ByteBuffer, obj: TypeAliases): TypeAliases {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct Monster : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); }
public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class Monster extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -30,7 +30,7 @@ class Monster : Table() {
return this
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster())
fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster {
_bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
flatc version: 23.1.20
flatc version: 23.1.21
Declared by :
Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct InParentNamespace : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_21(); }
public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb) { return GetRootAsInParentNamespace(_bb, new InParentNamespace()); }
public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -21,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused")
public final class InParentNamespace extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_20(); }
public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_21(); }
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb) { return getRootAsInParentNamespace(_bb, new InParentNamespace()); }
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -30,7 +30,7 @@ class InParentNamespace : Table() {
return this
}
companion object {
fun validateVersion() = Constants.FLATBUFFERS_23_1_20()
fun validateVersion() = Constants.FLATBUFFERS_23_1_21()
fun getRootAsInParentNamespace(_bb: ByteBuffer): InParentNamespace = getRootAsInParentNamespace(_bb, InParentNamespace())
fun getRootAsInParentNamespace(_bb: ByteBuffer, obj: InParentNamespace): InParentNamespace {
_bb.order(ByteOrder.LITTLE_ENDIAN)

Some files were not shown because too many files have changed in this diff Show More