Skip to content

Commit 9e1904a

Browse files
committed
Merge branch 'master' of github.com:The-OpenROAD-Project-private/OpenROAD into cts-ndr-spacing-fix
2 parents bd53e35 + 9294934 commit 9e1904a

146 files changed

Lines changed: 17900 additions & 1339 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
common --enable_bzlmod
2+
# sv-lang 10.0.bcr.2 (slang at f04e8156 with the foreign_cc cmake -xc++
3+
# fix) is pending upstream as a PR against bazelbuild/bazel-central-
4+
# registry: https://github.com/bazelbuild/bazel-central-registry/pull/8987
5+
# Remove this registry line once the version lands on BCR.
6+
common --registry=https://raw.githubusercontent.com/oharboe/bazel-central-registry/1beaf797951046d93a2f656d4238c954a21833e5/
7+
common --registry=https://bcr.bazel.build/
28
build --workspace_status_command=tools/workspace_status.sh
39

410
# Release builds embed real git version info; dev builds use cache-safe placeholders.

.github/workflows/buildifier.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
check:
18+
# Drive buildifier from `git ls-files` instead of `-r .` so the
19+
# scan stays inside this repo. With `-r .` buildifier was
20+
# recursing into submodule contents (third-party/slang-elab/...)
21+
# left on disk by self-hosted runners — files we can't fix from
22+
# here since they're upstream-managed.
1823
- name: Buildifier format
19-
run: ./buildifier -r -mode=check -lint=off .
24+
run: "git ls-files -z ':(glob)**/*.bzl' ':(glob)**/*.bazel' ':(glob)**/BUILD' ':(glob)**/WORKSPACE' | xargs -0 -r ./buildifier -mode=check -lint=off"
2025
- name: Buildifier lint
21-
run: ./buildifier -r -lint=warn .
26+
run: "git ls-files -z ':(glob)**/*.bzl' ':(glob)**/*.bazel' ':(glob)**/BUILD' ':(glob)**/WORKSPACE' | xargs -0 -r ./buildifier -lint=warn"
2227
name: ${{ matrix.check.name }}
2328
env:
2429
BUILDIFIER_VERSION: v8.2.1
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: clang-tidy-bazel
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
Clang-Tidy-Bazel:
14+
runs-on: ${{ vars.USE_SELF_HOSTED == 'true' && 'self-hosted' || 'ubuntu-latest' }}
15+
steps:
16+
- name: Check out repository code
17+
uses: actions/checkout@v6
18+
with:
19+
submodules: 'recursive'
20+
# Need full history so reviewdog can diff against the PR base.
21+
fetch-depth: 0
22+
23+
- name: Set up bazel
24+
# GitHub-hosted ubuntu-latest preinstalls bazelisk, but self-hosted
25+
# runners do not. Install it explicitly so the workflow works on
26+
# both runner types. bazel-contrib/setup-bazel's default uses a
27+
# pre-installed bazelisk; passing bazelisk-version forces install.
28+
uses: bazel-contrib/setup-bazel@0.19.0
29+
with:
30+
bazelisk-version: 1.x
31+
bazelisk-cache: true
32+
33+
- name: Set up reviewdog
34+
uses: reviewdog/action-setup@v1
35+
with:
36+
reviewdog_version: latest
37+
38+
- name: Run bazel clang-tidy
39+
env:
40+
BAZEL_CACHE_PASSWORD: ${{ secrets.BAZEL_CACHE_PASSWORD }}
41+
run: |
42+
# Same auth pattern as github-actions-macos-bazel.yml: when the
43+
# cache secret is present (push / dispatch / private repo PR),
44+
# add authed gRPC + Remote Asset API on top of the .bazelrc anon
45+
# HTTPS read-only cache. Fork PRs have no secret and just read
46+
# the anon cache.
47+
REMOTE_FLAGS=()
48+
if [ -n "${BAZEL_CACHE_PASSWORD}" ]; then
49+
TOKEN_B64=$(printf 'ci:%s' "${BAZEL_CACHE_PASSWORD}" | base64 | tr -d '\n')
50+
echo "::add-mask::${TOKEN_B64}"
51+
REMOTE_FLAGS=(
52+
--remote_cache=grpcs://bazel.precisioninno.com:443
53+
--experimental_remote_downloader=grpcs://bazel.precisioninno.com:443
54+
--remote_upload_local_results=true
55+
--remote_header="Authorization=Basic ${TOKEN_B64}"
56+
)
57+
fi
58+
# Note: do NOT use --config=ci here. That config sets
59+
# --remote_download_minimal and --config=opt (LTO), but we need
60+
# the .AspectRulesLintClangTidy.out files materialized locally
61+
# to feed reviewdog, and LTO is wasted work for lint.
62+
set -x
63+
bazel build \
64+
"${REMOTE_FLAGS[@]}" \
65+
--config=lint \
66+
-- //src/... //third-party/... -//src/sta/... -//third-party/abc/...
67+
68+
- name: Collect clang-tidy diagnostics
69+
run: |
70+
# Paths in .out files are sandbox-absolute; strip to workspace-
71+
# relative so reviewdog can match against the PR diff. Keep only
72+
# `path:line:col: warning|error:` lines — drops source-context
73+
# carets, notes, and clang-tidy's header noise in one filter.
74+
# `grep -v bazel-out/` drops findings against external virtual
75+
# includes (not in any PR diff). `sort -u` dedupes the same
76+
# finding emitted under multiple cc_library consumers of a
77+
# shared source.
78+
BAZEL_BIN=$(bazel info bazel-bin)
79+
find "${BAZEL_BIN}" -name '*.AspectRulesLintClangTidy.out' -print0 \
80+
| xargs -0 cat \
81+
| sed -E 's|^.*/execroot/_main/||' \
82+
| grep -E '^[^:]+:[0-9]+:[0-9]+: (warning|error):' \
83+
| grep -vE '^(bazel-out|external)/' \
84+
| sort -u \
85+
> clang-tidy.txt
86+
echo "::group::clang-tidy.txt (head)"
87+
head -50 clang-tidy.txt || true
88+
echo "::endgroup::"
89+
echo "Findings: $(wc -l < clang-tidy.txt)"
90+
91+
- name: Run reviewdog
92+
env:
93+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
run: |
95+
reviewdog \
96+
-efm="%E%f:%l:%c: error: %m" \
97+
-efm="%W%f:%l:%c: warning: %m" \
98+
-name="clang-tidy" \
99+
-reporter=github-pr-review \
100+
-filter-mode=added \
101+
-fail-level=any \
102+
< clang-tidy.txt

