Skip to content

Commit

Permalink
Revert "Revert "Upgrade to bazel 1.0.0""
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Oct 29, 2019
1 parent 456f08a commit e5e3f70
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 81 deletions.
2 changes: 2 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
# Create toolchain configuration for remote execution.
rbe_autoconfig(
name = "rbe_default",
# use exec_properties instead of deprecated remote_execution_properties
use_legacy_platform_definition = False,
)

load("@bazel_toolchains//rules:environments.bzl", "clang_env")
Expand Down
8 changes: 7 additions & 1 deletion bazel/grpc_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
# The set of pollers to test against if a test exercises polling
POLLERS = ["epollex", "epoll1", "poll"]

# set exec_properties = LARGE_MACHINE, to run the test on a large machine
# see //third_party/toolchains/machine_size for details
LARGE_MACHINE = { "gceMachineType" : "n1-standard-8"}

def if_not_windows(a):
return select({
"//:windows": [],
Expand Down Expand Up @@ -165,7 +169,7 @@ def ios_cc_test(
deps = ios_test_deps,
)

def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = []):
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = [], exec_properties = {}):
copts = if_mac(["-DGRPC_CFSTREAM"])
if language.upper() == "C":
copts = copts + if_not_windows(["-std=c99"])
Expand All @@ -179,6 +183,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
"size": size,
"timeout": timeout,
"exec_compatible_with": exec_compatible_with,
"exec_properties": exec_properties,
}
if uses_polling:
# the vanilla version of the test should run on platforms that only
Expand Down Expand Up @@ -207,6 +212,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
] + args["args"],
tags = (tags + ["no_windows", "no_mac"]),
exec_compatible_with = exec_compatible_with,
exec_properties = exec_properties,
)
else:
# the test behavior doesn't depend on polling, just generate the test
Expand Down
8 changes: 4 additions & 4 deletions bazel/grpc_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ def grpc_deps():
# list of releases is at https://releases.bazel.build/bazel-toolchains.html
http_archive(
name = "bazel_toolchains",
sha256 = "22ca5b8115c8673ecb627a02b606529e813961e447933863fccdf325cc5f999f",
strip_prefix = "bazel-toolchains-0.29.5",
sha256 = "e9bab54199722935f239cb1cd56a80be2ac3c3843e1a6d3492e2bc11f9c21daf",
strip_prefix = "bazel-toolchains-1.0.0",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/0.29.5/bazel-toolchains-0.29.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/0.29.5.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/1.0.0/bazel-toolchains-1.0.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/1.0.0.tar.gz",
],
)

Expand Down
2 changes: 1 addition & 1 deletion templates/tools/dockerfile/bazel.include
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Bazel installation

# Must be in sync with tools/bazel
ENV BAZEL_VERSION 0.29.1
ENV BAZEL_VERSION 1.0.0

# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1
Expand Down
6 changes: 3 additions & 3 deletions test/core/gprpp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package", "LARGE_MACHINE")

licenses(["notice"]) # Apache v2

