Skip to content

bazel: make downstream-facing targets publicly visible#10099

Open
oharboe wants to merge 4 commits intoThe-OpenROAD-Project:masterfrom
oharboe:visibility
Open

bazel: make downstream-facing targets publicly visible#10099
oharboe wants to merge 4 commits intoThe-OpenROAD-Project:masterfrom
oharboe:visibility

Conversation

@oharboe
Copy link
Copy Markdown
Collaborator

@oharboe oharboe commented Apr 10, 2026

openroad_lib, ord, error_swig, error_swig-py, and options_swig were restricted to //:subpackages. Downstream Bazel consumers that depend on @openroad need these targets. The CMake build already exposes them unconditionally.

openroad_lib, ord, error_swig, error_swig-py, and options_swig were
restricted to //:__subpackages__. Downstream Bazel consumers that
depend on @openroad need these targets. The CMake build already
exposes them unconditionally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
Copy link
Copy Markdown
Collaborator Author

oharboe commented Apr 10, 2026

@hzeller Thoughts?

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the visibility of several Bazel targets in the BUILD.bazel file, changing them from subpackage-restricted to public. This change affects multiple cc_library and filegroup targets, making them accessible outside of the current package hierarchy. I have no feedback to provide as there are no review comments.

@hzeller
Copy link
Copy Markdown
Collaborator

hzeller commented Apr 10, 2026

Looks good to me in general. We mostly need to make sure to not have things that are internal artifacts and are likely to change are kept private, but this looks like a good set of candiates that look like they want to be public.
I'll defer to @maliberty for the good judgment.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@oharboe oharboe requested a review from maliberty April 10, 2026 09:59
@maliberty
Copy link
Copy Markdown
Member

How do you use the .i files downstream?

oharboe and others added 2 commits April 11, 2026 07:08
Minimal bzlmod workspace in test/visibility/ that aliases the five
OpenROAD targets downstream consumers need (openroad_lib, ord,
error_swig, error_swig-py, options_swig).  `bazel build --nobuild :all`
fails at analysis time if any target is not publicly visible.

Not run in CI — manual verification only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions github-actions bot added size/M and removed size/S labels Apr 11, 2026
@oharboe
Copy link
Copy Markdown
Collaborator Author

oharboe commented Apr 11, 2026

How do you use the .i files downstream?

Added a test and the best explanation I have.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@@ -0,0 +1 @@
# Empty — bzlmod only.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't add a WORKSPACE. That is only needed in pre bazel 7 era times that we have passed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

) for t in [
"openroad_lib",
"ord",
"error_swig",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while the openroad_lib and ord seem reasonable, I wonder why you need the swigged versions

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


## Problem

OpenROAD's `BUILD.bazel` restricted several targets to
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like an LLM explanation: full of words, but not explaining anything.

What we expect here is something like: libraries x, y and z are needed downstream for x-reason, y-reason and z-reason. This is why they are set public.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to get rid of docker, this was one fix that Claude needed to make it compile. I expect that when the dust settles and we get other things merged, clarity will come.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if claude ran into the issue, it might be able to explain why it needed that visibility.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer starting with something that works even if I dont know why and then whittling away at it. Claude changes nothing: I use OpenROAD and ORFS without understanding them fully. I start with something that works.

ideally claude was mistaken here and nothing is needed here... We dont yet know what is going on and why claude decided it needed this. It will come. Thats the beauty of patching openroad in bazel-orfs and downstream projects, we can deal with the pain first with a patch and then figure out what is going on and what is needed in openroad

Thank you for sheding light on this so far. Even a conclusive "I have no idea" is a strong signal.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am worried about this-was-needed-at-some-time-but-nobody-knew-why resulting in a bunch of leftover things that might just hang in there forever because someone later thinks "oh, there was probably a good reason".

Maybe add a cleanup issue that collects all the pull requests to get things going, so that it is possible to re-viisit later and clean up things that are not needed. We humans need to use these tools to keep the software maintainable which the LLM tools don't understand or care about - they just are text completion tools.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a good process now. This change is suspect, whereas others sail straight through, we know they are good. I'm fine to leave this hanging until we are sure exactly what is going on. There are many other pull requests in flight that are much less questionable to sort out first.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now if you do want a more holistic approach to this, check out origin/main of bazel-orfs and figure out how to get it to build without patches...

I'm thinking that's not an ideal solution either. Standalone, sometimes a bit mysterious, PRs and investing in understanding the context when there's a reason to, is a better way to do it...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The horrific thing about getting rid of docker are the enormous turnaround times. When I tinker with something that makes the openroad/yosys bazel cache useless, 20000 files have to be rebuilt + hours of ORFS flows.

Only openroad_lib and ord need public visibility for downstream
consumers. The SWIG filegroups (error_swig, error_swig-py,
options_swig) are only referenced by internal subpackages, which
already satisfy __subpackages__ visibility. No downstream consumer
references them directly.

Also remove WORKSPACE.bazel (pre-Bazel 7 artifact) and rewrite
README.md with verified explanations instead of hallucinated ones.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@github-actions github-actions bot added size/S and removed size/M labels Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants