mirror of
https://github.com/google/flatbuffers.git
synced 2025-04-08 01:02:04 +08:00
* [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>
136 lines
3.4 KiB
Python
136 lines
3.4 KiB
Python
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
|
|
|
licenses(["notice"])
|
|
|
|
package(
|
|
default_visibility = ["//visibility:public"],
|
|
)
|
|
|
|
exports_files([
|
|
"LICENSE",
|
|
"tsconfig.json",
|
|
])
|
|
|
|
config_setting(
|
|
name = "platform_freebsd",
|
|
constraint_values = [
|
|
"@platforms//os:freebsd",
|
|
],
|
|
)
|
|
|
|
config_setting(
|
|
name = "platform_openbsd",
|
|
constraint_values = [
|
|
"@platforms//os:openbsd",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "distribution",
|
|
srcs = [
|
|
".bazelignore",
|
|
".npmrc",
|
|
"BUILD.bazel",
|
|
"WORKSPACE",
|
|
"build_defs.bzl",
|
|
"package.json",
|
|
"pnpm-lock.yaml",
|
|
"typescript.bzl",
|
|
"//grpc/src/compiler:distribution",
|
|
"//include/codegen:distribution",
|
|
"//reflection:distribution",
|
|
"//src:distribution",
|
|
"//ts:distribution",
|
|
] + glob([
|
|
"include/flatbuffers/*.h",
|
|
]),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Public flatc library to compile flatbuffer files at runtime.
|
|
cc_library(
|
|
name = "flatbuffers",
|
|
hdrs = ["//:public_headers"],
|
|
linkstatic = 1,
|
|
strip_include_prefix = "/include",
|
|
deps = ["//src:flatbuffers"],
|
|
)
|
|
|
|
# Public C++ headers for the Flatbuffers library.
|
|
filegroup(
|
|
name = "public_headers",
|
|
srcs = [
|
|
"include/flatbuffers/allocator.h",
|
|
"include/flatbuffers/array.h",
|
|
"include/flatbuffers/base.h",
|
|
"include/flatbuffers/buffer.h",
|
|
"include/flatbuffers/buffer_ref.h",
|
|
"include/flatbuffers/code_generator.h",
|
|
"include/flatbuffers/code_generators.h",
|
|
"include/flatbuffers/default_allocator.h",
|
|
"include/flatbuffers/detached_buffer.h",
|
|
"include/flatbuffers/file_manager.h",
|
|
"include/flatbuffers/flatbuffer_builder.h",
|
|
"include/flatbuffers/flatbuffers.h",
|
|
"include/flatbuffers/flex_flat_util.h",
|
|
"include/flatbuffers/flexbuffers.h",
|
|
"include/flatbuffers/grpc.h",
|
|
"include/flatbuffers/hash.h",
|
|
"include/flatbuffers/idl.h",
|
|
"include/flatbuffers/minireflect.h",
|
|
"include/flatbuffers/reflection.h",
|
|
"include/flatbuffers/reflection_generated.h",
|
|
"include/flatbuffers/registry.h",
|
|
"include/flatbuffers/stl_emulation.h",
|
|
"include/flatbuffers/string.h",
|
|
"include/flatbuffers/struct.h",
|
|
"include/flatbuffers/table.h",
|
|
"include/flatbuffers/util.h",
|
|
"include/flatbuffers/vector.h",
|
|
"include/flatbuffers/vector_downward.h",
|
|
"include/flatbuffers/verifier.h",
|
|
],
|
|
)
|
|
|
|
# Public flatc compiler library.
|
|
cc_library(
|
|
name = "flatc_library",
|
|
linkstatic = 1,
|
|
deps = [
|
|
"//src:flatc_library",
|
|
],
|
|
)
|
|
|
|
# Public flatc compiler.
|
|
cc_binary(
|
|
name = "flatc",
|
|
data = ["//reflection:reflection_fbs_schema"],
|
|
deps = [
|
|
"//src:flatc",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "flatc_headers",
|
|
srcs = [
|
|
"include/flatbuffers/flatc.h",
|
|
],
|
|
visibility = ["//:__subpackages__"],
|
|
)
|
|
|
|
# Library used by flatbuffer_cc_library rules.
|
|
cc_library(
|
|
name = "runtime_cc",
|
|
hdrs = [
|
|
"include/flatbuffers/base.h",
|
|
"include/flatbuffers/flatbuffers.h",
|
|
"include/flatbuffers/flexbuffers.h",
|
|
"include/flatbuffers/stl_emulation.h",
|
|
"include/flatbuffers/util.h",
|
|
"include/flatbuffers/vector.h",
|
|
"include/flatbuffers/verifier.h",
|
|
],
|
|
linkstatic = 1,
|
|
strip_include_prefix = "/include",
|
|
)
|