Skip to content

Commit 0fdcc3e

Browse files
committed
Upgrade rules_scala, tensorflow, bazel_features. Get build passing except for UI build failure
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 054e2f6 commit 0fdcc3e

7 files changed

Lines changed: 201 additions & 43 deletions

WORKSPACE

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pl_register_cc_toolchains()
1919
# Install Pixie Labs Dependencies.
2020
pl_deps()
2121

22+
load("@bazel_features//:deps.bzl", "bazel_features_deps")
23+
24+
bazel_features_deps()
2225

2326
# Order is important. Try to go from most basic/primitive to higher level packages.
2427
# - go_rules_dependencies
@@ -58,19 +61,19 @@ load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
5861

5962
grpc_deps()
6063

61-
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
64+
load("@io_bazel_rules_scala//scala:deps.bzl", "rules_scala_dependencies")
6265

63-
scala_version = "2.13.12"
66+
rules_scala_dependencies()
6467

65-
scala_config(scala_version = scala_version)
68+
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
6669

67-
load("@io_bazel_rules_scala//scala:scala.bzl", "rules_scala_setup", "rules_scala_toolchain_deps_repositories")
70+
scala_version = "2.13.16"
6871

69-
rules_scala_setup()
72+
scala_config(scala_version = scala_version)
7073

71-
rules_scala_toolchain_deps_repositories(fetch_sources = True)
74+
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains", "scala_toolchains")
7275

73-
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
76+
scala_toolchains(fetch_sources = True, twitter_scrooge = True)
7477

