• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Redefine native symbols with a new name as a workaround for
16# exporting them in `//third_party/bazel_rules/rules_proto/proto:defs.bzl` with their original name.
17#
18# While we cannot force users to load these symbol due to the lack of a
19# allowlisting mechanism, we can still export them and tell users to
20# load it to make a future migration to pure Starlark easier.
21
22"""Lovely workaround to be able to expose native constants pretending to be Starlark."""
23
24# Unused with Bazel@HEAD, used by the compatibility layer for older Bazel versions
25
26# buildifier: disable=native-java
27native_java_common = java_common
28
29# buildifier: disable=native-java
30NativeJavaInfo = JavaInfo
31
32# buildifier: disable=native-java
33NativeJavaPluginInfo = JavaPluginInfo
34
35# Used for some private native APIs that we can't replicate just yet in Starlark
36# getattr() for loading this file with Bazel 6, where we won't use this
37def get_internal_java_common():
38    if hasattr(native_java_common, "internal_DO_NOT_USE"):
39        return native_java_common.internal_DO_NOT_USE()
40    return None
41