Use filegroup() internally instead of pkg_files()

pkg_files() has some odd quirks, like breaking if a filename exists in multiple directories.  filegroup() does everything we need, without these quirks.

PiperOrigin-RevId: 547523447
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent a6852ec919
commit 79af13abde
  1. 42
      BUILD
  2. 6
      cmake/BUILD.bazel
  3. 5
      python/BUILD
  4. 9
      python/dist/BUILD.bazel
  5. 35
      upb/mini_descriptor/BUILD
  6. 35
      upb/mini_table/BUILD
  7. 9
      upb/util/BUILD

42
BUILD

@ -54,7 +54,6 @@ load(
"//bazel:amalgamation.bzl",
"upb_amalgamation",
)
load("@rules_pkg//:mappings.bzl", "pkg_files")
# end:github_only
# begin:google_only
@ -1133,33 +1132,24 @@ exports_files(
)
filegroup(
name = "cmake_files",
srcs = glob([
"upb/**/*",
"third_party/**/*",
]),
visibility = ["//cmake:__pkg__"],
)
pkg_files(
name = "upb_source_files",
srcs = glob(
[
"upb/**/*.c",
"upb/**/*.h",
"upb/**/*.hpp",
"upb/**/*.inc",
],
exclude = [
"upb/**/conformance_upb.c",
"upb/reflection/stage0/**/*",
name = "source_files",
srcs = glob(
[
"upb/**/*.c",
"upb/**/*.h",
"upb/**/*.hpp",
"upb/**/*.inc",
],
),
strip_prefix = "",
visibility = ["//python/dist:__pkg__"],
exclude = [
"upb/**/conformance_upb.c",
"upb/reflection/stage0/**/*",
],
),
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only
# begin:google_only

@ -99,9 +99,9 @@ sh_test(
data = [
":copy_protos",
":gen_cmakelists",
"//:cmake_files",
"//upb/mini_descriptor:cmake_files",
"//upb/mini_table:cmake_files",
"//:source_files",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:source_files",
"@utf8_range//:utf8_range_srcs",
],
target_compatible_with = select({

@ -187,11 +187,6 @@ _message_target_compatible_with = {
"//conditions:default": [],
}
pkg_files(
name = "message_extension",
srcs = [":message_srcs"],
prefix = "python/",
)
# end:github_only
# begin:google_only
# _message_target_compatible_with = {

@ -212,18 +212,17 @@ pkg_tar(
":generated_wkt_compiler",
":utf8_range_source_files",
"//:LICENSE",
"//:upb_source_files",
"//python:message_extension",
"//upb/mini_descriptor:internal_source_files",
"//:source_files",
"//python:message_srcs",
"//upb/mini_descriptor:source_files",
"//upb/mini_table:internal_source_files",
"//upb/mini_table:source_files",
"//upb/util:util_source_files",
"//upb/util:source_files",
"@com_google_protobuf//python:python_source_files",
],
extension = "tar.gz",
package_dir = "protobuf",
package_file_name = "protobuf.tar.gz",
strip_prefix = ".",
target_compatible_with = select({
"@system_python//:none": ["@platforms//:incompatible"],
"//conditions:default": [],

@ -4,10 +4,6 @@ load(
"UPB_DEFAULT_CPPOPTS",
)
# begin:github_only
load("@rules_pkg//:mappings.bzl", "pkg_files")
# end:github_only
cc_library(
name = "internal",
srcs = [
@ -88,39 +84,16 @@ cc_test(
# begin:github_only
filegroup(
name = "cmake_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
),
visibility = ["//cmake:__pkg__"],
)
pkg_files(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
exclude = ["internal/**"],
),
prefix = "upb/mini_descriptor",
visibility = ["//python/dist:__pkg__"],
)
pkg_files(
name = "internal_source_files",
srcs = glob(
[
"internal/*.c",
"internal/*.h",
],
exclude = ["encode_test.cc"],
),
prefix = "upb/mini_descriptor/internal",
visibility = ["//python/dist:__pkg__"],
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -28,10 +28,6 @@ load(
"UPB_DEFAULT_COPTS",
)
# begin:github_only
load("@rules_pkg//:mappings.bzl", "pkg_files")
# end:github_only
cc_library(
name = "mini_table",
srcs = [
@ -80,40 +76,17 @@ cc_library(
# begin:github_only
filegroup(
name = "cmake_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
exclude = ["encode_test.cc"],
),
visibility = ["//cmake:__pkg__"],
)
pkg_files(
name = "source_files",
srcs = glob(
[
"**/*.c",
"**/*.h",
],
exclude = ["internal/**", "encode_test.cc"],
),
prefix = "upb/mini_table",
visibility = ["//python/dist:__pkg__"],
)
pkg_files(
name = "internal_source_files",
srcs = glob(
[
"internal/*.c",
"internal/*.h",
],
exclude = ["encode_test.cc"],
),
prefix = "upb/mini_table/internal",
visibility = ["//python/dist:__pkg__"],
visibility = [
"//cmake:__pkg__",
"//python/dist:__pkg__",
]
)
# end:github_only

@ -4,10 +4,6 @@ load(
"upb_proto_reflection_library",
)
# begin:github_only
load("@rules_pkg//:mappings.bzl", "pkg_files")
# end:github_only
# begin:google_only
# package(default_applicable_licenses = ["//:license"])
# end:google_only
@ -165,8 +161,8 @@ cc_test(
)
# begin:github_only
pkg_files(
name = "util_source_files",
filegroup(
name = "source_files",
srcs = [
"compare.c",
"compare.h",
@ -175,7 +171,6 @@ pkg_files(
"required_fields.c",
"required_fields.h",
],
prefix = "upb/util",
visibility = ["//python/dist:__pkg__"],
)
# end:github_only

Loading…
Cancel
Save