2019-04-29 13:02:49 +08:00
load ( " @bazel_tools//tools/build_defs/repo:git.bzl " , " git_repository " , " new_git_repository " )
2020-02-28 10:18:56 -08:00
load ( " @bazel_tools//tools/build_defs/repo:http.bzl " , " http_archive " , " http_file " )
2019-04-29 13:02:49 +08:00
2020-03-01 14:04:06 -08:00
def urlsplit ( url ) :
""" Splits a URL like " https://example.com/a/b?c=d&e#f " into a tuple:
( " https " , [ " example " , " com " ] , [ " a " , " b " ] , [ " c=d " , " e " ] , " f " )
A trailing slash will result in a correspondingly empty final path component .
2019-11-22 09:59:32 -08:00
"""
2020-03-01 14:04:06 -08:00
split_on_anchor = url . split ( " # " , 1 )
split_on_query = split_on_anchor [ 0 ] . split ( " ? " , 1 )
split_on_scheme = split_on_query [ 0 ] . split ( " :// " , 1 )
if len ( split_on_scheme ) < = 1 : # Scheme is optional
split_on_scheme = [ None ] + split_on_scheme [ : 1 ]
split_on_path = split_on_scheme [ 1 ] . split ( " / " )
return {
" scheme " : split_on_scheme [ 0 ] ,
" netloc " : split_on_path [ 0 ] . split ( " . " ) ,
" path " : split_on_path [ 1 : ] ,
" query " : split_on_query [ 1 ] . split ( " & " ) if len ( split_on_query ) > 1 else None ,
" fragment " : split_on_anchor [ 1 ] if len ( split_on_anchor ) > 1 else None ,
}
2021-08-21 11:33:11 -07:00
def auto_http_archive (
* ,
name = None ,
url = None ,
urls = True ,
build_file = None ,
build_file_content = None ,
strip_prefix = True ,
* * kwargs ) :
2020-03-01 14:04:06 -08:00
""" Intelligently choose mirrors based on the given URL for the download.
Either url or urls is required .
2019-11-22 09:59:32 -08:00
If name == None , it is auto - deduced , but this is NOT recommended .
2020-03-01 14:04:06 -08:00
If urls == True , mirrors are automatically chosen .
2019-11-22 09:59:32 -08:00
If build_file == True , it is auto - deduced .
If strip_prefix == True , it is auto - deduced .
"""
2020-03-01 14:04:06 -08:00
DOUBLE_SUFFIXES_LOWERCASE = [ ( " tar " , " bz2 " ) , ( " tar " , " gz " ) , ( " tar " , " xz " ) ]
2022-05-23 12:01:40 +01:00
mirror_prefixes = [ " https://mirror.bazel.build/ " , " https://storage.googleapis.com/bazel-mirror " ]
2020-03-01 14:04:06 -08:00
canonical_url = url if url != None else urls [ 0 ]
url_parts = urlsplit ( canonical_url )
2021-08-21 11:33:11 -07:00
url_except_scheme = ( canonical_url . replace ( url_parts [ " scheme " ] + " :// " , " " ) if url_parts [ " scheme " ] != None else canonical_url )
2020-03-01 14:04:06 -08:00
url_path_parts = url_parts [ " path " ]
url_filename = url_path_parts [ - 1 ]
2021-08-21 11:33:11 -07:00
url_filename_parts = ( url_filename . rsplit ( " . " , 2 ) if ( tuple ( url_filename . lower ( ) . rsplit ( " . " , 2 ) [ - 2 : ] ) in
DOUBLE_SUFFIXES_LOWERCASE ) else url_filename . rsplit ( " . " , 1 ) )
2020-03-01 14:04:06 -08:00
is_github = url_parts [ " netloc " ] == [ " github " , " com " ]
if name == None : # Deduce "com_github_user_project_name" from "https://github.com/user/project-name/..."
name = " _ " . join ( url_parts [ " netloc " ] [ : : - 1 ] + url_path_parts [ : 2 ] ) . replace ( " - " , " _ " )
2022-01-21 13:56:40 +08:00
# auto appending ray project namespace prefix for 3rd party library reusing.
2020-03-01 14:04:06 -08:00
if build_file == True :
2022-01-21 13:56:40 +08:00
build_file = " @com_github_ray_project_ray// %s : %s " % ( " bazel " , " BUILD. " + name )
2019-11-22 09:59:32 -08:00
2020-03-01 14:04:06 -08:00
if urls == True :
prefer_url_over_mirrors = is_github
2021-08-21 11:33:11 -07:00
urls = [
mirror_prefix + url_except_scheme
for mirror_prefix in mirror_prefixes
if not canonical_url . startswith ( mirror_prefix )
]
2020-03-01 14:04:06 -08:00
urls . insert ( 0 if prefer_url_over_mirrors else len ( urls ) , canonical_url )
2019-11-22 09:59:32 -08:00
else :
2020-03-01 14:04:06 -08:00
print ( " No implicit mirrors used because urls were explicitly provided " )
2019-11-22 09:59:32 -08:00
2020-03-01 14:04:06 -08:00
if strip_prefix == True :
2020-06-29 11:27:56 -07:00
prefix_without_v = url_filename_parts [ 0 ]
if prefix_without_v . startswith ( " v " ) and prefix_without_v [ 1 : 2 ] . isdigit ( ) :
# GitHub automatically strips a leading 'v' in version numbers
prefix_without_v = prefix_without_v [ 1 : ]
2021-08-21 11:33:11 -07:00
strip_prefix = ( url_path_parts [ 1 ] + " - " + prefix_without_v if is_github and url_path_parts [ 2 : 3 ] == [ " archive " ] else url_filename_parts [ 0 ] )
2019-11-22 09:59:32 -08:00
2021-08-21 11:33:11 -07:00
return http_archive (
name = name ,
url = url ,
urls = urls ,
build_file = build_file ,
build_file_content = build_file_content ,
strip_prefix = strip_prefix ,
* * kwargs
)
2019-05-28 16:04:16 -07:00
2019-11-22 09:59:32 -08:00
def ray_deps_setup ( ) :
2021-05-13 10:34:09 -07:00
# Explicitly bring in protobuf dependency to work around
# https://github.com/ray-project/ray/issues/14117
http_archive (
name = " com_google_protobuf " ,
2022-06-18 16:06:56 -07:00
strip_prefix = " protobuf-3.19.4 " ,
urls = [ " https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz " ] ,
sha256 = " 3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568 " ,
2021-05-13 10:34:09 -07:00
)
2022-01-21 13:56:40 +08:00
# NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests
# all of http/git_repository should add prefix for patches defined in ray directory.
2020-03-01 14:04:06 -08:00
auto_http_archive (
2020-03-09 18:49:54 -07:00
name = " com_github_antirez_redis " ,
2022-01-21 13:56:40 +08:00
build_file = " @com_github_ray_project_ray//bazel:BUILD.redis " ,
2021-03-10 17:17:01 -06:00
url = " https://github.com/redis/redis/archive/6.0.10.tar.gz " ,
sha256 = " 900cb82227bac58242c9b7668e7113cd952253b256fe04bbdab1b78979cf255a " ,
2020-06-29 18:16:32 -07:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:redis-quiet.patch " ,
2020-06-29 18:16:32 -07:00
] ,
)
auto_http_archive (
name = " com_github_redis_hiredis " ,
2022-01-21 13:56:40 +08:00
build_file = " @com_github_ray_project_ray//bazel:BUILD.hiredis " ,
2020-07-09 18:45:44 -07:00
url = " https://github.com/redis/hiredis/archive/392de5d7f97353485df1237872cb682842e8d83f.tar.gz " ,
sha256 = " 2101650d39a8f13293f263e9da242d2c6dee0cda08d343b2939ffe3d95cf3b8b " ,
2019-11-29 15:32:45 -08:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:hiredis-windows-msvc.patch " ,
2019-11-29 15:32:45 -08:00
] ,
)
2020-09-16 11:54:05 +08:00
auto_http_archive (
name = " com_github_spdlog " ,
2022-01-21 13:56:40 +08:00
build_file = " @com_github_ray_project_ray//bazel:BUILD.spdlog " ,
2020-09-16 11:54:05 +08:00
urls = [ " https://github.com/gabime/spdlog/archive/v1.7.0.zip " ] ,
sha256 = " c8f1e1103e0b148eb8832275d8e68036f2fdd3975a1199af0e844908c56f6ea5 " ,
)
2021-08-21 11:33:11 -07:00
2020-07-02 13:29:34 -07:00
auto_http_archive (
2020-03-09 18:49:54 -07:00
name = " com_github_tporadowski_redis_bin " ,
2022-01-21 13:56:40 +08:00
build_file = " @com_github_ray_project_ray//bazel:BUILD.redis " ,
2020-07-02 13:29:34 -07:00
strip_prefix = None ,
2020-11-11 18:15:27 -08:00
url = " https://github.com/tporadowski/redis/releases/download/v5.0.9/Redis-x64-5.0.9.zip " ,
2021-08-21 11:33:11 -07:00
sha256 = " b09565b22b50c505a5faa86a7e40b6683afb22f3c17c5e6a5e35fc9b7c03f4c2 " ,
2020-02-28 10:18:56 -08:00
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " rules_jvm_external " ,
2020-03-01 14:04:06 -08:00
url = " https://github.com/bazelbuild/rules_jvm_external/archive/2.10.tar.gz " ,
sha256 = " 5c1b22eab26807d5286ada7392d796cbc8425d3ef9a57d114b79c5f8ef8aca7c " ,
2019-04-29 13:02:49 +08:00
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " bazel_common " ,
2020-04-04 01:36:01 -04:00
url = " https://github.com/google/bazel-common/archive/084aadd3b854cad5d5e754a7e7d958ac531e6801.tar.gz " ,
sha256 = " a6e372118bc961b182a3a86344c0385b6b509882929c6b12dc03bb5084c775d5 " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2020-07-09 09:02:35 -07:00
auto_http_archive (
name = " bazel_skylib " ,
strip_prefix = None ,
url = " https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz " ,
sha256 = " 97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44 " ,
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-11-22 16:10:47 -08:00
# This rule is used by @com_github_nelhage_rules_boost and
# declaring it here allows us to avoid patching the latter.
name = " boost " ,
build_file = " @com_github_nelhage_rules_boost//:BUILD.boost " ,
2021-10-09 18:48:35 -07:00
sha256 = " 83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1 " ,
url = " https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2 " ,
2019-11-22 16:10:47 -08:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:boost-exception-no_warn_typeid_evaluated.patch " ,
2019-11-22 16:10:47 -08:00
] ,
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_github_nelhage_rules_boost " ,
2019-11-22 16:10:47 -08:00
# If you update the Boost version, remember to update the 'boost' rule.
2021-10-09 18:48:35 -07:00
url = " https://github.com/nelhage/rules_boost/archive/652b21e35e4eeed5579e696da0facbe8dba52b1f.tar.gz " ,
sha256 = " c1b8b2adc3b4201683cf94dda7eef3fc0f4f4c0ea5caa3ed3feffe07e1fb5b15 " ,
2019-12-01 15:05:50 -08:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:rules_boost-windows-linkopts.patch " ,
2019-12-01 15:05:50 -08:00
] ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_github_google_flatbuffers " ,
2020-03-01 14:04:06 -08:00
url = " https://github.com/google/flatbuffers/archive/63d51afd1196336a7d1f56a988091ef05deb1c62.tar.gz " ,
sha256 = " 3f469032571d324eabea88d7014c05fec8565a5877dbe49b2a52d8d1a0f18e63 " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_google_googletest " ,
2021-09-08 11:15:34 -07:00
url = " https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz " ,
sha256 = " b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5 " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_github_gflags_gflags " ,
2020-03-01 14:04:06 -08:00
url = " https://github.com/gflags/gflags/archive/e171aa2d15ed9eb17054558e0b3a6a413bb01067.tar.gz " ,
sha256 = " b20f58e7f210ceb0e768eb1476073d0748af9b19dfbbf53f4fd16e3fb49c5ac8 " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " cython " ,
2019-11-22 09:59:32 -08:00
build_file = True ,
2021-12-26 23:26:08 -05:00
url = " https://github.com/cython/cython/archive/3028e8c7ac296bc848d996e397c3354b3dbbd431.tar.gz " ,
sha256 = " 31ea23c2231ddee8572a2a5effd54952e16a1b44e9a4cb3eb645418f8accf20d " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2021-12-23 16:54:31 +08:00
auto_http_archive (
name = " com_github_johnynek_bazel_jar_jar " ,
url = " https://github.com/johnynek/bazel_jar_jar/archive/171f268569384c57c19474b04aebe574d85fde0d.tar.gz " ,
sha256 = " 97c5f862482a05f385bd8f9d28a9bbf684b0cf3fae93112ee96f3fb04d34b193 " ,
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " io_opencensus_cpp " ,
2020-07-09 12:44:38 +08:00
url = " https://github.com/census-instrumentation/opencensus-cpp/archive/b14a5c0dcc2da8a7fc438fab637845c73438b703.zip " ,
sha256 = " 6592e07672e7f7980687f6c1abda81974d8d379e273fea3b54b6c4d855489b9d " ,
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:opencensus-cpp-harvest-interval.patch " ,
" @com_github_ray_project_ray//thirdparty/patches:opencensus-cpp-shutdown-api.patch " ,
2021-08-21 11:33:11 -07:00
] ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 16:04:16 -07:00
2019-04-29 13:02:49 +08:00
# OpenCensus depends on Abseil so we have to explicitly pull it in.
# This is how diamond dependencies are prevented.
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_google_absl " ,
2021-11-19 14:09:40 -08:00
url = " https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz " ,
sha256 = " dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4 " ,
2019-04-29 13:02:49 +08:00
)
2019-05-28 14:29:35 +08:00
2019-04-29 13:02:49 +08:00
# OpenCensus depends on jupp0r/prometheus-cpp
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-04-29 13:02:49 +08:00
name = " com_github_jupp0r_prometheus_cpp " ,
2020-03-01 14:04:06 -08:00
url = " https://github.com/jupp0r/prometheus-cpp/archive/60eaa4ea47b16751a8e8740b05fe70914c68a480.tar.gz " ,
sha256 = " ec825b802487ac18b0d98e2e8b7961487b12562f8f82e424521d0a891d9e1373 " ,
2019-11-26 14:49:24 -08:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:prometheus-windows-headers.patch " ,
2019-11-26 14:49:24 -08:00
# https://github.com/jupp0r/prometheus-cpp/pull/225
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:prometheus-windows-zlib.patch " ,
" @com_github_ray_project_ray//thirdparty/patches:prometheus-windows-pollfd.patch " ,
2021-08-21 11:33:11 -07:00
] ,
2019-04-29 13:02:49 +08:00
)
2019-06-17 19:00:50 +08:00
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-06-17 19:00:50 +08:00
name = " com_github_grpc_grpc " ,
2019-12-20 17:22:35 -08:00
# NOTE: If you update this, also update @boringssl's hash.
2022-04-26 10:49:54 -07:00
url = " https://github.com/grpc/grpc/archive/refs/tags/v1.45.2.tar.gz " ,
sha256 = " e18b16f7976aab9a36c14c38180f042bb0fd196b75c9fd6a20a2b5f934876ad6 " ,
2019-11-21 15:32:48 -08:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch " ,
" @com_github_ray_project_ray//thirdparty/patches:grpc-python.patch " ,
2019-11-21 15:32:48 -08:00
] ,
2019-06-26 05:31:19 +08:00
)
2021-12-07 14:35:46 -08:00
http_archive (
2019-12-20 17:22:35 -08:00
# This rule is used by @com_github_grpc_grpc, and using a GitHub mirror
# provides a deterministic archive hash for caching. Explanation here:
2021-12-07 14:35:46 -08:00
# https://github.com/grpc/grpc/blob/1ff1feaa83e071d87c07827b0a317ffac673794f/bazel/grpc_deps.bzl#L189
# Ensure this rule matches the rule used by grpc's bazel/grpc_deps.bzl
2019-12-20 17:22:35 -08:00
name = " boringssl " ,
2021-12-07 14:35:46 -08:00
sha256 = " e168777eb0fc14ea5a65749a2f53c095935a6ea65f38899a289808fb0c221dc4 " ,
strip_prefix = " boringssl-4fb158925f7753d80fb858cb0239dff893ef9f15 " ,
urls = [
" https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/4fb158925f7753d80fb858cb0239dff893ef9f15.tar.gz " ,
" https://github.com/google/boringssl/archive/4fb158925f7753d80fb858cb0239dff893ef9f15.tar.gz " ,
] ,
2019-12-20 17:22:35 -08:00
)
2020-03-01 14:04:06 -08:00
auto_http_archive (
2019-11-08 15:58:28 -08:00
name = " rules_proto_grpc " ,
2020-03-01 14:04:06 -08:00
url = " https://github.com/rules-proto-grpc/rules_proto_grpc/archive/a74fef39c5fe636580083545f76d1eab74f6450d.tar.gz " ,
sha256 = " 2f6606151ec042e23396f07de9e7dcf6ca9a5db1d2b09f0cc93a7fc7f4008d1b " ,
2019-06-17 19:00:50 +08:00
)
2020-03-27 23:01:08 +08:00
auto_http_archive (
name = " msgpack " ,
build_file = True ,
url = " https://github.com/msgpack/msgpack-c/archive/8085ab8721090a447cf98bb802d1406ad7afe420.tar.gz " ,
sha256 = " 83c37c9ad926bbee68d564d9f53c6cbb057c1f755c264043ddd87d89e36d15bb " ,
2020-03-30 16:29:54 -07:00
patches = [
2022-01-21 13:56:40 +08:00
" @com_github_ray_project_ray//thirdparty/patches:msgpack-windows-iovec.patch " ,
2020-03-30 16:29:54 -07:00
] ,
2020-03-27 23:01:08 +08:00
)
2020-08-18 11:32:42 -07:00
http_archive (
name = " io_opencensus_proto " ,
strip_prefix = " opencensus-proto-0.3.0/src " ,
urls = [ " https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz " ] ,
sha256 = " b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0 " ,
)
2021-07-05 12:01:25 +08:00
http_archive (
name = " nlohmann_json " ,
strip_prefix = " json-3.9.1 " ,
urls = [ " https://github.com/nlohmann/json/archive/v3.9.1.tar.gz " ] ,
sha256 = " 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b " ,
build_file = " @com_github_ray_project_ray//bazel:BUILD.nlohmann_json " ,
)
2021-09-09 00:41:53 -07:00
auto_http_archive (
name = " rapidjson " ,
url = " https://github.com/Tencent/rapidjson/archive/v1.1.0.zip " ,
build_file = True ,
sha256 = " 8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab " ,
)
2022-04-03 12:58:22 +08:00
# The following should be removed after this commit
# (https://github.com/bazelbuild/bazel/commit/676a0c8dea0e7782e47a386396e386a51566087f) released.
http_archive (
name = " platforms " ,
urls = [
" https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz " ,
" https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz " ,
] ,
sha256 = " 379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407 " ,
)
2022-05-26 02:58:14 +08:00
# Hedron's Compile Commands Extractor for Bazel
# https://github.com/hedronvision/bazel-compile-commands-extractor
http_archive (
name = " hedron_compile_commands " ,
# Replace the commit hash in both places (below) with the latest, rather than using the stale one here.
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
2022-06-08 15:00:49 +08:00
url = " https://github.com/hedronvision/bazel-compile-commands-extractor/archive/2e8b7654fa10c44b9937453fa4974ed2229d5366.tar.gz " ,
strip_prefix = " bazel-compile-commands-extractor-2e8b7654fa10c44b9937453fa4974ed2229d5366 " ,
2022-05-26 02:58:14 +08:00
# When you first run this tool, it'll recommend a sha256 hash to put here with a message like: "DEBUG: Rule 'hedron_compile_commands' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = ..."
2022-06-08 15:00:49 +08:00
sha256 = " 7fbbbc05c112c44e9b406612e6a7a7f4789a6918d7aacefef4c35c105286930c " ,
2022-05-26 02:58:14 +08:00
)