From 04957b106174080e839b60c07c3a4c052646102b Mon Sep 17 00:00:00 2001 From: Ivo List Date: Fri, 16 Sep 2022 16:55:12 +0000 Subject: [PATCH] Make upb backwards and forwards compatible with Bazel 4.x, 3.5.x and LTS --- upb/bindings/lua/lua_proto_library.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upb/bindings/lua/lua_proto_library.bzl b/upb/bindings/lua/lua_proto_library.bzl index bb565327f4..0db161b19c 100644 --- a/upb/bindings/lua/lua_proto_library.bzl +++ b/upb/bindings/lua/lua_proto_library.bzl @@ -57,13 +57,13 @@ def _get_real_short_path(file): def _get_real_root(ctx, file): real_short_path = _get_real_short_path(file) root = file.path[:-len(real_short_path) - 1] - if not _is_google3 and ctx.rule.attr.strip_import_prefix: + if not _is_google3 and ctx.rule.attr.strip_import_prefix and ctx.rule.attr.strip_import_prefix != "DO_NOT_STRIP": root = paths.join(root, ctx.rule.attr.strip_import_prefix[1:]) return root def _generate_output_file(ctx, src, extension): package = ctx.label.package - if not _is_google3 and ctx.rule.attr.strip_import_prefix: + if not _is_google3 and ctx.rule.attr.strip_import_prefix and ctx.rule.attr.strip_import_prefix != "DO_NOT_STRIP": package = package[len(ctx.rule.attr.strip_import_prefix):] real_short_path = _get_real_short_path(src) real_short_path = paths.relativize(real_short_path, package)