Skip to content

Commit 151fa6a

Browse files
grebecopybara-github
authored andcommitted
Update rules_hdl to use more bzlmod deps.
This is in preparation to use parts of ortools that use eigen, which conflicts with how rules_hdl sets up ortools+eigen. While we're at it, let's bump to the latest rules_hdl. Related: hdl/bazel_rules_hdl#336 PiperOrigin-RevId: 861361594
1 parent d811c00 commit 151fa6a

File tree

9 files changed

+140
-8
lines changed

9 files changed

+140
-8
lines changed

MODULE.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ maven.artifact(
115115
)
116116

117117
# Used both by XLS and rules_hdl.
118+
bazel_dep(name = "eigen", version = "4.0.0-20241125.bcr.2")
118119
bazel_dep(name = "rules_pkg", version = "1.2.0")
119120

120121
# Workaround suggested by a Bazel team member; only needed for WORKSPACE to work correctly.
@@ -127,6 +128,14 @@ proto_bazel_features(name = "proto_bazel_features")
127128
bazel_dep(name = "rules_bison", version = "0.3")
128129
bazel_dep(name = "rules_flex", version = "0.3")
129130
bazel_dep(name = "rules_m4", version = "0.3")
131+
bazel_dep(name = "swig", version = "4.3.0")
132+
133+
# TODO: rigge - Remove this override once the patch is in the main repo.
134+
single_version_override(
135+
module_name = "swig",
136+
patch_strip = 1,
137+
patches = ["//dependency_support/rules_hdl:swig_bzlmod.patch"],
138+
)
130139

131140
# Dev dependencies
132141
bazel_dep(name = "fuzztest", version = "20250805.0", dev_dependency = True, repo_name = "com_google_fuzztest")