Expand Down Expand Up @@ -111,9 +111,9 @@ grpc_cc_test(
grpc_cc_test(
name = "mpscq_test",
srcs = ["mpscq_test.cc"],
exec_compatible_with = ["//third_party/toolchains/machine_size:large"],
exec_properties = LARGE_MACHINE,
language = "C++",
tags = ["no_windows"], # machine_size:large is not configured for windows RBE
tags = ["no_windows"], # LARGE_MACHINE is not configured for windows RBE
deps = [
"//:gpr",
"//test/core/util:grpc_test_util",
Expand Down
6 changes: 3 additions & 3 deletions test/core/iomgr/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary", "grpc_package", "LARGE_MACHINE")

licenses(["notice"]) # Apache v2

Expand All @@ -39,9 +39,9 @@ grpc_cc_library(
grpc_cc_test(
name = "combiner_test",
srcs = ["combiner_test.cc"],
exec_compatible_with = ["//third_party/toolchains/machine_size:large"],
exec_properties = LARGE_MACHINE,
language = "C++",
tags = ["no_windows"], # machine_size:large is not configured for windows RBE
tags = ["no_windows"], # LARGE_MACHINE is not configured for windows RBE
deps = [
"//:gpr",
"//:grpc",
Expand Down
6 changes: 3 additions & 3 deletions test/cpp/qps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

licenses(["notice"]) # Apache v2

load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary", "grpc_package", "LARGE_MACHINE")
load("//test/cpp/qps:qps_benchmark_script.bzl", "qps_json_driver_batch", "json_run_localhost_batch")

grpc_package(name = "test/cpp/qps")
Expand Down Expand Up @@ -169,8 +169,8 @@ grpc_cc_test(
grpc_cc_test(
name = "qps_openloop_test",
srcs = ["qps_openloop_test.cc"],
exec_compatible_with = ["//third_party/toolchains/machine_size:large"],
tags = ["no_windows"], # machine_size:large is not configured for windows RBE
exec_properties = LARGE_MACHINE,
tags = ["no_windows"], # LARGE_MACHINE is not configured for windows RBE
deps = [
":benchmark_config",
":driver_impl",
Expand Down
80 changes: 19 additions & 61 deletions third_party/toolchains/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@ platform(
"@bazel_tools//platforms:windows",
"@bazel_tools//tools/cpp:msvc",
],
remote_execution_properties = """
properties: {
name: "container-image"
value:"docker://gcr.io/grpc-testing/rbe_windows_toolchain@sha256:75728e7d6d804090f71095e5fec627b18cfa1f47adc52096c209f2a687e06b2e"
}
properties: {
name: "gceMachineType" # Small machines for majority of tests.
value: "n1-highmem-2"
}
properties:{
name: "OSFamily"
value: "Windows"
}
""",
exec_properties = {
"container-image" : "docker://gcr.io/grpc-testing/rbe_windows_toolchain@sha256:75728e7d6d804090f71095e5fec627b18cfa1f47adc52096c209f2a687e06b2e",
"gceMachineType" : "n1-highmem-2",
"OSFamily" : "Windows",
},
)

# RBE Ubuntu16_04 r346485
Expand All @@ -53,29 +43,13 @@ platform(
constraint_values = [
"//third_party/toolchains/machine_size:standard",
],
remote_execution_properties = """
{PARENT_REMOTE_EXECUTION_PROPERTIES}
properties: {
name: "gceMachineType" # Small machines for majority of tests.
value: "n1-highmem-2"
}
properties: {
name: "dockerSiblingContainers"
value: "false"
}
properties: {
name: "dockerNetwork"
value: "off"
}
properties: {
name: "dockerAddCapabilities"
value: "SYS_PTRACE"
}
properties: {
name: "dockerPrivileged"
value: "true"
}
""",
exec_properties = {
"gceMachineType" : "n1-highmem-2", # Small machines for majority of tests
"dockerSiblingContainers" : "false",
"dockerNetwork" : "off",
"dockerAddCapabilities" : "SYS_PTRACE",
"dockerPrivileged" : "true"
},
)

platform(
Expand All @@ -84,29 +58,13 @@ platform(
constraint_values = [
"//third_party/toolchains/machine_size:large",
],
remote_execution_properties = """
{PARENT_REMOTE_EXECUTION_PROPERTIES}
properties: {
name: "gceMachineType" # Large machines for some resource demanding tests (TSAN).
value: "n1-standard-8"
}
properties: {
name: "dockerSiblingContainers"
value: "false"
}
properties: {
name: "dockerNetwork"
value: "off"
}
properties: {
name: "dockerAddCapabilities"
value: "SYS_PTRACE"
}
properties: {
name: "dockerPrivileged"
value: "true"
}
""",
exec_properties = {
"gceMachineType" : "n1-standard-8", # Large machines for some resource demanding tests (TSAN).
"dockerSiblingContainers" : "false",
"dockerNetwork" : "off",
"dockerAddCapabilities" : "SYS_PTRACE",
"dockerPrivileged" : "true"
},
)

platform(
Expand Down
2 changes: 1 addition & 1 deletion tools/bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ then
exec -a "$0" "${BAZEL_REAL}" "$@"
fi

VERSION=0.29.1
VERSION=1.0.0

echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation."

Expand Down
2 changes: 1 addition & 1 deletion tools/dockerfile/test/bazel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ RUN python3.6 -m ensurepip && \
# Bazel installation

# Must be in sync with tools/bazel
ENV BAZEL_VERSION 0.29.1
ENV BAZEL_VERSION 1.0.0

# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1
Expand Down
2 changes: 1 addition & 1 deletion tools/dockerfile/test/sanity/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ENV CLANG_TIDY=clang-tidy
# Bazel installation

# Must be in sync with tools/bazel
ENV BAZEL_VERSION 0.29.1
ENV BAZEL_VERSION 1.0.0

# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
ENV DISABLE_BAZEL_WRAPPER 1
Expand Down
2 changes: 1 addition & 1 deletion tools/internal_ci/windows/bazel_rbe.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@rem TODO(jtattermusch): make this generate less output
@rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync
choco install bazel -y --version 0.29.1 --limit-output
choco install bazel -y --version 1.0.0 --limit-output

cd github/grpc
set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH%
Expand Down
2 changes: 1 addition & 1 deletion tools/remote_build/rbe_common.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ build:ubsan --test_timeout=3600
# how to update the bazel toolchain for ubsan:
# - check for the latest released version in https://github.com/bazelbuild/bazel-toolchains/tree/master/configs/experimental/ubuntu16_04_clang
# - you might need to update the bazel_toolchains dependency in grpc_deps.bzl
build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.2/bazel_0.28.0/ubsan:toolchain
build:ubsan --crosstool_top=@bazel_toolchains//configs/experimental/ubuntu16_04_clang/1.3/bazel_0.29.1/ubsan:toolchain

0 comments on commit e5e3f70

Please sign in to comment.