Remove cc_proto_library helper methods from semantics file.
PiperOrigin-RevId: 448951632
diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl
deleted file mode 100644
index c675939b..0000000
--- a/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 2021 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""cc_proto_library rule."""
-
-load(":common/cc/semantics.bzl", "semantics")
-
-cc_common = _builtins.toplevel.cc_common
-CcInfo = _builtins.toplevel.CcInfo
-ProtoInfo = _builtins.toplevel.ProtoInfo
-
-def _rule_impl(ctx):
- if len(ctx.attr.deps) == 0:
- fail("no deps attribute found; expected one.")
-
- if len(ctx.attr.deps) > 1:
- # actually label_list is used only for consistency with other deps attributes.
- fail("more than one deps attribute found; expected only one.")
- dep = ctx.attr.deps[0]
-
- files = semantics.get_proto_cc_files(dep)
-
- cc_files = [f for f in files if f.basename.endswith("pb.cc") or
- f.basename.endswith("pb.h") or f.basename.endswith("proto.h")]
-
- cc_files_provider = semantics.get_cc_files_provider(cc_files)
- files_provider = DefaultInfo(files = depset(cc_files))
-
- if CcInfo in dep:
- cc_info_provider = dep[CcInfo]
- else:
- fail("proto_library rule must generate CcInfo (have cc_api_version > 0).")
-
- return [cc_files_provider, files_provider, cc_info_provider]
-
-def _aspect_impl():
- pass
-
-_cc_proto_aspect = aspect(
- implementation = _aspect_impl,
- attr_aspects = ["deps"],
- fragments = semantics.get_proto_fragments(),
- required_providers = [ProtoInfo],
- provides = [CcInfo],
- attrs = semantics.get_proto_attrs(),
-)
-
-def _create_cc_proto_library_rule():
- return rule(
- output_to_genfiles = True,
- implementation = _rule_impl,
- attrs = {
- "deps": attr.label_list(
- # aspects = [_cc_proto_aspect], todo(dbabkin): return aspet after fix b/123988498
- # TODO(cmita): use Starlark aspect after b/145508948, or when proto_library
- # doesn't need to propagate
- aspects = [_cc_proto_aspect],
- allow_rules = ["proto_library"],
- providers = [ProtoInfo, CcInfo], # todo(dbabkin): remove CcInfo after fix b/123988498
- ),
- },
- )
-
-cc_proto_library = _create_cc_proto_library_rule()
diff --git a/src/main/starlark/builtins_bzl/common/cc/semantics.bzl b/src/main/starlark/builtins_bzl/common/cc/semantics.bzl
index c9d3cb8..4f8fc56 100644
--- a/src/main/starlark/builtins_bzl/common/cc/semantics.bzl
+++ b/src/main/starlark/builtins_bzl/common/cc/semantics.bzl
@@ -18,19 +18,9 @@
cc_common = _builtins.toplevel.cc_common
-def _get_proto_attrs():
- return {}
-
-def _get_proto_fragments():
- return []
-
def _get_proto_aspects():
return []
-# buildifier: disable=unused-variable
-def _get_cc_files_provider(cc_files):
- return None
-
def _get_proto_cc_files(dep):
return dep[DefaultInfo].files.to_list()
@@ -198,8 +188,5 @@
get_coverage_attrs = _get_coverage_attrs,
get_coverage_env = _get_coverage_env,
get_proto_cc_files = _get_proto_cc_files,
- get_cc_files_provider = _get_cc_files_provider,
get_proto_aspects = _get_proto_aspects,
- get_proto_fragments = _get_proto_fragments,
- get_proto_attrs = _get_proto_attrs,
)