Fix layering check issues in rsz - #11025
Conversation
For that, we have to pull out the headers that are used in the tests and provide in the visible headers. Note, this is only the first step, the next one has to be to put the headers and sources in small libraries with appropriate visibility to build up the libraries from there. I've added a comment to that effect. Now that all headers are specified in the tests and can be accounted for from a library that provides them, this gave the build cleaner the opportunity to remove superfluous libraries in the dependencies that it previously conservatively held on to as it didn't know which library to remove. Issues: The-OpenROAD-Project#10478 Signed-off-by: Henner Zeller <h.zeller@acm.org>
There was a problem hiding this comment.
Code Review
This pull request refactors the Bazel build configuration for the rsz library and its tests. It moves several private header files from srcs to hdrs in src/rsz/BUILD to make them accessible to tests. This allows the removal of the -layering_check feature flag and several unused dependencies from test targets in src/rsz/test/BUILD. There are no review comments, so I have no feedback to provide.
|
Behind the scenes: To find the headers that were not accounted for, I used the double verbosity Giving a useful feedback, which essentially just is a TODO list |
|
Ping. |
| "include/rsz/GlobalSizingConfig.hh", | ||
| "include/rsz/OdbCallBack.hh", | ||
| "include/rsz/Resizer.hh", | ||
| # The following are used in rsz tests, so we should have them |
There was a problem hiding this comment.
We have already created private_hdrs in cts, dpl, drt, gpl, grt, etc. Is there a reason not to do that here?
There was a problem hiding this comment.
Making it private headers is the wrong approach, as we see in the other examples: it detaches the code from the header and just makes something that then accidentally compiles.
Instead, the header and corresponding code need to go together in a library. If the code is well-structured, this might just be the *.cc and the *.h, but since this was not in focus before, it often is more work. So this is why in this first step want to just break out the headers to be visible, and then tackle the proper breakup in libraries.
There was a problem hiding this comment.
It appears you are giving private headers global visibility just to allow the unit tests to see them.
There was a problem hiding this comment.
yes, as a first step. The actual fix will follow, actually making these proper separate libraries as they should be. Then we can control the visibility of the headers seen there for the libraries that need them.
For that, we have to pull out the headers that are used in the tests and provide in the visible headers.
Note, this is only the first step, the next one has to be to put the headers and sources in small libraries with appropriate visibility to build up the libraries from there. I've added a comment to that effect.
Now that all headers are specified in the tests and can be accounted for from a library that provides them, this gave the build cleaner the opportunity to remove superfluous libraries in the dependencies that it previously conservatively held on to as it didn't know which library to remove.
Issues: #10478