Skip to content

Commit 6ba939c

Browse files
authored
refactor(bazel): move perfetto to bzlmod (#5226)
1 parent bcee63b commit 6ba939c

File tree

7 files changed

+42
-22
lines changed

7 files changed

+42
-22
lines changed

MODULE.bazel

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ bazel_dep(name = "bazel_features", version = "1.35.0")
55
bazel_dep(name = "bazel_skylib", version = "1.8.1")
66
bazel_dep(name = "rules_shell", version = "0.6.0")
77

8-
# needed by perfetto, but not actually used.
9-
bazel_dep(name = "rules_android", version = "0.6.4")
10-
11-
# protobuf for use with perfetto
12-
# Updated protobuf can't be imported reliably under WORKSPACE logic in Bazel 8, so we need to use
13-
# bzlmod.
14-
bazel_dep(name = "protobuf", version = "32.0", repo_name = "com_google_protobuf")
15-
168
# abseil is used by protobuf and tcmalloc.
179
bazel_dep(name = "abseil-cpp", version = "20250814.0")
1810

@@ -49,3 +41,5 @@ include("//build/deps:deps.MODULE.bazel")
4941
include("//build/deps:nodejs.MODULE.bazel")
5042

5143
include("//build/deps:python.MODULE.bazel")
44+
45+
include("//build/deps:v8.MODULE.bazel")

build/deps/v8.MODULE.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# For use with perfetto, see https://github.com/google/perfetto/blob/main/bazel/standalone/README.md
2+
local_path_override(
3+
module_name = "perfetto_cfg",
4+
path = "build/perfetto",
5+
)
6+
7+
bazel_dep(name = "perfetto", version = "0.0.0")
8+
9+
archive_override(
10+
module_name = "perfetto",
11+
patches = ["//:patches/perfetto.patch"],
12+
integrity = "sha256-T5F4h9xXdYfTGMa+AXmewHIkS1cgxu5ierfyJMOwqJA=",
13+
strip_prefix = "perfetto-51.2",
14+
url = "https://github.com/google/perfetto/archive/refs/tags/v51.2.tar.gz",
15+
)

build/deps/v8.bzl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,3 @@ def deps_v8():
6969
patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
7070
remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
7171
)
72-
73-
http_archive(
74-
name = "perfetto",
75-
integrity = "sha256-T5F4h9xXdYfTGMa+AXmewHIkS1cgxu5ierfyJMOwqJA=",
76-
strip_prefix = "perfetto-51.2",
77-
url = "https://github.com/google/perfetto/archive/refs/tags/v51.2.tar.gz",
78-
)
79-
80-
# For use with perfetto
81-
native.new_local_repository(
82-
name = "perfetto_cfg",
83-
build_file_content = "",
84-
path = "build/perfetto",
85-
)

build/perfetto/BUILD

Whitespace-only changes.

build/perfetto/MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
module(name = "perfetto_cfg")

build/perfetto/perfetto_cfg.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ PERFETTO_CONFIG = struct(
6060
protobuf_py = [],
6161
pandas_py = [],
6262
tp_vendor_py = [],
63+
tp_resolvers_py = [],
6364

6465
# There are multiple configurations for the function name demangling
6566
# logic in trace processor:

patches/perfetto.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/MODULE.bazel b/MODULE.bazel
2+
index a321128..cd672d2 100644
3+
--- MODULE.bazel
4+
+++ MODULE.bazel
5+
@@ -12,6 +12,10 @@
6+
# See the License for the specific language governing permissions and
7+
# limitations under the License.
8+
9+
+module(name = "perfetto")
10+
+bazel_dep(name = "perfetto_cfg", version = "0.0.0")
11+
+bazel_dep(name = "platforms", version = "1.0.0")
12+
+bazel_dep(name = "protobuf", version = "32.0", repo_name = "com_google_protobuf")
13+
bazel_dep(name = "rules_android", version = "0.6.0")
14+
15+
android_sdk_repository_extension = use_extension(
16+
@@ -43,4 +47,5 @@ android_ndk_repository_extension.configure(
17+
)
18+
use_repo(android_ndk_repository_extension, "androidndk")
19+
20+
-register_toolchains("@androidndk//:all")
21+
+# Avoid eagerly referencing non-existent NDK when not doing Android development
22+
+# register_toolchains("@androidndk//:all")

0 commit comments

Comments
 (0)