From 8b81deb3b50d268fdbf2979bc0f7c906e128f38f Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Mon, 1 May 2023 15:11:07 -0700 Subject: [PATCH 1/3] Fix bug in _internal_copy_files where the rule would fail in downstream repositories. Taken from https://github.com/protocolbuffers/upb/blob/main/bazel/protobuf.patch#L42 Fixes https://github.com/protocolbuffers/protobuf/issues/12620. PiperOrigin-RevId: 528586464 --- python/internal.bzl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/python/internal.bzl b/python/internal.bzl index d9ba37ef86..af87aed786 100644 --- a/python/internal.bzl +++ b/python/internal.bzl @@ -1,4 +1,12 @@ -# Internal helpers for building the Python protobuf runtime. +""" +Internal helpers for building the Python protobuf runtime. +""" + +def _remove_cross_repo_path(path): + components = path.split("/") + if components[0] == "..": + return "/".join(components[2:]) + return path def _internal_copy_files_impl(ctx): strip_prefix = ctx.attr.strip_prefix @@ -7,10 +15,11 @@ def _internal_copy_files_impl(ctx): src_dests = [] for src in ctx.files.srcs: - if src.short_path[:len(strip_prefix)] != strip_prefix: + short_path = _remove_cross_repo_path(src.short_path) + if short_path[:len(strip_prefix)] != strip_prefix: fail("Source does not start with %s: %s" % - (strip_prefix, src.short_path)) - dest = ctx.actions.declare_file(src.short_path[len(strip_prefix):]) + (strip_prefix, short_path)) + dest = ctx.actions.declare_file(short_path[len(strip_prefix):]) src_dests.append([src, dest]) if ctx.attr.is_windows: From 8c4152a7f3f4d72d790458de220568e9c4e65f5c Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 2 May 2023 11:18:25 -0700 Subject: [PATCH 2/3] Update abseil dependency and reorder dependencies to ensure we use the version specified in protobuf_deps. PiperOrigin-RevId: 528838071 --- WORKSPACE | 21 ++++++++++++++++++--- protobuf_deps.bzl | 4 ++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 2301093274..bc601dbd3b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -7,6 +7,11 @@ local_repository( path = "examples", ) +# Load common dependencies first to ensure we use the correct version. +load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") +protobuf_deps() + + http_archive( name = "com_google_googletest", sha256 = "833bfaf9f8f508a4ef4a35e25131112ed55bf9ff5c073e272397ff38eb4d90ec", @@ -31,9 +36,19 @@ http_archive( urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27 ) -# Load common dependencies. -load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps") -protobuf_deps() +http_archive( + name = "com_google_googletest", + sha256 = "730215d76eace9dd49bf74ce044e8daa065d175f1ac891cc1d6bb184ef94e565", + strip_prefix = "googletest-f53219cdcb7b084ef57414efea92ee5b71989558", + urls = [ + "https://github.com/google/googletest/archive/f53219cdcb7b084ef57414efea92ee5b71989558.tar.gz" # 2023-03-16 + ], +) + +load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps") + +googletest_deps() +>>>>>>> 99529a220 (Update abseil dependency and reorder dependencies to ensure we use the version specified in protobuf_deps.) load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 4297b6c6cb..6ba6c12be6 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -40,8 +40,8 @@ def protobuf_deps(): _github_archive( name = "com_google_absl", repo = "https://github.com/abseil/abseil-cpp", - commit = "78be63686ba732b25052be15f8d6dee891c05749", # Abseil LTS 20230125 - sha256 = "4f356a07b9ec06ef51f943928508566e992f621ed5fa4dd588865d7bed1284cd", + commit = "b971ac5250ea8de900eae9f95e06548d14cd95fe", # Abseil LTS 20230125.2 + sha256 = "f7c2cb2c5accdcbbbd5c0c59f241a988c0b1da2a3b7134b823c0bd613b1a6880", ) if not native.existing_rule("zlib"): From 2399885f33479f1e8c92fe789107569388432ae6 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 2 May 2023 20:00:28 +0000 Subject: [PATCH 3/3] Fix merge --- WORKSPACE | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index bc601dbd3b..4c403ac43b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -36,20 +36,6 @@ http_archive( urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27 ) -http_archive( - name = "com_google_googletest", - sha256 = "730215d76eace9dd49bf74ce044e8daa065d175f1ac891cc1d6bb184ef94e565", - strip_prefix = "googletest-f53219cdcb7b084ef57414efea92ee5b71989558", - urls = [ - "https://github.com/google/googletest/archive/f53219cdcb7b084ef57414efea92ee5b71989558.tar.gz" # 2023-03-16 - ], -) - -load("@com_google_googletest//:googletest_deps.bzl", "googletest_deps") - -googletest_deps() ->>>>>>> 99529a220 (Update abseil dependency and reorder dependencies to ensure we use the version specified in protobuf_deps.) - load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") rules_jvm_external_deps()