Skip to content

Commit 157b91d

Browse files
tensorflower-gardenergns
authored andcommitted
Update rules_python to v1.6 in XLA and TensorFlow projects.
`com_google_protobuf` and `rules_cc` initialization was moved to `python_init_rules` macros. The JAX repository update will be done [in the next step](jax-ml/jax#31709) PiperOrigin-RevId: 808689003
1 parent 72fbba3 commit 157b91d

File tree

72 files changed

+394
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+394
-609
lines changed

.bazelrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ build --host_copt=-DGRPC_BAZEL_BUILD
9696
build --action_env=GRPC_BAZEL_RUNTIME=1
9797
build --repo_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
9898
build --action_env=PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb
99-
build --repo_env=RULES_PYTHON_ENABLE_PYSTAR=0
99+
# Some targets have the same py source file, but use different
100+
# configurations via `requires-` tags. This results in an action
101+
# conflict when precompiling. Disable to avoid that problem.
102+
# See https://github.com/bazel-contrib/rules_python/issues/2445
103+
build --@rules_python//python/config_settings:precompile=force_disabled
100104

101105
# Do not do this. If enabled protobuf's core internal target
102106
# @com_google_protobuf//python:protobuf_python will start depending on a bunch

ci/official/requirements_updater/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414
# ==============================================================================
1515

16-
load("@python//:defs.bzl", "compile_pip_requirements")
1716
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
17+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
1818

1919
compile_pip_requirements(
2020
name = "requirements",

tensorflow/BUILD

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# TensorFlow is a computational framework, primarily for use in machine
33
# learning applications.
44

5+
load("@rules_cc//cc:cc_import.bzl", "cc_import")
6+
7+
# buildifier: disable=out-of-order-load
8+
# copybara:comment_begin(oss-only)
9+
load("//tensorflow:strict.default.bzl", "py_strict_library")
10+
11+
# copybara:comment_end
12+
# buildifier: enable=out-of-order-load
513
load("@bazel_skylib//lib:selects.bzl", "selects")
614
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "bool_setting")
715
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
@@ -1691,7 +1699,7 @@ generate_apis(
16911699
visibility = ["//visibility:public"],
16921700
)
16931701

1694-
py_library(
1702+
py_strict_library(
16951703
name = "tensorflow_py",
16961704
srcs_version = "PY3",
16971705
visibility = ["//visibility:public"],
@@ -1703,7 +1711,7 @@ py_library(
17031711
],
17041712
)
17051713

1706-
py_library(
1714+
py_strict_library(
17071715
name = "tensorflow_py_no_contrib",
17081716
srcs = select({
17091717
"api_version_2": [":tf_python_api_gen_v2"],

tensorflow/compiler/mlir/lite/BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
22
load("@bazel_skylib//rules:build_test.bzl", "build_test")
33
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
44
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
5-
6-
# Placeholder: load py_proto_library
5+
load("@rules_python//python:proto.bzl", "py_proto_library")
76
load("//tensorflow:tensorflow.bzl", "if_google", "if_oss", "tf_cc_binary", "tf_cc_test", "tf_native_cc_binary")
87
load("//tensorflow:tensorflow.default.bzl", "filegroup", "get_compatible_with_portable")
98
load("//tensorflow/compiler/mlir/lite:build_def.bzl", "tflite_copts_warnings")

tensorflow/compiler/mlir/lite/metrics/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Placeholder: load py_proto_library
1+
load("@rules_python//python:proto.bzl", "py_proto_library")
22
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
33
load(
44
"//tensorflow/core/platform:build_config.bzl",

tensorflow/compiler/mlir/quantization/stablehlo/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Placeholder: load py_proto_library
21
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
2+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3+
load("@rules_python//python:proto.bzl", "py_proto_library")
34
load("//tensorflow:tensorflow.bzl", "tf_cc_binary", "tf_cc_test")
45
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
56
load("//tensorflow/compiler/mlir/quantization/stablehlo:internal_visibility_allowlist.bzl", "internal_visibility_allowlist")

tensorflow/compiler/mlir/quantization/tensorflow/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
2+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3+
load("@rules_python//python:proto.bzl", "py_proto_library")
24
load("//tensorflow:strict.default.bzl", "py_strict_binary")
3-
4-
# Placeholder: load py_proto_library
55
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
66
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
77
load("//tensorflow/compiler/mlir/quantization/tensorflow:internal_visibility_allowlist.bzl", "internal_visibility_allowlist")

tensorflow/compiler/mlir/quantization/tensorflow/calibrator/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
2+
load("@rules_python//python:proto.bzl", "py_proto_library")
13
load("//tensorflow:pytype.default.bzl", "pytype_strict_contrib_test", "pytype_strict_library")
24
load("//tensorflow:strict.default.bzl", "py_strict_library")
3-
4-
# Placeholder: load py_proto_library
55
load(
66
"//tensorflow:tensorflow.bzl",
77
"tf_cc_test",

tensorflow/compiler/tf2tensorrt/BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ load(
88
"@local_xla//xla/tsl/platform/default:cuda_build_defs.bzl",
99
"cuda_rpath_flags",
1010
)
11+
load("@rules_python//python:proto.bzl", "py_proto_library")
1112
load("//tensorflow:strict.default.bzl", "py_strict_library")
12-
13-
# Placeholder: load py_proto_library
1413
load(
1514
"//tensorflow:tensorflow.bzl",
1615
"VERSION",

tensorflow/core/BUILD

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@
6161
# //tensorflow/tensorflow.bzl) will include the necessary symbols in binary
6262
# build targets.
6363

64-
# Placeholder: load py_proto_library
64+
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
6565
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda")
6666
load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt")
6767
load(
6868
"@local_xla//xla/tsl/mkl:build_defs.bzl",
6969
"if_mkl",
7070
)
71-
72-
# Placeholder: load java_proto_library
71+
load("@rules_python//python:proto.bzl", "py_proto_library")
7372
load(
7473
"//tensorflow:tensorflow.bzl",
7574
"if_android",

0 commit comments

Comments
 (0)