Remove compatibility code for old Bazel versions.

pull/13171/head
Joshua Haberman 5 years ago
parent c1357afb2e
commit 6c5d5afc43
  1. 15
      bazel/repository_defs.bzl
  2. 33
      bazel/upb_proto_library.bzl
  3. 6
      bazel/workspace_deps.bzl

@ -1,15 +0,0 @@
# A hacky way to work around the fact that native.bazel_version is only
# available from WORKSPACE macros, not BUILD macros or rules.
#
# Hopefully we can remove this if/when this is fixed:
# https://github.com/bazelbuild/bazel/issues/8305
def _impl(repository_ctx):
s = "bazel_version = \"" + native.bazel_version + "\""
repository_ctx.file("bazel_version.bzl", s)
repository_ctx.file("BUILD", "")
bazel_version_repository = repository_rule(
implementation = _impl,
local = True,
)

@ -6,11 +6,6 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
# copybara:strip_for_google3_begin
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@upb_bazel_version//:bazel_version.bzl", "bazel_version")
# copybara:strip_end
# Generic support code #########################################################
_is_bazel = not hasattr(native, "genmpm")
@ -79,34 +74,6 @@ def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos):
unsupported_features = ctx.disabled_features,
)
# copybara:strip_for_google3_begin
if bazel_version == "0.24.1":
# Compatibility code until gRPC is on 0.25.2 or later.
compilation_info = cc_common.compile(
ctx = ctx,
feature_configuration = feature_configuration,
cc_toolchain = toolchain,
srcs = srcs,
hdrs = hdrs,
compilation_contexts = compilation_contexts,
)
linking_info = cc_common.link(
ctx = ctx,
feature_configuration = feature_configuration,
cc_toolchain = toolchain,
cc_compilation_outputs = compilation_info.cc_compilation_outputs,
linking_contexts = linking_contexts,
)
return CcInfo(
compilation_context = compilation_info.compilation_context,
linking_context = linking_info.linking_context,
)
if not versions.is_at_least("0.25.2", bazel_version):
fail("upb requires Bazel >=0.25.2 or 0.24.1")
# copybara:strip_end
blaze_only_args = {}
if not _is_bazel:

@ -2,14 +2,8 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//bazel:repository_defs.bzl", "bazel_version_repository")
def upb_deps():
maybe(
bazel_version_repository,
name = "upb_bazel_version",
)
maybe(
git_repository,
name = "com_google_absl",

Loading…
Cancel
Save