mirror of
https://review.coreboot.org/flashrom.git
synced 2025-06-30 21:52:36 +02:00
doc: autogenerate a list of authors and hall of fame
This adds a build-time option to automatically generate a list of authors from git history, and includes it in the documentation by reading the output from git in a Sphinx extension. When git isn't available or the project source doesn't appear to be a git checkout, the list is not generated and gracefully replaced with a message explaining its absence. Change-Id: I1e9634a90e84262aafd80590deba9875f4b71a3c Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/86350 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
07beef6999
commit
0b39a3e00c
@ -1,6 +1,6 @@
|
||||
|
||||
sphinx = find_program('sphinx-build', native : true, required : get_option('man-pages').enabled() or get_option('documentation').enabled())
|
||||
sphinx_wrapper = meson.current_source_dir() / 'sphinx-wrapper.sh'
|
||||
collect_authors = meson.current_source_dir() / 'collect-authors.sh'
|
||||
|
||||
man_pages = [
|
||||
'flashrom.8'
|
||||
@ -24,9 +24,67 @@ if sphinx.found()
|
||||
endif
|
||||
|
||||
if get_option('documentation').auto() or get_option('documentation').enabled()
|
||||
|
||||
with_authors_list = get_option('generate_authors_list')
|
||||
git = find_program('git', native : true, required : with_authors_list)
|
||||
git_dir = meson.project_source_root() / '.git'
|
||||
|
||||
# When with_authors_list is requested, unsatisfied requirements are an error.
|
||||
if with_authors_list.enabled()
|
||||
if not git.found()
|
||||
error('generate_authors_list was force-enabled but git is not available')
|
||||
endif
|
||||
if not fs.is_dir(git_dir)
|
||||
error('generate_authors_list was force-enabled but a .git directory was not found in the source tree')
|
||||
endif
|
||||
endif
|
||||
|
||||
if (
|
||||
(with_authors_list.enabled() or with_authors_list.auto())
|
||||
and git.found() and fs.is_dir(git_dir)
|
||||
)
|
||||
# If requirements are met and authors list is allowed, generate it.
|
||||
authors_lst = custom_target(
|
||||
'authors_lst',
|
||||
output : 'authors.lst',
|
||||
command : [collect_authors, 'authors', '@OUTPUT0@', git_dir],
|
||||
)
|
||||
reviewers_lst = custom_target(
|
||||
'reviewers_lst',
|
||||
output : 'reviewers.lst',
|
||||
command : [collect_authors, 'reviewers', '@OUTPUT0@', git_dir],
|
||||
)
|
||||
authors_list_options = [
|
||||
'-Dflashrom_authors_list_files.authors=' + authors_lst.full_path(),
|
||||
'-Dflashrom_authors_list_files.reviewers=' + reviewers_lst.full_path(),
|
||||
]
|
||||
doc_depends = [authors_lst, reviewers_lst]
|
||||
else
|
||||
# Disabled or prerequisites not met. Continue without the authors list.
|
||||
# Checks earlier in this file will raise an error if the feature is enabled
|
||||
# but the prerequisites aren't met.
|
||||
authors_list_options = []
|
||||
doc_depends = []
|
||||
|
||||
if with_authors_list.auto()
|
||||
# Explain what wasn't satisfied to help the user understand why
|
||||
# the authors list is missing.
|
||||
if not git.found()
|
||||
message('git not found; will not generate authors list')
|
||||
elif not fs.is_dir(git_dir)
|
||||
message('.git directory not found in project; will not generate authors list')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
custom_target(
|
||||
'documentation',
|
||||
command : [sphinx, '-b', 'html', '-q', '-d', '@PRIVATE_DIR@', '-Drelease=' + flashrom_version,'@CURRENT_SOURCE_DIR@', '@OUTDIR@/html'],
|
||||
command : [
|
||||
sphinx, '-b', 'html', '-q', '-d', '@PRIVATE_DIR@',
|
||||
'-Drelease=' + flashrom_version,
|
||||
'@CURRENT_SOURCE_DIR@', '@OUTDIR@/html'
|
||||
] + authors_list_options,
|
||||
depends : doc_depends,
|
||||
build_always_stale : true, # sphinx handles rebuilds
|
||||
output : 'html',
|
||||
install : true,
|
||||
|
Reference in New Issue
Block a user