Skip to content

build: add workaround to support RBE on macOS and windows #22423

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

Merged
merged 1 commit into from
Apr 9, 2021
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
5 changes: 5 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ sass_repositories()
# Bring in bazel_toolchains for RBE setup configuration.
http_archive(
name = "bazel_toolchains",
# Patch `bazel-toolchains` to always consider the host platform as Linux. This is necessary
# because the RBE configurations are incorrectly based on the host platform and this breaks
# cross-platform remote execution. e.g. using RBE on macOS.
# See: https://github.com/bazelbuild/bazel-toolchains/issues/895
patches = ["//tools:rbe_cross_platform_workaround.patch"],
sha256 = "1adf5db506a7e3c465a26988514cfc3971af6d5b3c2218925cd6e71ee443fc3f",
strip_prefix = "bazel-toolchains-4.0.0",
urls = [
Expand Down
1 change: 1 addition & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"])
exports_files([
"system-config-tmpl.js",
"system-rxjs-operators.js",
"rbe_cross_platform_workaround.patch",
])

# Workaround for https://github.com/bazelbuild/bazel-toolchains/issues/356. We need the
Expand Down
26 changes: 26 additions & 0 deletions tools/rbe_cross_platform_workaround.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git rules/rbe_repo/util.bzl rules/rbe_repo/util.bzl
index 71a0e9e..a7db7bb 100644
--- rules/rbe_repo/util.bzl
+++ rules/rbe_repo/util.bzl
@@ -136,20 +136,7 @@ def resolve_project_root(ctx):
return mount_project_root, export_project_root, use_default_project

def os_family(ctx):
- """Retrieve the OS Family of host environment
-
- Args:
- ctx: the Bazel context object.
-
- Returns:
- Returns the name of the OS Family
- """
- os_name = ctx.os.name.lower()
- if os_name.find("windows") != -1:
- return "Windows"
- if os_name == "linux":
- return "Linux"
- return os_name
+ return "Linux"

def validate_host(ctx):
"""Perform validations of host environment to be able to run the rule.