[Bazel] Make the protobuf workspace (nearly) wildcard-buildable. (#10010)

- Add back benchmarks/datasets/BUILD.bazel to dist archive
- Change dist/build_systems.bzl to be compatible with Bazel 4.0.0.

After this, most builds can use //..., with one exception: non-Mac environments must also exclude objectivec:
`bazel build -- //... -//objectivec/...`
pull/10024/head
David L. Jones 3 years ago committed by GitHub
parent 599b08ab1c
commit e5e8378a62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      benchmarks/BUILD.bazel
  2. 15
      pkg/build_systems.bzl

@ -87,7 +87,7 @@ pkg_filegroup(
srcs = [
":dist_files",
"//benchmarks/cpp:dist_files",
# "//benchmarks/datasets:dist_files", # not in autotools dist
"//benchmarks/datasets:dist_files", # not in autotools dist
"//benchmarks/datasets/google_message1/proto2:dist_files",
"//benchmarks/datasets/google_message1/proto3:dist_files",
"//benchmarks/datasets/google_message2:dist_files",

@ -178,7 +178,7 @@ Output is CcFileList and/or ProtoFileList. Example:
# fragment generator function.
################################################################################
def _create_file_list_impl(fragment_generator):
def _create_file_list_impl(ctx, fragment_generator):
# `fragment_generator` is a function like:
# def fn(originating_rule: Label,
# varname: str,
@ -191,7 +191,6 @@ def _create_file_list_impl(fragment_generator):
# When dealing with `File` objects, the `short_path` is used to strip
# the output prefix for generated files.
def _impl(ctx):
out = ctx.outputs.out
fragments = []
@ -276,8 +275,6 @@ def _create_file_list_impl(fragment_generator):
return [DefaultInfo(files = depset([out]))]
return _impl
# Common rule attrs for rules that use `_create_file_list_impl`:
# (note that `_header` is also required)
_source_list_common_attrs = {
@ -343,6 +340,9 @@ def _cmake_var_fragment(owner, varname, prefix, entries):
entries = "\n".join([" %s%s" % (prefix, f) for f in entries]),
)
def _cmake_file_list_impl(ctx):
_create_file_list_impl(ctx, _cmake_var_fragment)
gen_cmake_file_lists = rule(
doc = """
Generates a CMake-syntax file with lists of files.
@ -361,7 +361,7 @@ For proto_library, the following are generated:
{libname}_hdrs: contains syntesized paths for generated C++ headers.
""",
implementation = _create_file_list_impl(_cmake_var_fragment),
implementation = _cmake_file_list_impl,
attrs = dict(
_source_list_common_attrs,
_header = attr.string(
@ -416,6 +416,9 @@ def _automake_var_fragment(owner, varname, prefix, entries):
)
return fragment.rstrip("\\ ") + "\n"
def _automake_file_list_impl(ctx):
_create_file_list_impl(ctx, _automake_var_fragment)
gen_automake_file_lists = rule(
doc = """
Generates an Automake-syntax file with lists of files.
@ -434,7 +437,7 @@ For proto_library, the following are generated:
{libname}_hdrs: contains syntesized paths for generated C++ headers.
""",
implementation = _create_file_list_impl(_automake_var_fragment),
implementation = _automake_file_list_impl,
attrs = dict(
_source_list_common_attrs.items(),
_header = attr.string(

Loading…
Cancel
Save