fix: bazel manpage compilation#10729
Conversation
Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request adds support for installing and locating generated man pages in Bazel builds. Specifically, it updates bazel/install.sh and packaging/BUILD.bazel to copy man pages to the installation directory, and modifies src/OpenRoad.cc to look for them in bazel-bin/docs when running via Bazel. The review feedback suggests dereferencing symlinks using cp -rfL and cleaning up stale directories during installation, as well as using the non-throwing overload of std::filesystem::is_directory to prevent potential exceptions.
| if (std::filesystem::is_directory(docs_path)) { | ||
| return docs_path; | ||
| } |
There was a problem hiding this comment.
std::filesystem::is_directory can throw a std::filesystem::filesystem_error exception if the path is inaccessible, contains a loop of symlinks, or encounters other OS-level errors. To ensure robust error handling and prevent potential crashes, use the non-throwing overload that accepts an std::error_code parameter.
std::error_code ec;
if (std::filesystem::is_directory(docs_path, ec)) {
return docs_path;
}Signed-off-by: Jack Luar <39641663+luarss@users.noreply.github.com>
Summary
src/OpenRoad.cc: CheckBUILD_WORKSPACE_DIRECTORYingetDocsPath()forbazel runcase(ifdef BAZEL_BUILD).
packaging/BUILD.bazel: Add//docs:man_pagestoinstalldata deps.bazel/install.sh: Copycat/andhtml/to$DEST_DIR/share/openroad/man/.Type of Change
Impact
[How does this change the tool's behavior?]
Verification
./etc/Build.sh).Related Issues
fixes #10640