Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 12 additions & 77 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,79 +1,14 @@
common --experimental_repo_remote_exec

# Disable bzlmod
common --noenable_bzlmod

# Suppress all warning messages.
build:short_logs --output_filter=DONT_MATCH_ANYTHING

common --repo_env=USE_PYWRAP_RULES=True
common --copt=-DGRPC_BAZEL_BUILD
common --host_copt=-DGRPC_BAZEL_BUILD
common --action_env=GRPC_BAZEL_RUNTIME=1
common --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
common --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
# gRPC using libcares in opensource has some issues.
common --enable_bzlmod
common --incompatible_autoload_externally=+@rules_cc
build --compilation_mode=opt
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17
build --define=grpc_no_ares=true

# Configures the wheel name
common --repo_env WHEEL_NAME=dm_reverb_nightly # dm_reverb or dm_reverb_nightly
# Configures the version suffix for the built wheels. See
# https://github.com/openxla/xla/blob/main/third_party/py/python_wheel.bzl
common --repo_env ML_WHEEL_TYPE=snapshot

common --define framework_shared_object=true
common --define tsl_protobuf_header_only=true

common --incompatible_default_to_explicit_init_py
common --enable_platform_specific_config

common --incompatible_enable_cc_toolchain_resolution
common --@rules_ml_toolchain//common:enable_hermetic_cc=True
common --repo_env USE_HERMETIC_CC_TOOLCHAIN=1

# Print a stacktrace when a test is killed
test --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1"
build --incompatible_default_to_explicit_init_py
build --copt=-DGRPC_BAZEL_BUILD
build --host_copt=-DGRPC_BAZEL_BUILD
build --action_env=GRPC_BAZEL_RUNTIME=1
build --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
test --test_output=errors

common -c opt
common --cxxopt="-std=c++17"
common --host_cxxopt="-std=c++17"
common --copt "-Wno-deprecated-declarations"
common --copt "-Wno-unused-command-line-argument"

# We can remove this flag (we keep it explicit for now)
build --auto_output_filter=subpackages
common --copt="-Wno-sign-compare"
build --copt="-DEIGEN_MAX_ALIGN_BYTES=64"

test --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1"

# TF isn't built in dbg mode, so our dbg builds will segfault due to inconsistency
# of defines when using tf's headers. In particular in refcount.h.
# common --cxxopt="-DNDEBUG"

common:clang_local --noincompatible_enable_cc_toolchain_resolution
common:clang_local --noincompatible_enable_android_toolchain_resolution
common:clang_local --@rules_ml_toolchain//common:enable_hermetic_cc=False
common:clang_local --repo_env USE_HERMETIC_CC_TOOLCHAIN=0

common:apple-toolchain --apple_crosstool_top=@local_config_apple_cc//:toolchain
common:apple-toolchain --crosstool_top=@local_config_apple_cc//:toolchain
common:apple-toolchain --host_crosstool_top=@local_config_apple_cc//:toolchain

common:linux --linkopt="-lrt -lm"

common:macos --linkopt="-Wl,-undefined,dynamic_lookup"
common:macos --config=clang_local
common:macos --config=apple-toolchain
# The following two flags are needed to
# ensure that the extensions are compatible with lower versions of macOS.
common:macos --macos_minimum_os=12.0
common:macos --action_env=MACOSX_DEPLOYMENT_TARGET=12.0

# We build with AVX and eigen byte alignment to match tensorflow's (and Eigen)
# pip package byte alignment. See b/186669968 for more details.
build:linux --copt=-mavx --copt=-DEIGEN_MAX_ALIGN_BYTES=64

# Options from ./configure
try-import %workspace%/.reverb.bazelrc
build --macos_minimum_os=12.0
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.7.0
9.2.0
156 changes: 156 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
module(
name = "reverb",
version = "0.15.0",
)

bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "rules_cc", version = "0.2.25")
bazel_dep(name = "rules_python", version = "2.3.3")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "abseil-cpp", version = "20250814.1", repo_name = "com_google_absl")
bazel_dep(name = "protobuf", version = "35.1")
bazel_dep(name = "reverb_protobuf", version = "31.1", repo_name = "com_google_protobuf")
bazel_dep(name = "grpc", version = "1.74.0", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "googletest", version = "1.18.0", repo_name = "com_google_googletest")
bazel_dep(name = "snappy", version = "1.2.1")

# TensorFlow owns the loaded Protobuf runtime.
single_version_override(
module_name = "grpc",
patch_strip = 1,
patches = ["//third_party/bzlmod:grpc_protobuf.patch"],
version = "1.74.0",
)

archive_override(
module_name = "reverb_protobuf",
integrity = "sha256-bgm7yVC6YMOnswKAIQzSha+NfY7V4KbtEBxyr/IujYg=",
patch_strip = 1,
patches = ["//third_party/bzlmod:protobuf_bazel.patch"],
strip_prefix = "protobuf-6.31.1",
urls = ["https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip"],
)

single_version_override(
module_name = "protoc-gen-validate",
patch_strip = 1,
patches = ["//third_party/bzlmod:protoc_validate_bazel.patch"],
version = "1.2.1.bcr.1",
)

single_version_override(
module_name = "cel-spec",
patch_strip = 1,
patches = ["//third_party/bzlmod:cel_spec_bazel.patch"],
version = "0.15.0",
)

single_version_override(
module_name = "envoy_api",
patch_strip = 1,
patches = ["//third_party/bzlmod:envoy_api_bazel.patch"],
version = "0.0.0-20250128-4de3c74",
)

single_version_override(
module_name = "abseil-cpp",
version = "20250814.1",
)

single_version_override(
module_name = "grpc-java",
patch_strip = 1,
patches = ["//third_party/bzlmod:grpc_java_module.patch"],
version = "1.66.0",
)

single_version_override(
module_name = "rules_python",
patch_strip = 0,
patches = ["//third_party/bzlmod:rules_python_sourceless.patch"],
version = "2.3.3",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")

[
python.toolchain(
is_default = python_version == "3.13",
python_version = python_version,
)
for python_version in [
"3.10",
"3.11",
"3.12",
"3.13",
]
]

use_repo(python, "pythons_hub")

register_toolchains("@pythons_hub//:all")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

[
pip.whl_mods(
additive_build_content_file = "//third_party/bzlmod:" + distribution + ".BUILD.bazel",
hub_name = "reverb_pypi_mods",
whl_name = distribution,
)
for distribution in [
"tensorflow",
"numpy",
"pybind11",
]
]

[
pip.parse(
experimental_index_url = "https://pypi.org/simple",
extra_hub_aliases = {
"tensorflow": [
"framework_lib",
"headers_lib",
],
"numpy": ["numpy_headers"],
"pybind11": ["reverb_headers"],
},
hub_name = "reverb_pypi",
python_version = python_version,
requirements_lock = "//third_party/bzlmod:requirements.txt",
target_platforms = [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
],
whl_modifications = {
"@reverb_pypi_mods//:tensorflow.json": "tensorflow",
"@reverb_pypi_mods//:numpy.json": "numpy",
"@reverb_pypi_mods//:pybind11.json": "pybind11",
},
)
for python_version in [
"3.10",
"3.11",
"3.12",
"3.13",
]
]

use_repo(pip, "reverb_pypi_mods", pypi = "reverb_pypi")

tensorflow_protos_repository = use_repo_rule("//third_party/bzlmod:repositories.bzl", "tensorflow_protos_repository")

tensorflow_protos_repository(name = "reverb_tensorflow_protos")

pybind11_repository = use_repo_rule("//third_party/bzlmod:repositories.bzl", "pybind11_repository")

pybind11_repository(
name = "pybind11",
actual = "@pypi//pybind11:reverb_headers",
)

wheel_config_repository = use_repo_rule("//reverb/pip_package:wheel_config.bzl", "wheel_config_repository")

wheel_config_repository(name = "reverb_wheel_config")
Loading
Loading