-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add application-help-to-doxygen #533
Changes from 1 commit
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# Copyright (c) 2014-2016 Stefan.Eilemann@epfl.ch | ||
# Copyright (c) 2014-2017 Stefan.Eilemann@epfl.ch | ||
# Raphael.Dumusc@epfl.ch | ||
|
||
# Configures the build for a simple application: | ||
# common_application(<Name> [GUI] [EXAMPLE]) | ||
# common_application(<Name> [GUI] [EXAMPLE] [DOXYGEN]) | ||
# | ||
# Arguments: | ||
# * GUI: if set, build cross-platform GUI application | ||
# * EXAMPLE: install all sources in share/Project/examples/Name | ||
# * DOXYGEN: opt into doxygen help extraction for GUI applications | ||
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. is it not non-GUI applications? 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. No, non-GUI applications have to do it. 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, I didn't pay enough attention that it was always on. But now I realize, if it fails silently, why is it not on for all apps including GUI apps? If --help is not implemented, the risk of undefined behaviour is the same for a command line application than for a gui app, right? And I can see it being useful for Brayns for instance. Maybe it should be an opt-out instead? 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.
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. After discussions, will make opt-out for all applications. Internal devs using it for non-GUI applications shall be temporarily shot during PR. |
||
# | ||
# Input: | ||
# * NAME_SOURCES for all compilation units | ||
|
@@ -122,6 +123,34 @@ function(common_application Name) | |
endif() | ||
endif() | ||
|
||
if(NOT THIS_GUI OR THIS_DOXYGEN) | ||
# run binary with --help to capture output for doxygen | ||
set(_doc "${PROJECT_BINARY_DIR}/help/${Name}.md") | ||
set(_cmake "${CMAKE_CURRENT_BINARY_DIR}/${Name}.cmake") | ||
file(WRITE ${_cmake} " | ||
execute_process(COMMAND \${APP} --help | ||
OUTPUT_FILE ${_doc} ERROR_FILE ${_doc}.error) | ||
file(READ ${_doc} _doc_content) | ||
if(NOT _doc_content) | ||
message(FATAL_ERROR \"${Name} is missing --help\") | ||
endif() | ||
file(WRITE ${_doc} \"${Name} {#${Name}} | ||
============ | ||
|
||
``` | ||
\${_doc_content} | ||
``` | ||
\") | ||
") | ||
add_custom_command(OUTPUT ${_doc} | ||
COMMAND ${CMAKE_COMMAND} -DAPP=$<TARGET_FILE:${Name}> -P ${_cmake} | ||
DEPENDS ${Name} | ||
COMMENT "Creating help for ${Name}") | ||
add_custom_target(${Name}-help ALL DEPENDS ${_doc}) | ||
add_dependencies(${PROJECT_NAME}-all ${Name}-help) | ||
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. If I understand correctly, this runs all the applications with --help when building Brion-all? If so, that does not look correct, it should be ${PROJECT_NAME}-doxygen, no? 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 -all target is run before doxygen. We could also attach it to -doxygen, but this feels more consistent, and will make sure it does get fixed since not everybody does verify this stuff during release. 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. Then it should be attached to the doxygen target, since that's where it is used. It does not make sense to run it every time we build. The argument that it has more chances of being fixed is not a valid reason, people won't notice if this breaks in any case unless they look at the documentation output... 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. I disagree. It does fail, and it will show up earlier (ie in a PR). Experience shows that people won't notice. It also does not affect build performance. @tribal-tec, what's your opinion? 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. Fail early is good in principal, but I agree that building 'help' everytime you build 'all' is wrong, also annoying as I personally do 'all' quite often. Moreover, doxygen dependes on install, not on 'all'! To fight problems being not noticed we could run doxygen as part of CI and report the errors from error. Now we actually have sometimes doxygen errors/warnings going unnoticed. We catch them only from time to time by checking the documentation CI plans... 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. yes, I agree, if we fear that it might break unnoticed, then we should add a doxygen build to all Jenkins plans. 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, will attach to project-doxygen. For the record, I still think this is a bad idea since it makes the dependency chain even more entangled. As @tribal-tec shows, it's already not well understood:
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. And here I clicked send to quick: I can't do the above: the project-doxygen target does not exist here. It's the whole raison de etre for the project-all target to collect all dependencies for doxygen. 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. In my understanding:
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.
Yes.
Now it is. Originally it was created for project-doxygen.
Yes.
So now I have to create a project-help target to be able to attach it to project-doxygen? Will do, but as a side note this is pretty demotivating for future work. For some reason it always feels like a ton of work for very little improvement. Somehow I would have less problems if this felt like an effort shared by all. Let's discuss f2f. |
||
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_HELP ${Name}) | ||
endif() | ||
|
||
if(NOT ${NAME}_OMIT_CHECK_TARGETS) | ||
common_check_targets(${Name}) | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,19 @@ if(NOT COMMON_ORGANIZATION_NAME) | |
set(COMMON_ORGANIZATION_NAME Unknown) | ||
endif() | ||
|
||
# collect application help page | ||
get_property(__help GLOBAL PROPERTY ${PROJECT_NAME}_HELP) | ||
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. How about file(GLOB __help "${PROJECT_BINARY_DIR}/help/*.md") instead of a global property? Potentially a bit more flexible and decoupled (for someone who wants to add his own help files in there). 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. No, it would pick up stale files (see above for manual checks during release...) 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 release is made by a Jenkin plan which does a clean build, and anyone doing a manual release will (should) do the same... But I see your point, as you prefer. ${PROJECT_NAME}_HELP should be documented as an IN variable here for consistency, and as an OUT variable in CommonApplication.cmake normally. 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 document this if the user is not supposed to use them? 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. That's a fair question. My take on this is to try to document every in/out variable of each CMake file, because it makes the interdependence between different files explicit. Having hidden global variables is not good for maintenance in the long run. Regarding this specific case, I am not sure if there is a reason users should be discouraged to add their own help file for a python application for instance (tide, rtneuron-app.py, ...) 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. done |
||
if(__help) | ||
set(__index "${PROJECT_BINARY_DIR}/help/applications.md") | ||
file(WRITE ${__index} "Application Help {#apps} | ||
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. Applications in plural ? 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. Afaik that is frenglish. 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, my bad then :-) |
||
============ | ||
|
||
") | ||
foreach(_help ${__help}) | ||
file(APPEND ${__index} "* @subpage ${_help}\n") | ||
endforeach() | ||
endif() | ||
|
||
# list-to-string transform | ||
string(REPLACE ";" " " DOXYGEN_EXTRA_INPUT "${DOXYGEN_EXTRA_INPUT}") | ||
|
||
|
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.
DOXYGEN should be NOHELP
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.
done