MODULE.bazel.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel b/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel
2+
index ca6a2f7..b63fd7a 100644
3+
--- dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel
4+
+++ dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel
5+
@@ -42,7 +42,7 @@ DEPS = [
6+
"@boost//:python",
7+
"@boost//:system",
8+
"@boost//:thread",
9+
- "@eigen//:eigen3",
10+
+ "@eigen//:eigen",
11+
"@rules_python//python/cc:current_py_cc_headers",
12+
]
13+
14+
diff --git a/dependency_support/org_theopenroadproject/build_helper.bzl b/dependency_support/org_theopenroadproject/build_helper.bzl
15+
index fd4259c..2b58b21 100644
16+
--- dependency_support/org_theopenroadproject/build_helper.bzl
17+
+++ dependency_support/org_theopenroadproject/build_helper.bzl
18+
@@ -299,7 +299,7 @@ OPENROAD_LIBRARY_DEPS = [
19+
"@boost//:property_tree",
20+
"@boost//:stacktrace",
21+
"@boost//:thread",
22+
- "@eigen//:eigen3",
23+
+ "@eigen//:eigen",
24+
"@com_github_quantamhd_lemon//:lemon",
25+
"@org_llvm_openmp//:openmp",
26+
"@com_github_gabime_spdlog//:spdlog",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
index b5c1242..7a43e4f 100644
2+
--- dependency_support/org_theopenroadproject/tcl_wrap_cc.bzl
3+
+++ dependency_support/org_theopenroadproject/tcl_wrap_cc.bzl
4+
@@ -85,6 +85,9 @@ def _tcl_wrap_cc_impl(ctx):
5+
outputs = [output_file],
6+
inputs = src_inputs,
7+
arguments = [args],
8+
+ env = {
9+
+ "SWIG_LIB": "external/swig~/Lib",
10+
+ },
11+
- tools = ctx.files._swig,
12+
+ tools = ctx.files._swig_lib,
13+
executable = ([file for file in ctx.files._swig if file.basename == "swig"][0]),
14+
)
15+
@@ -135,8 +138,13 @@ tcl_wrap_cc = rule(
16+
"swig_options": attr.string_list(
17+
doc = "args to pass directly to the swig binary",
18+
),
19+
+ "_swig_lib": attr.label(
20+
+ default = "@swig//:lib_tcl",
21+
+ allow_files = True,
22+
+ cfg = "exec",
23+
+ ),
24+
"_swig": attr.label(
25+
- default = "@org_swig//:swig_stable",
26+
+ default = "@swig//:swig",
27+
allow_files = True,
28+
cfg = "exec",
29+
),
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/dependency_support/dependency_support.bzl b/dependency_support/dependency_support.bzl
2+
index 5f559a7..310c40f 100644
3+
--- dependency_support/dependency_support.bzl
4+
+++ dependency_support/dependency_support.bzl
5+
@@ -32,10 +32,6 @@ load("//dependency_support/com_github_westes_flex:com_github_westes_flex.bzl", "
6+
load("//dependency_support/com_github_yosyshq_nextpnr:com_github_yosyshq_nextpnr.bzl", "com_github_yosyshq_nextpnr")
7+
load("//dependency_support/com_github_yosyshq_prjtrellis:com_github_yosyshq_prjtrellis.bzl", "com_github_yosyshq_prjtrellis")
8+
load("//dependency_support/com_github_yosyshq_prjtrellis_db:com_github_yosyshq_prjtrellis_db.bzl", "com_github_yosyshq_prjtrellis_db")
9+
-load("//dependency_support/com_google_absl:com_google_absl.bzl", "com_google_absl")
10+
-load("//dependency_support/com_google_googletest:com_google_googletest.bzl", "com_google_googletest")
11+
-load("//dependency_support/com_google_ortools:com_google_ortools.bzl", "com_google_ortools")
12+
-load("//dependency_support/com_google_protobuf:com_google_protobuf.bzl", "com_google_protobuf")
13+
load("//dependency_support/com_google_skywater_pdk:com_google_skywater_pdk.bzl", "com_google_skywater_pdk")
14+
load("//dependency_support/com_icarus_iverilog:com_icarus_iverilog.bzl", "com_icarus_iverilog")
15+
load("//dependency_support/com_opencircuitdesign_magic:com_opencircuitdesign_magic.bzl", "com_opencircuitdesign_magic")
16+
@@ -55,7 +51,6 @@ load("//dependency_support/org_nixos_patchelf:org_nixos_patchelf.bzl", "org_nixo
17+
load("//dependency_support/org_pcre_ftp:org_pcre_ftp.bzl", "org_pcre_ftp")
18+
load("//dependency_support/org_sourceware_bzip2:org_sourceware_bzip2.bzl", "org_sourceware_bzip2")
19+
load("//dependency_support/org_sourceware_libffi:org_sourceware_libffi.bzl", "org_sourceware_libffi")
20+
-load("//dependency_support/org_swig:org_swig.bzl", "org_swig")
21+
load("//dependency_support/org_theopenroadproject:org_theopenroadproject.bzl", "org_theopenroadproject")
22+
load("//dependency_support/org_theopenroadproject_asap7_pdk_r1p7:org_theopenroadproject_asap7_pdk_r1p7.bzl", "org_theopenroadproject_asap7_pdk_r1p7")
23+
load("//dependency_support/org_theopenroadproject_asap7sc6t_26:org_theopenroadproject_asap7sc6t_26.bzl", "org_theopenroadproject_asap7sc6t_26")
24+
@@ -86,10 +81,6 @@ def dependency_support(register_toolchains = True):
25+
com_github_yosyshq_nextpnr()
26+
com_github_yosyshq_prjtrellis()
27+
com_github_yosyshq_prjtrellis_db()
28+
- com_google_absl()
29+
- com_google_googletest()
30+
- com_google_protobuf()
31+
- com_google_ortools()
32+
com_google_skywater_pdk()
33+
com_icarus_iverilog()
34+
com_opencircuitdesign_magic()
35+
@@ -109,7 +100,6 @@ def dependency_support(register_toolchains = True):
36+
org_pcre_ftp()
37+
org_sourceware_bzip2()
38+
org_sourceware_libffi()
39+
- org_swig()
40+
org_theopenroadproject()
41+
org_theopenroadproject_asap7_pdk_r1p7()
42+
org_theopenroadproject_asap7sc6t_26()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/BUILD b/BUILD
2+
index a2b99dc83..d5e6f7a8b 100644
3+
--- a/BUILD
4+
+++ b/BUILD
5+
@@ -161,3 +161,15 @@ filegroup(
6+
licenses = ["notice"], # simple notice license for Lib/
7+
visibility = ["//visibility:public"],
8+
)
9+
+
10+
+filegroup(
11+
+ name = "lib_tcl",
12+
+ srcs = glob([
13+
+ "Lib/*",
14+
+ "Lib/tcl/*",
15+
+ "Lib/std/*",
16+
+ "Lib/typemaps/*",
17+
+ ]),
18+
+ licenses = ["notice"], # simple notice license for Lib/
19+
+ visibility = ["//visibility:public"],
20+
+)

dependency_support/rules_hdl/workspace.bzl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ def repo():
2929
sha256 = "fd9e99f6ccb9e946755f9bc444abefbdd1eedb32c372c56dcacc7eb486aed178",
3030
)
3131

32-
# Current as of 2025-11-07
33-
git_hash = "d17bb1646fa36e6172b349cc59af8d31a427cf23"
32+
# Current as of 2026-01-26
33+
git_hash = "af93b9a5893e482f9959ce351834960e09a45a7b"
3434

3535
maybe(
3636
http_archive,
3737
name = "rules_hdl",
38-
integrity = "sha256-aWjEZVtMMTiO80C3a2c3WBtKJA0WzUgUzqMkA0QLsjs=",
38+
integrity = "sha256-qphNuOxqovqNpGtk7sKxclWLPtxnoPm8ViyT+hiMaiw=",
3939
strip_prefix = "bazel_rules_hdl-%s" % git_hash,
4040
urls = [
4141
"https://github.com/hdl/bazel_rules_hdl/archive/%s.tar.gz" % git_hash,
4242
],
43+
patches = [
44+
Label("@//dependency_support/rules_hdl:rules_hdl_deps.patch"),
45+
Label("@//dependency_support/rules_hdl:rename_eigen.patch"),
46+
Label("@//dependency_support/rules_hdl:rename_swig.patch"),
47+
],
4348
)

xls/dslx/stdlib/tests/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ cc_test(
173173
"@com_google_absl//absl/flags:flag",
174174
"@com_google_absl//absl/status",
175175
"@com_google_absl//absl/types:span",
176-
"@eigen//:eigen3",
176+
"@eigen",
177177
],
178178
)
179179

@@ -546,7 +546,7 @@ cc_test(
546546
"@com_google_absl//absl/log",
547547
"@com_google_absl//absl/random",
548548
"@com_google_absl//absl/status:statusor",
549-
"@eigen//:eigen3",
549+
"@eigen",
550550
"@googletest//:gtest",
551551
] + [":bfloat16_" + top + "_jit_wrapper" for top in BFLOAT16_CMP_TOPS],
552552
)
@@ -582,7 +582,7 @@ cc_test(
582582
"@com_google_absl//absl/log:check",
583583
"@com_google_absl//absl/random",
584584
"@com_google_absl//absl/status:statusor",
585-
"@eigen//:eigen3",
585+
"@eigen",
586586
"@googletest//:gtest",
587587
],
588588
)

xls/scheduling/pipeline_scheduling_pass_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ TEST_F(PipelineSchedulingPassTest, FdoWithMultipleProcs) {
272272
GetXlsRunfilePath("third_party/yosys/yosys"));
273273
XLS_ASSERT_OK_AND_ASSIGN(
274274
std::filesystem::path sta_path,
275-
GetXlsRunfilePath("@org_theopenroadproject/opensta"));
275+
GetXlsRunfilePath("@org_theopenroadproject/src/sta/opensta"));
276276
XLS_ASSERT_OK_AND_ASSIGN(
277277
std::filesystem::path lib_path,
278278
GetXlsRunfilePath("@com_google_skywater_pdk_sky130_fd_sc_hd/timing/"

0 commit comments

Comments
 (0)