Files
ray/streaming/BUILD.bazel
T
mehrdadn e09f63ad65 Fix build errors and add more targets to Windows builds (#6811)
* Fix common.fbs rename (due to apache/arrow/commit/bef9a1c251397311a6415d3dc362ef419d154caa)

* Add missing COPTS

* Use socketpair(AF_INET) if boost::asio::local is unavailable (e.g. on Windows)

* Fix compile bug in service_based_gcs_client_test.cc (fix build breakage in #6686)

* Work around googletest/gmock inability to specify override to avoid -Werror,-Winconsistent-missing-override

* Fix missing override on IsPlasmaBuffer()

* Fix missing libraries for streaming

* Factor out install-toolchains.sh

* Put some Bazel flags into .bazelrc

* Fix jni_md.h missing inclusion

* Add ~/bin to PATH for Bazel

* Change echo $$(date) > $@ to date > $@

* Fix lots of unquoted paths

* Add system() call checks for Windows

Co-authored-by: GitHub Web Flow <noreply@github.com>
2020-02-11 16:49:33 -08:00

313 lines
6.4 KiB
Python

# Bazel build
# C/C++ documentation: https://docs.bazel.build/versions/master/be/c-cpp.html
load("@rules_proto_grpc//python:defs.bzl", "python_proto_compile")
load("//bazel:ray.bzl", "COPTS")
proto_library(
name = "streaming_proto",
srcs = ["src/protobuf/streaming.proto"],
visibility = ["//visibility:public"],
)
cc_proto_library(
name = "streaming_cc_proto",
deps = [":streaming_proto"],
)
proto_library(
name = "streaming_queue_proto",
srcs = ["src/protobuf/streaming_queue.proto"],
)
cc_proto_library(
name = "streaming_queue_cc_proto",
deps = ["streaming_queue_proto"],
)
# Use `linkshared` to ensure ray related symbols are not packed into streaming libs
# to avoid duplicate symbols. In runtime we expose ray related symbols, which can
# be linked into streaming libs by dynamic linker. See bazel rule `//:_raylet`
cc_binary(
name = "ray_util.so",
copts = COPTS,
linkshared = 1,
visibility = ["//visibility:public"],
deps = ["//:ray_util"],
)
cc_binary(
name = "ray_common.so",
copts = COPTS,
linkshared = 1,
visibility = ["//visibility:public"],
deps = ["//:ray_common"],
)
cc_binary(
name = "core_worker_lib.so",
copts = COPTS,
linkshared = 1,
deps = ["//:core_worker_lib"],
)
cc_library(
name = "streaming_util",
srcs = glob([
"src/util/*.cc",
]),
hdrs = glob([
"src/util/*.h",
]),
copts = COPTS,
includes = [
"src",
],
visibility = ["//visibility:public"],
deps = [
"ray_util.so",
"@boost//:any",
"@com_google_googletest//:gtest",
],
)
cc_library(
name = "streaming_config",
srcs = glob([
"src/config/*.cc",
]),
hdrs = glob([
"src/config/*.h",
]),
copts = COPTS,
deps = [
"ray_common.so",
":streaming_cc_proto",
":streaming_util",
],
)
cc_library(
name = "streaming_message",
srcs = glob([
"src/message/*.cc",
]),
hdrs = glob([
"src/message/*.h",
]),
copts = COPTS,
deps = [
"ray_common.so",
":streaming_config",
":streaming_util",
],
)
cc_library(
name = "streaming_queue",
srcs = glob([
"src/queue/*.cc",
]),
hdrs = glob([
"src/queue/*.h",
]),
copts = COPTS,
deps = [
"core_worker_lib.so",
"ray_common.so",
"ray_util.so",
":streaming_config",
":streaming_message",
":streaming_queue_cc_proto",
":streaming_util",
"@boost//:asio",
"@boost//:thread",
],
)
cc_library(
name = "streaming_lib",
srcs = glob([
"src/*.cc",
]),
hdrs = glob([
"src/*.h",
"src/queue/*.h",
"src/test/*.h",
]),
copts = COPTS,
includes = ["src"],
visibility = ["//visibility:public"],
deps = [
"ray_common.so",
"ray_util.so",
":streaming_config",
":streaming_message",
":streaming_queue",
":streaming_util",
"@boost//:circular_buffer",
],
)
test_common_deps = [
":streaming_lib",
"//:ray_common",
"//:ray_util",
"//:core_worker_lib",
]
# streaming queue mock actor binary
cc_binary(
name = "streaming_test_worker",
srcs = glob(["src/test/*.h"]) + [
"src/test/mock_actor.cc",
],
copts = COPTS,
includes = [
"streaming/src/test",
],
deps = test_common_deps,
)
# use src/test/run_streaming_queue_test.sh to run this test
cc_binary(
name = "streaming_queue_tests",
srcs = glob(["src/test/*.h"]) + [
"src/test/streaming_queue_tests.cc",
],
copts = COPTS,
deps = test_common_deps,
)
cc_test(
name = "streaming_message_ring_buffer_tests",
srcs = [
"src/test/ring_buffer_tests.cc",
],
copts = COPTS,
includes = [
"streaming/src/test",
],
deps = test_common_deps,
)
cc_test(
name = "streaming_message_serialization_tests",
srcs = [
"src/test/message_serialization_tests.cc",
],
copts = COPTS,
deps = test_common_deps,
)
cc_test(
name = "streaming_mock_transfer",
srcs = [
"src/test/mock_transfer_tests.cc",
],
copts = COPTS,
deps = test_common_deps,
)
cc_test(
name = "streaming_util_tests",
srcs = [
"src/test/streaming_util_tests.cc",
],
copts = COPTS,
deps = test_common_deps,
)
cc_test(
name = "event_service_tests",
srcs = [
"src/test/event_service_tests.cc",
],
deps = test_common_deps,
)
python_proto_compile(
name = "streaming_py_proto",
deps = ["//streaming:streaming_proto"],
)
genrule(
name = "copy_streaming_py_proto",
srcs = [
":streaming_py_proto",
],
outs = [
"copy_streaming_py_proto.out",
],
cmd = """
set -e
set -x
WORK_DIR="$$(pwd)"
# Copy generated files.
GENERATED_DIR="$$WORK_DIR/streaming/python/generated"
rm -rf "$$GENERATED_DIR"
mkdir -p "$$GENERATED_DIR"
touch "$$GENERATED_DIR/__init__.py"
for f in $(locations //streaming:streaming_py_proto); do
cp "$$f" "$$GENERATED_DIR"
done
date > $@
""",
local = 1,
visibility = ["//visibility:public"],
)
# Streaming java
genrule(
name = "copy_jni_h",
srcs = ["@bazel_tools//tools/jdk:jni_header"],
outs = ["jni.h"],
cmd = "cp -f $< $@",
)
genrule(
name = "copy_jni_md_h",
srcs = select({
"@bazel_tools//src/conditions:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"],
"@bazel_tools//src/conditions:darwin": ["@bazel_tools//tools/jdk:jni_md_header-darwin"],
"//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"],
}),
outs = ["jni_md.h"],
cmd = "cp -f $< $@",
visibility = ["//visibility:public"],
)
cc_library(
name = "jni",
hdrs = [
":jni.h",
":jni_md.h",
],
copts = COPTS,
includes = [
".", # needed for `include <jni.h>`
],
visibility = ["//visibility:public"],
)
cc_binary(
name = "libstreaming_java.so",
srcs = glob([
"src/lib/java/*.cc",
"src/lib/java/*.h",
]),
copts = COPTS,
includes = [
"src",
],
linkshared = 1,
linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
":jni",
":streaming_lib",
"//:core_worker_lib",
"//:ray_util",
],
)