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

[WIP] Add bazelrisk file to build hiredis #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=5.4.1
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ http_archive(
http_archive(
name = "hiredis",
build_file_content = all_content,
strip_prefix = "hiredis-1.0.0",
urls = ["https://github.com/redis/hiredis/archive/v1.0.0.tar.gz"],
sha256 = "2a0b5fe5119ec973a0c1966bfc4bd7ed39dbce1cb6d749064af9121fe971936f",
strip_prefix = "hiredis-1.2.0",
urls = ["https://github.com/redis/hiredis/archive/v1.2.0.tar.gz"],
sha256 = "82ad632d31ee05da13b537c124f819eb88e18851d9cb0c30ae0552084811588c",
)

# gloo source code repository
Expand Down
21 changes: 21 additions & 0 deletions pygloo/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external")
load("@rules_foreign_cc//tools/build_defs:make.bzl", "make")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@pybind11_bazel//:build_defs.bzl", "pybind_library")
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")

Expand Down Expand Up @@ -27,6 +28,26 @@ make(
static_libraries = ["libhiredis.a"],
)

# cc_library(
# name = "hiredis",
# srcs = glob(
# [
# "*.c",
# "*.h",
# ],
# exclude =
# [
# "test.c",
# ],
# ),
# hdrs = glob([
# "*.h",
# "adapters/*.h",
# ]),
# include_prefix = "hiredis",
# visibility = ["//visibility:public"],
# )

cmake_external(
name = "gloo",
# Values to be passed as -Dkey=value on the CMake command line;
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def bazel_invoke(invoker, cmdline, *args, **kwargs):
candidates.append(os.path.join(home, ".bazel", "bin", "bazel"))
result = None
for i, cmd in enumerate(candidates):
print("SANG-TODO cmd", cmd)
try:
result = invoker([cmd] + cmdline, *args, **kwargs)
break
Expand Down Expand Up @@ -78,22 +79,25 @@ def build():
raise RuntimeError(msg)

bazel_env = dict(os.environ, PYTHON3_BIN_PATH=sys.executable)
print("SANG-TODO bazel_env", bazel_env)

version_info = bazel_invoke(subprocess.check_output, ["--version"])
print("SANG-TODO bazel version: ", version_info)
bazel_version_str = version_info.rstrip().decode("utf-8").split(" ", 1)[1]
bazel_version_split = bazel_version_str.split(".")
bazel_version_digits = [
"".join(takewhile(str.isdigit, s)) for s in bazel_version_split
]
bazel_version = tuple(map(int, bazel_version_digits))
print("SANG-TODO bazel version", bazel_version)
if bazel_version < SUPPORTED_BAZEL:
logger.warning("Expected Bazel version {} but found {}".format(
".".join(map(str, SUPPORTED_BAZEL)), bazel_version_str))

bazel_targets = ["//pygloo:all"]
return bazel_invoke(
subprocess.check_call,
["build", "--verbose_failures", "--"] + bazel_targets,
["build", "--verbose_failures", "--subcommands", "--"] + bazel_targets,
env=bazel_env)


Expand Down
Loading