Skip to content

Commit

Permalink
build-sys: Generalize manpage bits to make update-generated
Browse files Browse the repository at this point in the history
I plan to add more generated-from-source files, so generalize
the target which is currently specialized to manpages.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jul 17, 2024
1 parent 298a336 commit 9b95833
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ validate: validate-rust
ruff check
.PHONY: validate

update-generated:
cargo xtask update-generated
.PHONY: update-generated

vendor:
cargo xtask $@
.PHONY: vendor
Expand Down
13 changes: 7 additions & 6 deletions xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
#[allow(clippy::type_complexity)]
const TASKS: &[(&str, fn(&Shell) -> Result<()>)] = &[
("manpages", manpages),
("man2markdown", man2markdown),
("update-generated", update_generated),
("package", package),
("package-srpm", package_srpm),
("spec", spec),
Expand Down Expand Up @@ -116,12 +116,13 @@ fn manpages(sh: &Shell) -> Result<()> {
Ok(())
}

/// Generate markdown files (converted from the man pages, which are generated
/// from the Rust sources) into docs/src, which ends up in the rendered
/// documentation. This process is currently manual.
#[context("man2markdown")]
fn man2markdown(sh: &Shell) -> Result<()> {
/// Update generated files, such as converting the man pages to markdown.
/// This process is currently manual.
#[context("Updating generated files")]
fn update_generated(sh: &Shell) -> Result<()> {
manpages(sh)?;
// And convert the man pages into markdown, so they can be included
// in the docs.
for ent in std::fs::read_dir("target/man")? {
let ent = ent?;
let path = &ent.path();
Expand Down

0 comments on commit 9b95833

Please sign in to comment.