7578
scala_register_toolchains()
7679

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/protobuf.bzl b/protobuf.bzl
2+
--- a/protobuf.bzl
3+
+++ b/protobuf.bzl
4+
@@ -637,6 +637,21 @@ def internal_py_proto_library(
5+
**kargs
6+
)
7+
8+
+def py_proto_library(**kargs):
9+
+ """Deprecated alias for use before Bazel 5.3.
10+
+
11+
+ This is provided for backwards compatibility only. Users should migrate
12+
+ to the py_proto_library rule from bazel/py_proto_library.bzl instead.
13+
+
14+
+ Args:
15+
+ **kargs: arguments that are passed to internal_py_proto_library.
16+
+
17+
+ """
18+
+
19+
+ # buildifier: disable=native-py-proto
20+
+ internal_py_proto_library(**kargs)
21+
+
22+
+
23+
def _source_proto_library(
24+
name,
25+
srcs = [],
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
2+
index f28f12927db..cc1b1ea29b9 100644
3+
--- a/tensorflow/tensorflow.bzl
4+
+++ b/tensorflow/tensorflow.bzl
5+
@@ -3027,9 +3027,7 @@ _local_genrule_internal = rule(
6+
# Wrap the rule in a macro so we can pass in exec_compatible_with.
7+
def _local_genrule(**kwargs):
8+
_local_genrule_internal(
9+
- exec_compatible_with = [
10+
- "@local_execution_config_platform//:platform_constraint",
11+
- ],
12+
+ exec_compatible_with = [],
13+
**kwargs
14+
)
15+
16+
diff --git a/tensorflow/tensorflow.default.bzl b/tensorflow/tensorflow.default.bzl
17+
index fc6793e5d74..1585754a602 100644
18+
--- a/tensorflow/tensorflow.default.bzl
19+
+++ b/tensorflow/tensorflow.default.bzl
20+
@@ -1,15 +1,5 @@
21+
"""Default (OSS) build versions of TensorFlow general-purpose build extensions."""
22+
23+
-load(
24+
- "@local_xla//third_party/py/rules_pywrap:pywrap.default.bzl",
25+
- _pywrap_aware_cc_import = "pywrap_aware_cc_import",
26+
- _pywrap_aware_filegroup = "pywrap_aware_filegroup",
27+
- _pywrap_aware_genrule = "pywrap_aware_genrule",
28+
- _pywrap_binaries = "pywrap_binaries",
29+
- _pywrap_common_library = "pywrap_common_library",
30+
- _pywrap_library = "pywrap_library",
31+
- _stripped_cc_info = "stripped_cc_info",
32+
-)
33+
load(
34+
"//tensorflow:tensorflow.bzl",
35+
_ADDITIONAL_API_INDEXABLE_SETTINGS = "ADDITIONAL_API_INDEXABLE_SETTINGS",
36+
@@ -107,10 +97,15 @@ tf_disable_ptxas_warning_flags = _tf_disable_ptxas_warning_flags
37+
replace_with_portable_tf_lib_when_required = _replace_with_portable_tf_lib_when_required
38+
tf_python_framework_friends = _tf_python_framework_friends
39+
pywrap_aware_tf_cc_shared_object = _pywrap_aware_tf_cc_shared_object
40+
-pywrap_aware_filegroup = _pywrap_aware_filegroup
41+
-pywrap_aware_genrule = _pywrap_aware_genrule
42+
-pywrap_aware_cc_import = _pywrap_aware_cc_import
43+
-pywrap_library = _pywrap_library
44+
-pywrap_common_library = _pywrap_common_library
45+
-stripped_cc_info = _stripped_cc_info
46+
-pywrap_binaries = _pywrap_binaries
47+
+
48+
+# Stub out pywrap symbols that require @python_version_repo
49+
+def _not_implemented(*args, **kwargs):
50+
+ fail("pywrap rules are disabled")
51+
+
52+
+pywrap_aware_filegroup = _not_implemented
53+
+pywrap_aware_genrule = _not_implemented
54+
+pywrap_aware_cc_import = _not_implemented
55+
+pywrap_library = _not_implemented
56+
+pywrap_common_library = _not_implemented
57+
+stripped_cc_info = _not_implemented
58+
+pywrap_binaries = _not_implemented
59+
diff --git a/tensorflow/tf_version.default.bzl b/tensorflow/tf_version.default.bzl
60+
index 6b2374cc96c..95cbf574544 100644
61+
--- a/tensorflow/tf_version.default.bzl
62+
+++ b/tensorflow/tf_version.default.bzl
63+
@@ -1,10 +1,5 @@
64+
"""Default (OSS) TensorFlow wheel version suffix data."""
65+
66+
-load(
67+
- "@tf_wheel_version_suffix//:wheel_version_suffix.bzl",
68+
- "SEMANTIC_WHEEL_VERSION_SUFFIX",
69+
- "WHEEL_VERSION_SUFFIX",
70+
-)
71+
-
72+
-VERSION_SUFFIX = WHEEL_VERSION_SUFFIX
73+
-SEMANTIC_VERSION_SUFFIX = SEMANTIC_WHEEL_VERSION_SUFFIX
74+
+# Stub out wheel version suffix (not needed for TF Lite builds)
75+
+VERSION_SUFFIX = ""
76+
+SEMANTIC_VERSION_SUFFIX = ""
77+
diff --git a/tensorflow/workspace1.bzl b/tensorflow/workspace1.bzl
78+
index 399ff8f7579..af35b6d1972 100644
79+
--- a/tensorflow/workspace1.bzl
80+
+++ b/tensorflow/workspace1.bzl
81+
@@ -15,8 +15,8 @@ def workspace(with_rules_cc = True):
82+
Args:
83+
with_rules_cc: Unused, to be removed soon.
84+
"""
85+
- llvm_setup(name = "llvm-project")
86+
- native.register_toolchains("@local_config_python//:py_toolchain")
87+
+ # llvm_setup(name = "llvm-project")
88+
+ # native.register_toolchains("@local_config_python//:py_toolchain")
89+
rules_pkg_dependencies()
90+
91+
closure_repositories()
92+
diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl
93+
index 9e49ab40b25..fc13a5172d7 100644
94+
--- a/tensorflow/workspace2.bzl
95+
+++ b/tensorflow/workspace2.bzl
96+
@@ -105,11 +105,11 @@ def _initialize_third_party():
97+
98+
# Toolchains & platforms required by Tensorflow to build.
99+
def _tf_toolchains():
100+
- native.register_execution_platforms("@local_execution_config_platform//:platform")
101+
- native.register_toolchains("@local_execution_config_python//:py_toolchain")
102+
+ # native.register_execution_platforms("@local_execution_config_platform//:platform")
103+
+ # native.register_toolchains("@local_execution_config_python//:py_toolchain")
104+
105+
# Loads all external repos to configure RBE builds.
106+
- initialize_rbe_configs()
107+
+ # initialize_rbe_configs()
108+
109+
# Note that we check the minimum bazel version in WORKSPACE.
110+
clang6_configure(name = "local_config_clang6")

bazel/repositories.bzl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,29 @@ def _cc_deps():
121121
# Dependencies with native bazel build files.
122122

123123
_bazel_repo("upb")
124-
_bazel_repo("com_google_protobuf", patches = ["//bazel/external:protobuf_text_format_v31_part1.patch", "//bazel/external:protobuf_text_format_v31_part2.patch"], patch_args = ["-p1"])
124+
_bazel_repo("com_google_protobuf", patches = ["//bazel/external:protobuf_text_format_v31_part1.patch", "//bazel/external:protobuf_text_format_v31_part2.patch", "//bazel/external:protobuf_py_proto_library.patch"], patch_args = ["-p1"])
125125
# _bazel_repo("com_google_protobuf", patches = ["//bazel/external:protobuf_text_format.patch", "//bazel/external:protobuf_warning.patch"], patch_args = ["-p1"])
126126
_bazel_repo("com_github_grpc_grpc", patches = ["//bazel/external:grpc_go_toolchain.patch"], patch_args = ["-p1"])
127127

128128
_bazel_repo("boringssl", patches = ["//bazel/external:boringssl.patch"], patch_args = ["-p0"])
129129
_bazel_repo("com_google_benchmark")
130130
_bazel_repo("com_google_googletest")
131+
_bazel_repo("googletest") # Alias for deps that use this name
131132
_bazel_repo("com_github_gflags_gflags")
132133
_bazel_repo("com_github_google_glog")
133134
_bazel_repo("com_google_absl")
134135
_bazel_repo("abseil-cpp") # Alias for gRPC/Protobuf
135136
_bazel_repo("com_google_flatbuffers")
136137
_bazel_repo("cpuinfo", patches = ["//bazel/external:cpuinfo.patch"], patch_args = ["-p1"])
137-
_bazel_repo("org_tensorflow", patches = ["//bazel/external:tensorflow_disable_llvm.patch", "//bazel/external:tensorflow_disable_mirrors.patch", "//bazel/external:tensorflow_disable_py.patch"], patch_args = ["-p1"])
138+
# _bazel_repo("org_tensorflow", patches = ["//bazel/external:tensorflow_disable_llvm.patch", "//bazel/external:tensorflow_disable_mirrors.patch", "//bazel/external:tensorflow_disable_py.patch"], patch_args = ["-p1"])
139+
_bazel_repo("org_tensorflow", patches = ["//bazel/external:tensorflow_disable_py_v2.20.patch"], patch_args = ["-p1"])
140+
141+
# Stub CUDA repository for TensorFlow (we don't need CUDA support)
142+
native.new_local_repository(
143+
name = "local_config_cuda",
144+
path = "bazel/external/local_config_cuda",
145+
build_file_content = "",
146+
)
138147
_bazel_repo("com_github_neargye_magic_enum")
139148
_bazel_repo("com_github_thoughtspot_threadstacks")
140149
_bazel_repo("com_googlesource_code_re2", patches = ["//bazel/external:re2_warning.patch"], patch_args = ["-p1"])
@@ -245,6 +254,7 @@ def _pl_deps():
245254
_bazel_repo("io_bazel_rules_go", patches = ["//bazel/external:rules_go.patch"], patch_args = ["-p1"])
246255
_bazel_repo("rules_java")
247256
_bazel_repo("io_bazel_rules_scala")
257+
_bazel_repo("rules_scala")
248258
_bazel_repo("rules_jvm_external")
249259
_bazel_repo("rules_foreign_cc")
250260
_bazel_repo("io_bazel_rules_k8s")
@@ -255,6 +265,8 @@ def _pl_deps():
255265
_bazel_repo("com_github_bazelbuild_buildtools")
256266
_bazel_repo("com_github_fmeum_rules_meta")
257267
_bazel_repo("com_google_protobuf_javascript", patches = ["//bazel/external:protobuf_javascript.patch"], patch_args = ["-p1"])
268+
_bazel_repo("bazel_features")
269+
_bazel_repo("with_cfg.bzl")
258270

259271
_com_llvm_lib()
260272
_cc_deps()

bazel/repository_locations.bzl

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ REPOSITORY_LOCATIONS = dict(
237237
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20250512.1.tar.gz"],
238238
),
239239
com_google_benchmark = dict(
240-
sha256 = "3aff99169fa8bdee356eaa1f691e835a6e57b1efeadb8a0f9f228531158245ac",
240+
sha256 = "d26789a2b46d8808a48a4556ee58ccc7c497fcd4c0af9b90197674a81e04798a",
241241
strip_prefix = "benchmark-1.8.5",
242242
urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.8.5.tar.gz"],
243243
),
@@ -439,16 +439,23 @@ REPOSITORY_LOCATIONS = dict(
439439
],
440440
),
441441
io_bazel_rules_scala = dict(
442-
sha256 = "3b00fa0b243b04565abb17d3839a5f4fa6cc2cac571f6db9f83c1982ba1e19e5",
442+
sha256 = "a4700d6e6cdf13cf85e29029ec998e2ec3ba94791606ec83d2c96e3c5b0aebed",
443443
urls = [
444-
"https://github.com/bazelbuild/rules_scala/releases/download/v6.5.0/rules_scala-v6.5.0.tar.gz",
444+
"https://github.com/bazelbuild/rules_scala/releases/download/v7.0.0/rules_scala-v7.0.0.tar.gz",
445445
],
446-
strip_prefix = "rules_scala-6.5.0",
446+
strip_prefix = "rules_scala-7.0.0",
447+
),
448+
rules_scala = dict(
449+
sha256 = "a4700d6e6cdf13cf85e29029ec998e2ec3ba94791606ec83d2c96e3c5b0aebed",
450+
urls = [
451+
"https://github.com/bazelbuild/rules_scala/releases/download/v7.0.0/rules_scala-v7.0.0.tar.gz",
452+
],
453+
strip_prefix = "rules_scala-7.0.0",
447454
),
448455
org_tensorflow = dict(
449-
sha256 = "99c732b92b1b37fc243a559e02f9aef5671771e272758aa4aec7f34dc92dac48",
450-
strip_prefix = "tensorflow-2.11.0",
451-
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.tar.gz"],
456+
sha256 = "a640d1f97be316a09301dfc9347e3d929ad4d9a2336e3ca23c32c93b0ff7e5d0",
457+
strip_prefix = "tensorflow-2.20.0",
458+
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.20.0.tar.gz"],
452459
),
453460
org_libc_musl = dict(
454461
sha256 = "7d5b0b6062521e4627e099e4c9dc8248d32a30285e959b7eecaa780cf8cfd4a4",
@@ -462,9 +469,9 @@ REPOSITORY_LOCATIONS = dict(
462469
urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.8.0.tar.gz"],
463470
),
464471
rules_java = dict(
465-
sha256 = "c5bc17e17bb62290b1fd8fdd847a2396d3459f337a7e07da7769b869b488ec26",
472+
sha256 = "a64ab04616e76a448c2c2d8165d836f0d2fb0906200d0b7c7376f46dd62e59cc",
466473
urls = [
467-
"https://github.com/bazelbuild/rules_java/releases/download/8.6.1/rules_java-8.6.1.tar.gz",
474+
"https://github.com/bazelbuild/rules_java/releases/download/8.6.2/rules_java-8.6.2.tar.gz",
468475
],
469476
# strip_prefix = "rules_java-8.6.1",
470477
),
@@ -515,6 +522,24 @@ REPOSITORY_LOCATIONS["abseil-cpp"] = dict(
515522
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20250512.1.tar.gz"],
516523
)
517524

525+
REPOSITORY_LOCATIONS["with_cfg.bzl"] = dict(
526+
sha256 = "c7af6227d24499438fa0bb96fe4034e163d8c807b06f7c0645f3654448268b84",
527+
strip_prefix = "with_cfg.bzl-0.11.0",
528+
urls = ["https://github.com/fmeum/with_cfg.bzl/releases/download/v0.11.0/with_cfg.bzl-v0.11.0.tar.gz"],
529+
)
530+
531+
REPOSITORY_LOCATIONS["bazel_features"] = dict(
532+
sha256 = "07271d0f6b12633777b69020c4cb1eb67b1939c0cf84bb3944dc85cc250c0c01",
533+
strip_prefix = "bazel_features-1.38.0",
534+
urls = ["https://github.com/bazel-contrib/bazel_features/releases/download/v1.38.0/bazel_features-v1.38.0.tar.gz"],
535+
)
536+
537+
REPOSITORY_LOCATIONS["googletest"] = dict(
538+
sha256 = "65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c",
539+
strip_prefix = "googletest-1.17.0",
540+
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.17.0.tar.gz"],
541+
)
542+
518543
# To modify one of the forked repos below:
519544
# 1. Make the changes to the repo and push the changes to the `pixie` on github.
520545
# 2. Update the commit below to point to the commit hash of the new `pixie` branch.

bazel/thrift.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge")
1817
load("@rules_jvm_external//:defs.bzl", "maven_install")
1918

2019
def thrift_deps(scala_version):
21-
twitter_scrooge()
20+
# twitter_scrooge is now set up via scala_toolchains(twitter_scrooge = True) in WORKSPACE
2221

2322
finagle_version = "22.7.0"
2423
scala_minor_version = ".".join(scala_version.split(".")[:2])

bazel/toolchain_transitions.bzl

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,14 @@
1414
#
1515
# SPDX-License-Identifier: Apache-2.0
1616

17-
load("@com_github_fmeum_rules_meta//meta:defs.bzl", "meta")
17+
load("@with_cfg.bzl", "with_cfg")
1818
load("//bazel/test_runners/qemu_with_kernel:runner.bzl", "qemu_with_kernel_interactive_runner")
1919

20-
java_graal_binary = meta.wrap_with_transition(
21-
native.java_binary,
22-
{
23-
"java_runtime_version": meta.replace_with("remotejdk_openjdk_graal_17"),
24-
},
25-
executable = True,
26-
)
20+
java_graal_binary, _java_graal_binary_internal = with_cfg(native.java_binary).set(
21+
"java_runtime_version", "remotejdk_openjdk_graal_17").build()
2722

28-
cc_clang_binary = meta.wrap_with_transition(
29-
native.cc_binary,
30-
{
31-
"@//bazel/cc_toolchains:compiler": meta.replace_with("clang"),
32-
"@//bazel/cc_toolchains:libc_version": meta.replace_with("glibc2_36"),
33-
},
34-
executable = True,
35-
)
23+
cc_clang_binary, _cc_clang_binary_internal = with_cfg(native.cc_binary).set(
24+
Label("@//bazel/cc_toolchains:compiler"), "clang").build()
3625

37-
qemu_interactive_runner = meta.wrap_with_transition(
38-
qemu_with_kernel_interactive_runner,
39-
{
40-
"@//bazel/cc_toolchains:libc_version": meta.replace_with("glibc2_36"),
41-
},
42-
executable = True,
43-
)
26+
qemu_interactive_runner, _qemu_interactive_runner_internal = with_cfg(qemu_with_kernel_interactive_runner).set(
27+
Label("@//bazel/cc_toolchains:libc_version"), "glibc2_36").build()

0 commit comments

Comments
 (0)