Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Raylet with Bazel #3806

Merged
merged 30 commits into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
308 changes: 308 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
# Bazel build
# C/C++ documentation: https://docs.bazel.build/versions/master/be/c-cpp.html

load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")

cc_binary(
name = "raylet",
srcs = ["src/ray/raylet/main.cc"],
deps = [
":ray_util",
":raylet_lib",
],
)

cc_binary(
name = "raylet_monitor",
srcs = [
"src/ray/raylet/monitor.cc",
"src/ray/raylet/monitor.h",
"src/ray/raylet/monitor_main.cc",
],
deps = [
":gcs",
":ray_util",
],
)

cc_library(
name = "raylet_lib",
srcs = glob(
[
"src/ray/raylet/*.cc",
],
exclude = [
"src/ray/raylet/mock_gcs_client.cc",
"src/ray/raylet/monitor_main.cc",
"src/ray/raylet/*_test.cc",
],
),
hdrs = glob([
"src/ray/raylet/*.h",
],),
deps = [
":gcs",
":gcs_fbs",
":node_manager_fbs",
":object_manager",
":ray_common",
":ray_util",
"@boost//:asio",
"@plasma",
"@gtest"
],
)

cc_test(
name = "lineage_cache_test",
srcs = ["src/ray/raylet/lineage_cache_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":node_manager_fbs",
":raylet_lib",
],
)

cc_test(
name = "reconstruction_policy_test",
srcs = ["src/ray/raylet/reconstruction_policy_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":node_manager_fbs",
":object_manager",
":raylet_lib"
],
)

cc_test(
name = "worker_pool_test",
srcs = ["src/ray/raylet/worker_pool_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":raylet_lib",
],
)

cc_test(
name = "logging_test",
srcs = ["src/ray/util/logging_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":ray_util",
],
)

cc_test(
name = "task_dependency_manager_test",
srcs = ["src/ray/raylet/task_dependency_manager_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":raylet_lib"
],
)

cc_test(
name = "task_test",
srcs = ["src/ray/raylet/task_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":raylet_lib",
],
)

cc_library(
name = "object_manager",
srcs = glob([
"src/ray/object_manager/*.cc",
]),
hdrs = glob([
"src/ray/object_manager/*.h",
]),
includes = [
"src",
],
deps = [
":gcs",
":object_manager_fbs",
":ray_common",
":ray_util",
"@boost//:asio",
"@plasma"
],
)

cc_binary(
name = "object_manager_test",
testonly = 1,
srcs = ["src/ray/object_manager/test/object_manager_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":object_manager",
],
)

cc_binary(
name = "object_manager_stress_test",
testonly = 1,
srcs = ["src/ray/object_manager/test/object_manager_stress_test.cc"],
deps = [
"@com_google_googletest//:gtest_main",
":object_manager",
],
)

cc_library(
name = "ray_util",
srcs = glob(
[
"src/ray/*.cc",
"src/ray/util/*.cc",
],
exclude = [
"src/ray/util/logging_test.cc",
"src/ray/util/signal_test.cc"
],
),
hdrs = glob([
"src/ray/*.h",
"src/ray/util/*.h",
]),
includes = [
"src",
],
deps = [
"@plasma",
":sha256"
]
)

cc_library(
name = "ray_common",
srcs = ["src/ray/common/client_connection.cc",
"src/ray/common/common_protocol.cc"],
hdrs = ["src/ray/common/client_connection.h",
"src/ray/common/common_protocol.h"],
includes = [
"src/ray/gcs/format",
],
deps = [
":gcs_fbs",
":node_manager_fbs",
":ray_util",
"@boost//:asio",
],
)

cc_library(
name = "sha256",
srcs = [
"src/ray/thirdparty/sha256.c",
],
hdrs = [
"src/ray/thirdparty/sha256.h",
],
includes = ["src/ray/thirdparty"],
)

