Skip to content

Commit

Permalink
Add builtins exports keys for py_binary, py_test, and py_library
Browse files Browse the repository at this point in the history
This allows starting the builtin-Starlark based implementation of the rules
for Bazel (which is really mostly copy/refactoring the Google code).

Work towards bazelbuild#15897

PiperOrigin-RevId: 490246272
Change-Id: I528f347d9f9ead8311fc5d365a6a343eba0af735
  • Loading branch information
rickeylev authored and copybara-github committed Nov 22, 2022
1 parent 0eb4937 commit dd79d4d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/starlark/builtins_bzl/common/exports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ load("@_builtins//:common/objc/linking_support.bzl", "linking_support")
load("@_builtins//:common/proto/proto_common.bzl", "proto_common_do_not_use")
load("@_builtins//:common/proto/proto_library.bzl", "proto_library")
load("@_builtins//:common/proto/proto_lang_toolchain_wrapper.bzl", "proto_lang_toolchain")
load("@_builtins//:common/python/py_runtime_macro.bzl", "py_runtime")
load("@_builtins//:common/python/py_binary_macro.bzl", "py_binary")
load("@_builtins//:common/python/py_internal.bzl", "py_internal")
load("@_builtins//:common/python/py_library_macro.bzl", "py_library")
load("@_builtins//:common/python/py_runtime_macro.bzl", "py_runtime")
load("@_builtins//:common/python/py_test_macro.bzl", "py_test")
load("@_builtins//:common/python/providers.bzl", "PyInfo", "PyRuntimeInfo")
load("@_builtins//:common/java/proto/java_lite_proto_library.bzl", "java_lite_proto_library")
load("@_builtins//:common/cc/cc_library.bzl", "cc_library")
Expand Down Expand Up @@ -62,6 +65,9 @@ exported_rules = {
"+cc_library": cc_library,
"proto_lang_toolchain": proto_lang_toolchain,
"+py_runtime": py_runtime,
"-py_binary": py_binary,
"-py_test": py_test,
"-py_library": py_library,
}

# A list of Starlark functions callable from native rules implementation.
Expand Down
18 changes: 18 additions & 0 deletions src/main/starlark/builtins_bzl/common/python/py_binary_macro.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2022 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.
"""Implementation of macro-half of py_binary rule."""

def py_binary(**kwargs):
_ = kwargs # @unused
pass
18 changes: 18 additions & 0 deletions src/main/starlark/builtins_bzl/common/python/py_library_macro.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2022 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.
"""Implementation of macro-half of py_library rule."""

def py_library(**kwargs):
_ = kwargs # @unused
pass
18 changes: 18 additions & 0 deletions src/main/starlark/builtins_bzl/common/python/py_test_macro.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2022 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.
"""Implementation of macro-half of py_test rule."""

def py_test(**kwargs):
_ = kwargs # @unused
pass

0 comments on commit dd79d4d

Please sign in to comment.