-
Notifications
You must be signed in to change notification settings - Fork 0
Update bazel doxygen script [AP-3535] #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. | ||
|
||
load("//tools:configure_file.bzl", "configure_file_impl") | ||
load("@rules_pkg//pkg:pkg.bzl", "pkg_zip") | ||
load("//tools:configure_file.bzl", "configure_file_impl") | ||
|
||
def _swift_doxygen_impl(ctx): | ||
vars = ctx.attr.vars | {} # copy dict instead of referencing it | ||
|
@@ -18,37 +18,36 @@ def _swift_doxygen_impl(ctx): | |
doxygen_out = ctx.actions.declare_directory(ctx.attr.name + "_doxygen") | ||
vars["DOXYGEN_OUTPUT_DIRECTORY"] = doxygen_out.path | ||
|
||
# this performs a CMake-like replacement of @VAR@ based on the vars dict | ||
config = configure_file_impl(ctx, vars, ctx.attr.name + "_Doxyfile")[0].files.to_list()[0] | ||
|
||
input_dir = "" | ||
if "PROJECT_SOURCE_DIR" in vars: | ||
input_dir = vars["PROJECT_SOURCE_DIR"] | ||
|
||
project_name = "" | ||
if "PROJECT_NAME" in vars: | ||
project_name = vars["PROJECT_NAME"] | ||
|
||
ctx.actions.run_shell( | ||
inputs = [config] + ctx.files.deps, | ||
outputs = [doxygen_out], | ||
env = vars, | ||
command = """ | ||
DOXYGEN_DOT_FOUND=NO | ||
DOXYGEN_DOT_PATH= | ||
|
||
if command -v dot &> /dev/null | ||
then | ||
DOXYGEN_DOT_FOUND=YES | ||
DOXYGEN_DOT_PATH=$(which dot) | ||
fi | ||
|
||
PRW=`pwd` | ||
|
||
# backward compatibility with old CMake-style doxygen config files | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still use old doxygen config files? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I meant here was the use of |
||
sed -i "s|@DOXYGEN_DOT_FOUND@|$DOXYGEN_DOT_FOUND|g" {config} | ||
sed -i "s|@DOXYGEN_DOT_PATH@|$DOXYGEN_DOT_PATH|g" {config} | ||
sed -i "s|@PLANTUML_JAR_PATH@|/usr/local/bin/plantuml.jar|g" {config} | ||
sed -i "s|@INPUT_DIR@|{input_dir}|g" {config} | ||
sed -i "s|@PROJECT_NAME@|{project_name}|g" {config} | ||
sed -i "s|@INPUT_DIR@|$PROJECT_SOURCE_DIR|g" {config} | ||
sed -i "s|@PROJECT_NAME@|$PROJECT_NAME|g" {config} | ||
sed -i "s|@STABLE_GIT_TAG@|$STABLE_GIT_TAG|g" {config} | ||
sed -i "s|@DOXYGEN_EXCLUDE@|$DOXYGEN_EXCLUDE|g" {config} | ||
sed -i "s|@PROJECT_SOURCE_DIR@|$PRW|g" {config} | ||
Comment on lines
+43
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following issue is not related to your PR, but to the way this script is implemented in the first place. I believe the doxygen actions are not correctly setup to be reproducible on macos. I wanted to test this new version on integrity doxygens, and it turns out this sed command does not seem to be compatible with macos sed, which requires an argument to the Using the following patch:
I then get So I updated the calls again to:
Then doxygen is not found (I have it installed, but PATH seems to be cleared when running this script).
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @richarddeurloo @sbmueller Then my question is, are you able to build doxygens on your mac? Should we find a way to make this script platform independent, and add doxygen binaries as explicit dependencies? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @armallen, I agree and this script is a thorn in my eye as well. I don't have time to clean this up now. I just wanted to "make it work" for the moment. We have another ticket to deal with the refactor: https://swift-nav.atlassian.net/browse/AP-3482 And you are right about the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @armallen I've stumbled upon the exact same issues. I took a look a few weeks ago (see my comments in above ticket) and I can't help but realize the doxygen bazel implementation is a mere PoC for Linux which I think never was intended as a final and general solution. This definitely needs work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok it makes sense! |
||
|
||
PATH=$PATH doxygen {config} | ||
""".format(config = config.path, input_dir = input_dir, project_name = project_name), | ||
""".format(config = config.path), | ||
) | ||
|
||
return [DefaultInfo(files = depset([doxygen_out, config]))] | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: these are now directly exposed as env variables in bash by setting
env = vars
below.