cc_library(
name = "hiredis",
srcs = glob([
"src/ray/thirdparty/ae/ae.c",
"src/ray/thirdparty/hiredis/*.c",
]),
hdrs = glob([
"src/ray/thirdparty/ae/*.h",
"src/ray/thirdparty/hiredis/*.h",
"src/ray/thirdparty/hiredis/adapters/*.h",
"src/ray/thirdparty/hiredis/dict.c",
"src/ray/thirdparty/ae/ae_kqueue.c"
Copy link
Contributor Author

@pcmoritz pcmoritz Jan 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericl What's the best way to do this in a platform independent way? On linux we need ae_epoll.c here.

]),
includes = [
"src/ray/thirdparty/hiredis",
"src/ray/thirdparty/ae"
],
)

cc_library(
name = "gcs",
srcs = glob(
[
"src/ray/gcs/*.cc",
],
exclude = [
"src/ray/gcs/*_test.cc",
],
),
hdrs = glob([
"src/ray/gcs/*.h",
"src/ray/gcs/format/*.h",
]),
includes = [
"src/ray/gcs/format",
],
deps = [
":gcs_fbs",
":node_manager_fbs",
":ray_util",
":ray_common",
":hiredis",
"@boost//:asio",
],
)

cc_binary(
name = "gcs_client_test",
testonly = 1,
srcs = ["src/ray/gcs/client_test.cc"],
deps = [
":gcs",
"@com_google_googletest//:gtest_main",
],
)

cc_binary(
name = "asio_test",
testonly = 1,
srcs = ["src/ray/gcs/asio_test.cc"],
deps = [
":gcs",
"@com_google_googletest//:gtest_main",
":ray_util",
],
)

FLATC_ARGS = [
"--gen-object-api",
"--gen-mutable",
"--scoped-enums",
]

flatbuffer_cc_library(
name = "gcs_fbs",
srcs = ["src/ray/gcs/format/gcs.fbs"],
flatc_args = FLATC_ARGS,
out_prefix = "src/ray/gcs/format/",
)

flatbuffer_cc_library(
name = "common_fbs",
srcs = ["@plasma//:cpp/src/plasma/format/common.fbs"],
flatc_args = FLATC_ARGS,
out_prefix = "src/ray/common/"
)

flatbuffer_cc_library(
name = "node_manager_fbs",
srcs = ["src/ray/raylet/format/node_manager.fbs"],
flatc_args = FLATC_ARGS,
include_paths = ["src/ray/gcs/format"],
includes = [":gcs_fbs_includes"],
out_prefix = "src/ray/raylet/format/",
)

flatbuffer_cc_library(
name = "object_manager_fbs",
srcs = ["src/ray/object_manager/format/object_manager.fbs"],
flatc_args = FLATC_ARGS,
out_prefix = "src/ray/object_manager/format/",
)
37 changes: 37 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
git_repository(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this git_repository command in addition to the load command below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load brings "git_repository" into the namespace (this is needed to be compatible with the latest version of bazel)

name = "com_github_nelhage_rules_boost",
commit = "6d6fd834281cb8f8e758dd9ad76df86304bf1869",
remote = "https://github.com/nelhage/rules_boost",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this official or just some random repo on the internet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no official BAZEL support for boost, so we can be glad to have this random repo. It's the best I could find so far, short of writing build files for boost ourselves.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

)

load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
boost_deps()

http_archive(
name = "com_google_googletest",
sha256 = "ff7a82736e158c077e76188232eac77913a15dac0b22508c390ab3f88e6d6d86",
strip_prefix = "googletest-b6cd405286ed8635ece71c72f118e659f4ade3fb",
urls = [
"https://mirror.bazel.build/github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
"https://github.com/google/googletest/archive/b6cd405286ed8635ece71c72f118e659f4ade3fb.zip",
],
)

git_repository(
name = "com_github_google_flatbuffers",
remote = "https://github.com/google/flatbuffers.git",
commit = "63d51afd1196336a7d1f56a988091ef05deb1c62"
)

git_repository(
name = "gtest",
remote = "https://github.com/google/googletest",
commit = "3306848f697568aacf4bcca330f6bdd5ce671899",
)

git_repository(
name = "plasma",
build_file = "bazel/plasma.bzl",
remote = "https://github.com/apache/arrow",
commit = "dd170c983b4e2ac86fba98559471db0e9e0e8cc0"
)
Loading