Skip to content

Commit eade390

Browse files
committed
build: mark non-propagated MODULE.bazel decls as dev_dependency
When @orfs is fetched as a non-root dep (e.g. by tools/OpenROAD/MODULE.bazel), the downstream module brings its own openroad/qt-bazel/bazel-orfs/yosys-slang pins and orfs.default() configuration -- our overrides at root are duplicated or out of place. Previously tools/OpenROAD carried bazel-orfs-patches/0035 to strip those declarations from our MODULE.bazel at consumption time. With dev_dependency = True on the bazel_dep, use_extension, and register_toolchains lines that only matter at root, Bazel ignores them automatically when @orfs is non-root, so the patch becomes unnecessary. Verified at root with bazelisk query. Drops the unused makefile/makefile_yosys/pdk/variables_yaml overrides on orfs.default() too -- their defaults already point at @orfs//flow:* which resolves to our root labels. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent ad76a84 commit eade390

1 file changed

Lines changed: 28 additions & 14 deletions

File tree

‎MODULE.bazel‎

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,37 @@ module(
55
version = "0.0.1",
66
)
77

8-
# --- Regular dependencies ---
8+
# --- Regular dependencies (propagated to downstream consumers) ---
99

1010
bazel_dep(name = "rules_python", version = "1.8.5")
1111
bazel_dep(name = "rules_shell", version = "0.6.1")
12-
bazel_dep(name = "toolchains_llvm", version = "1.5.0")
1312

14-
bazel_dep(name = "openroad")
13+
# --- Dev dependencies (only honoured when @orfs is the root module) ---
14+
#
15+
# When @orfs is consumed as a non-root dep (e.g. by tools/OpenROAD), the
16+
# downstream module brings its own openroad/qt-bazel/bazel-orfs/yosys-slang
17+
# pins and orfs.default() configuration. Marking everything below as
18+
# dev_dependency = True makes those declarations no-ops in that case, so
19+
# our MODULE.bazel doesn't need to be patched at non-root consumption
20+
# time.
21+
22+
bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
23+
24+
bazel_dep(name = "openroad", dev_dependency = True)
1525
local_path_override(
1626
module_name = "openroad",
1727
path = "tools/OpenROAD",
1828
)
1929

20-
bazel_dep(name = "qt-bazel")
30+
bazel_dep(name = "qt-bazel", dev_dependency = True)
2131
git_override(
2232
module_name = "qt-bazel",
2333
commit = "886104974c2fd72439f2c33b5deebf0fe4649df7",
2434
remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts",
2535
)
2636

27-
bazel_dep(name = "bazel-orfs")
28-
bazel_dep(name = "bazel-orfs-verilog")
37+
bazel_dep(name = "bazel-orfs", dev_dependency = True)
38+
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)
2939

3040
BAZEL_ORFS_COMMIT = "78f19f25cec73bdec3517a76465dec7ce17ce227"
3141

@@ -55,7 +65,7 @@ git_override(
5565
# that has the upstream Bazel build (povik/yosys-slang#310) and the
5666
# slang.so visibility fix (povik/yosys-slang#311). Submodules pull in
5767
# vendored slang and fmt sources.
58-
bazel_dep(name = "yosys-slang")
68+
bazel_dep(name = "yosys-slang", dev_dependency = True)
5969
git_override(
6070
module_name = "yosys-slang",
6171
commit = "7753ea70431d85929292b90c33b32f6dbdb3b048",
@@ -65,13 +75,17 @@ git_override(
6575

6676
# --- Extensions ---
6777

68-
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
78+
llvm = use_extension(
79+
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
80+
"llvm",
81+
dev_dependency = True,
82+
)
6983
llvm.toolchain(
7084
llvm_version = "20.1.8",
7185
)
7286
use_repo(llvm, "llvm_toolchain")
7387

74-
register_toolchains("@llvm_toolchain//:all")
88+
register_toolchains("@llvm_toolchain//:all", dev_dependency = True)
7589

7690
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
7791
python.toolchain(
@@ -87,12 +101,12 @@ pip.parse(
87101
)
88102
use_repo(pip, "orfs-pip")
89103

90-
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
104+
orfs = use_extension(
105+
"@bazel-orfs//:extension.bzl",
106+
"orfs_repositories",
107+
dev_dependency = True,
108+
)
91109
orfs.default(
92-
makefile = "//flow:makefile",
93-
makefile_yosys = "//flow:makefile_yosys",
94-
pdk = "//flow:asap7",
95-
variables_yaml = "//flow:scripts/variables.yaml",
96110
# Expose the yosys-slang plugin via YOSYS_PLUGIN_PATH so
97111
# SYNTH_HDL_FRONTEND=slang works for ibex, cva6, uart, etc.
98112
yosys_plugins = ["@yosys-slang//src/yosys_plugin:slang.so"],

0 commit comments

Comments
 (0)