.github/workflows/github-actions-clang-tidy-post.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/github-actions-clang-tidy.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

BUILD.bazel

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
88
load("@rules_python//python:defs.bzl", "py_library")
99
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
1010
load("@rules_shell//shell:sh_test.bzl", "sh_test")
11-
load("//bazel:notification.bzl", "notification_rule")
1211
load("//bazel:python_wrap_cc.bzl", "PYTHON_EXTENSION_LINKOPTS", "PYTHON_STABLE_API_DEFINE", "python_wrap_cc")
1312
load("//bazel:tcl_encode_or.bzl", "tcl_encode")
1413
load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
@@ -22,22 +21,6 @@ package(
2221
],
2322
)
2423

25-
# Notification target to notify user if --config=opt (with LTO) is not used.
26-
notification_rule(
27-
name = "opt_notification",
28-
is_opt = select(
29-
{
30-
":lto_on": True,
31-
"//conditions:default": False,
32-
},
33-
),
34-
)
35-
36-
config_setting(
37-
name = "lto_on",
38-
values = {"copt": "-flto"},
39-
)
40-
4124
exports_files([
4225
".clang-tidy",
4326
"BUILD.bazel",
@@ -196,7 +179,6 @@ cc_library(
196179
# include needs to see.
197180
OPENROAD_MAIN_DEPS = [
198181
":openroad_version",
199-
":opt_notification",
200182
":ord",
201183
":tcl_readline_setup",
202184
"//bazel:tcl_library_init",

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ if echo "$fromImage" | grep -q "ubuntu"; then
2626
else
2727
echo "Skipping strip command as fromImage does not contain 'ubuntu'"
2828
fi
29+
if command -v apt-get >/dev/null 2>&1; then
30+
rm -rf /var/lib/apt/lists/*
31+
fi
2932
rm -f /tmp/DependencyInstaller.sh
3033
EOF
3134

MODULE.bazel

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ bazel_dep(name = "rules_bison", version = "0.3.1")
1616
bazel_dep(name = "rules_cc", version = "0.2.18")
1717
bazel_dep(name = "rules_flex", version = "0.3.1")
1818
bazel_dep(name = "rules_pkg", version = "1.2.0")
19+
bazel_dep(name = "rules_pycross", version = "0.8.1")
1920
bazel_dep(name = "rules_python", version = "1.8.5")
2021
bazel_dep(name = "rules_shell", version = "0.6.1")
2122
bazel_dep(name = "swig", version = "4.3.0.bcr.2")
@@ -61,10 +62,12 @@ bazel_dep(name = "boost.unordered", version = BOOST_VERSION)
6162
bazel_dep(name = "boost.utility", version = BOOST_VERSION)
6263
bazel_dep(name = "cudd", version = "3.0.0.bcr.2")
6364
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
65+
bazel_dep(name = "fmt", version = "11.2.0.bcr.1")
6466
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
6567
bazel_dep(name = "openmp", version = "21.1.5.bcr.1")
6668
bazel_dep(name = "or-tools", version = "9.15")
6769
bazel_dep(name = "spdlog", version = "1.15.1")
70+
bazel_dep(name = "sv-lang", version = "10.0.bcr.2")
6871
bazel_dep(name = "tcl_lang", version = "9.0.2.bcr.1")
6972
bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
7073
bazel_dep(name = "yaml-cpp", version = "0.9.0")
@@ -89,7 +92,7 @@ bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
8992
# --- Dev dependencies (not propagated to downstream consumers) ---
9093

9194
bazel_dep(name = "aspect_rules_lint", version = "2.5.2", dev_dependency = True)
92-
bazel_dep(name = "bant", version = "0.2.9", dev_dependency = True)
95+
bazel_dep(name = "bant", version = "0.2.10", dev_dependency = True)
9396
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True)
9497
bazel_dep(name = "rules_verilator", version = "0.1.0", dev_dependency = True)
9598
bazel_dep(name = "verilator", version = "5.036.bcr.3", dev_dependency = True)
@@ -188,6 +191,13 @@ pip.parse(
188191
)
189192
use_repo(pip, "openroad-pip")
190193

194+
# sv-lang pulls in rules_pycross, whose toolchain extension fails on Python
195+
# 3.8 (transitively registered via or-tools -> pybind11_abseil, dropped
196+
# from rules_python 2.0.0's MINOR_MAPPING). pycross.configure_environments
197+
# is root-honored only, so the workaround lives here.
198+
pycross = use_extension("@rules_pycross//pycross/extensions:pycross.bzl", "pycross")
199+
pycross.configure_environments(python_versions = ["3.13"])
200+
191201
node = use_extension(
192202
"@rules_nodejs//nodejs:extensions.bzl",
193203
"node",
@@ -217,18 +227,21 @@ orfs.default(
217227

218228
# --- External archives ---
219229

230+
# Alias @slang -> @sv-lang//:libsvlang so submodule BUILD files that
231+
# reference @slang resolve without modification. OpenROAD source uses
232+
# @sv-lang directly; this alias only exists for the slang-elab submodule.
220233
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
221234

222235
new_local_repository(
223-
name = "fmt",
224-
build_file = "//third-party/slang-elab/third_party:fmt.BUILD",
225-
path = "third-party/slang-elab/third_party/fmt",
226-
)
227-
228-
new_local_repository(
229236
name = "slang",
230-
build_file = "//third-party/slang-elab/third_party:slang.BUILD",
231-
path = "third-party/slang-elab/third_party/slang",
237+
build_file_content = """\
238+
alias(
239+
name = "slang",
240+
actual = "@sv-lang//:libsvlang",
241+
visibility = ["//visibility:public"],
242+
)
243+
""",
244+
path = "bazel",
232245
)
233246

234247
# --- Overrides ---

0 commit comments

Comments
 (0)