Skip to content

Commit b369051

Browse files
committed
chore: wip [skip ci]
1 parent 167766a commit b369051

File tree

5 files changed

+62
-11
lines changed

5 files changed

+62
-11
lines changed

BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
2+
3+
# Codspeed mode flag for configuration
4+
string_flag(
5+
name = "codspeed_mode",
6+
build_setting_default = "off",
7+
values = [
8+
"off",
9+
"instrumentation",
10+
"walltime",
11+
],
12+
visibility = ["//visibility:public"],
13+
)

MODULE.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ module(name = "codspeed", version = "1.3.0")
33
bazel_dep(name = "rules_cc", version = "0.0.17")
44
bazel_dep(name = "bazel_skylib", version = "1.7.1")
55
bazel_dep(name = "platforms", version = "0.0.10")
6+
7+
# Google Benchmark dependency (for perfcounters support)
8+
bazel_dep(name = "libpfm", version = "4.11.0.bcr.1")
9+
10+
# Fetch instrument_hooks dependency
11+
instrument_hooks_extension = use_extension("//bazel:extensions.bzl", "instrument_hooks_extension")
12+
use_repo(instrument_hooks_extension, "instrument_hooks")

bazel/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file marks the bazel directory as a package
2+
exports_files(["extensions.bzl"])

WORKSPACE.bzlmod renamed to bazel/extensions.bzl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# WORKSPACE.bzlmod
2-
# This file provides dependencies that are not available in the Bazel Central Registry.
3-
# When Bzlmod is enabled, this file takes precedence over WORKSPACE.
1+
"""Bazel module extensions for codspeed dependencies."""
42

53
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
64

7-
# Fetch instrument-hooks directly from GitHub
8-
git_repository(
9-
name = "instrument_hooks",
10-
remote = "https://github.com/CodSpeedHQ/instrument-hooks",
11-
commit = "b1e401a4d031ad308edb22ed59a52253a1ebe924",
12-
build_file_content = """
5+
def _instrument_hooks_extension_impl(ctx):
6+
"""Fetches the instrument-hooks dependency from GitHub."""
7+
git_repository(
8+
name = "instrument_hooks",
9+
remote = "https://github.com/CodSpeedHQ/instrument-hooks",
10+
commit = "b1e401a4d031ad308edb22ed59a52253a1ebe924",
11+
build_file_content = """
1312
load("@rules_cc//cc:defs.bzl", "cc_library")
1413
1514
config_setting(
@@ -42,7 +41,11 @@ cc_library(
4241
"-Wno-format-security",
4342
],
4443
}),
45-
visibility = ["//visibility:private"],
44+
visibility = ["//visibility:public"],
4645
)
4746
""",
48-
)
47+
)
48+
49+
instrument_hooks_extension = module_extension(
50+
implementation = _instrument_hooks_extension_impl,
51+
)

examples/standalone_bazel/MODULE.bazel.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)