Skip to content
Merged
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
12 changes: 9 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ tb_http_archive(
urls = tb_mirror_urls("https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.1.0.tar.gz"),
)

tb_http_archive(
http_archive(
name = "tb_rules_java",
sha256 = "b2519fabcd360529071ade8732f208b3755489ed7668b118f8f90985c0e51324",
strip_prefix = "rules_java-8.6.1",
Expand All @@ -305,11 +305,17 @@ local_repository(
path = "third_party/compatibility_proxy",
)

# Protobuf 6.31.1 still expects a pip-style requirements helper repo from its
# WORKSPACE macros. TensorBoard only needs the narrow `install_deps()` /
# `requirement()` surface that protobuf actually loads in this configuration.
local_repository(
name = "protobuf_pip_deps",
path = "third_party/protobuf_pip_deps",
)

# Protobuf's python/dist BUILD also references
# `external/protobuf_pip_deps_setuptools/site-packages`, so keep this separate
# repo shape even though it only vendors an empty placeholder tree here.
local_repository(
name = "protobuf_pip_deps_setuptools",
path = "third_party/protobuf_pip_deps_setuptools",
Expand Down Expand Up @@ -350,14 +356,14 @@ protobuf_deps()
#
# Keep this aligned with TensorFlow 2.21's Bazel-side gRPC dependency so the
# grpc plugin and protobuf repository stay on a known-compatible combination.
tb_http_archive(
http_archive(
name = "com_github_grpc_grpc",
sha256 = "dd6a2fa311ba8441bbefd2764c55b99136ff10f7ea42954be96006a2723d33fc",
strip_prefix = "grpc-1.74.0",
urls = tb_mirror_urls("https://github.com/grpc/grpc/archive/refs/tags/v1.74.0.tar.gz"),
)

tb_http_archive(
http_archive(
name = "build_bazel_rules_swift",
sha256 = "9919ed1d8dae509645bfd380537ae6501528d8de971caebed6d5185b9970dc4d",
urls = tb_mirror_urls("https://github.com/bazelbuild/rules_swift/releases/download/2.1.1/rules_swift.2.1.1.tar.gz"),
Expand Down
2 changes: 1 addition & 1 deletion tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ def testServeSourceFileContentOfThisTestFile(self):
data = json.loads(response.get_data())
self.assertEqual(data["host_name"], _HOST_NAME)
self.assertEqual(data["file_path"], _CURRENT_FILE_FULL_PATH)
with open(__file__, "r") as f:
with open(__file__, "r", newline="") as f:
lines = f.read().split("\n")
self.assertEqual(data["lines"], lines)

Expand Down
8 changes: 6 additions & 2 deletions third_party/protobuf_pip_deps/requirements.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
Protobuf's Bazel macros load a pip-style requirements helper that provides
`requirement()` and `install_deps()`. TensorBoard only needs a very small
subset of that surface here, so this file supplies just the labels
protobuf actually asks for here.
protobuf 6.31.1 actually asks for here:

* `install_deps()` from protobuf's WORKSPACE setup
* `requirement("setuptools")` from `python/dist/BUILD.bazel`
* `requirement("numpy")` from protobuf's numpy test target
"""

def requirement(name):
Expand All @@ -15,5 +19,5 @@ def requirement(name):
fail("Unsupported protobuf pip dependency: %s" % name)

def install_deps():
"""Compatibility no-op for callers that expect an install_deps symbol."""
"""Compatibility no-op for protobuf's WORKSPACE dependency hook."""
return None
3 changes: 3 additions & 0 deletions third_party/protobuf_pip_deps_setuptools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Protobuf's python/dist wheel genrule exports this exact external repo path on
# PYTHONPATH, so preserve the repo/target shape even though TensorBoard only
# needs an empty placeholder tree here.
filegroup(
name = "site_packages",
srcs = glob(["site-packages/**"]),
Expand Down
20 changes: 2 additions & 18 deletions third_party/repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,8 @@ def tb_mirror_urls(url):
url,
]

def _get_link_dict(ctx, link_files, build_file):
"""Builds the destination->source map for files linked into a repo rule."""
link_dict = {ctx.path(v): ctx.path(Label(k)) for k, v in link_files.items()}
if build_file:
link_dict[ctx.path("BUILD.bazel")] = ctx.path(Label(build_file))
return link_dict

def _tb_http_archive_impl(ctx):
"""Repository-rule implementation with optional patching and linked files."""
link_dict = _get_link_dict(ctx, ctx.attr.link_files, ctx.attr.build_file)

"""Repository-rule implementation with optional patching."""
patch_files = ctx.attr.patch_file
# Resolve patch labels up front so Bazel reports missing patch inputs before
# download/extract work has completed.
Expand All @@ -53,11 +44,6 @@ def _tb_http_archive_impl(ctx):
if patch_file:
ctx.patch(patch_file, strip = 1)

# Link in any repository-local BUILD/link files after extraction and patching.
for dst, src in link_dict.items():
ctx.delete(dst)
ctx.symlink(src, dst)

_tb_http_archive = repository_rule(
implementation = _tb_http_archive_impl,
attrs = {
Expand All @@ -66,13 +52,11 @@ _tb_http_archive = repository_rule(
"strip_prefix": attr.string(),
"type": attr.string(),
"patch_file": attr.string_list(),
"build_file": attr.string(),
"link_files": attr.string_dict(),
},
)

def tb_http_archive(name, sha256, urls, **kwargs):
"""Downloads a mirrored archive and creates a TensorBoard external repo."""
"""Downloads a mirrored archive for TensorBoard-specific repo wiring."""
if len(urls) < 2:
fail("tb_http_archive(urls) must have redundant URLs.")

Expand Down
Loading