Skip to content

Commit 77f7c04

Browse files
[bazel] Update MODULE.bazel (#698)
- Remove `archive_override` for `gz-utils` dep and used Jetty package from BCR instead. As a result, bazel CI will use released versions of gz deps, which is consistent with cmake CI. - Drop `repo_name`, which removes the need to patch MODULE.bazel when pushing a release to BCR. `repo_name` is not a required field and can be added on the client side during import if needed to disambiguate packages. - Add back `buildifier` rules to keep bazel files formatted consistently. This also requires importing `cc_*` rules from `rules_cc` since native repo rules will be flagged as warning in bazel 8 and dropped completely in bazel 9. Signed-off-by: Shameek Ganguly <[email protected]>
1 parent b93001e commit 77f7c04

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

BUILD.bazel

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
12
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
3+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
24
load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header", "gz_include_header")
35
load("@rules_license//rules:license.bzl", "license")
46
load("@rules_python//python:py_library.bzl", "py_library")
@@ -140,10 +142,29 @@ py_test_sources = glob(
140142
[
141143
py_test(
142144
name = src.replace("/", "_").replace(".py", "_py").replace("src_python_pybind11_test_", ""),
143-
srcs = [src, "src/python_pybind11/test/numpy_helpers.py" ],
145+
srcs = [
146+
src,
147+
"src/python_pybind11/test/numpy_helpers.py",
148+
],
149+
imports = ["src/python_pybind11/test/"],
144150
main = src,
145151
deps = [":python"],
146-
imports = ["src/python_pybind11/test/"],
147152
)
148153
for src in py_test_sources
149154
]
155+
156+
buildifier(
157+
name = "buildifier.fix",
158+
exclude_patterns = ["./.git/*"],
159+
lint_mode = "fix",
160+
mode = "fix",
161+
)
162+
163+
buildifier_test(
164+
name = "buildifier.test",
165+
exclude_patterns = ["./.git/*"],
166+
lint_mode = "warn",
167+
mode = "diff",
168+
no_sandbox = True,
169+
workspace = "//:MODULE.bazel",
170+
)

MODULE.bazel

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
## MODULE.bazel
21
module(
32
name = "gz-math",
4-
repo_name = "org_gazebosim_gz-math",
53
)
64

75
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
8-
bazel_dep(name = "googletest", version = "1.14.0")
9-
bazel_dep(name = "rules_license", version = "1.0.0")
106
bazel_dep(name = "eigen", version = "3.4.0.bcr.3") # workaround for https://github.com/bazelbuild/bazel-central-registry/issues/4355
7+
bazel_dep(name = "googletest", version = "1.14.0")
8+
bazel_dep(name = "gz-utils", version = "4.0.0-pre1")
9+
bazel_dep(name = "platforms", version = "0.0.11") # Required for `load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")` in BUILD.bazel
1110
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
12-
bazel_dep(name = "rules_python", version = "0.36.0")
13-
bazel_dep(name = "platforms", version = "0.0.11")
14-
15-
# Gazebo Dependencies
11+
bazel_dep(name = "rules_cc", version = "0.1.1")
1612
bazel_dep(name = "rules_gazebo", version = "0.0.6")
17-
bazel_dep(name = "gz-utils")
18-
archive_override(
19-
module_name = "gz-utils",
20-
strip_prefix = "gz-utils-gz-utils4",
21-
urls = ["https://github.com/gazebosim/gz-utils/archive/refs/heads/gz-utils4.tar.gz"],
22-
)
13+
bazel_dep(name = "rules_license", version = "1.0.0")
14+
bazel_dep(name = "rules_python", version = "0.36.0")
2315

2416
PYTHON_VERSIONS = [
2517
"3.9",

eigen3/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
12
load("@rules_gazebo//gazebo:headers.bzl", "gz_include_header")
23
load("@rules_license//rules:license.bzl", "license")
34

examples/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_binary")
12
load("@rules_license//rules:license.bzl", "license")
23
load("@rules_python//python:py_binary.bzl", "py_binary")
34

0 commit comments

Comments
 (0)