Fix protobuf structure for empty import prefix (#8986)

052f69cde9
broke the structure of our protobufs by changing the import prefix
from "." to an empty string which ends up flattening the whole
file. This PR changes the default for tars to match the old
behavior. We can’t just change the default at the function level since
the prefix is used outside of pkg_tar and in those places an empty
string is required :(

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2021-03-02 17:26:34 +01:00 committed by GitHub
parent 11ec339f6f
commit 7287063072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,12 +207,16 @@ def proto_jars(
maven_artifact_proto_suffix = "proto",
maven_artifact_java_suffix = "java-proto",
maven_artifact_scala_suffix = "scala-proto"):
# NOTE (MK) An empty string flattens the whole structure which is
# rarely what you want, see https://github.com/bazelbuild/rules_pkg/issues/82
tar_strip_prefix = "." if not strip_import_prefix else strip_import_prefix
# Tarball containing the *.proto files.
pkg_tar(
name = "%s_tar" % name,
srcs = srcs,
extension = "tar.gz",
strip_prefix = strip_import_prefix,
strip_prefix = tar_strip_prefix,
visibility = [":__subpackages__", "//release:__subpackages__"],
)