From 40b35820c8888dfb981faed7d3681bfd0d47abb4 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Mon, 4 Mar 2024 18:53:42 +0100 Subject: [PATCH] add rust doc generation --- .gitignore | 1 + xtask/src/gen_doc.rs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.gitignore b/.gitignore index ae498e7c2..511c1e5ce 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ tmp # Autogenerated docs docs/api/runtime*.md +docs/api/doc diff --git a/xtask/src/gen_doc.rs b/xtask/src/gen_doc.rs index 90252b013..5e4b4b238 100644 --- a/xtask/src/gen_doc.rs +++ b/xtask/src/gen_doc.rs @@ -21,6 +21,7 @@ use scale_info::form::PortableForm; use serde::Serialize; use std::collections::HashMap; use std::path::Path; +use std::process::Command; use std::{ fs::File, io::{Read, Write}, @@ -319,6 +320,24 @@ pub(super) fn gen_doc() -> Result<()> { file.write_all(error_doc.as_bytes()) .with_context(|| format!("Failed to write to file '{}'", ERRORS_DOC_FILEPATH))?; + // Generate docs from rust code + Command::new("cargo") + .args([ + "doc", + "--workspace", + "--no-deps", + "--document-private-items", + "--features=runtime-benchmarks", + ]) + .status() + .expect("cargo doc failed to execute"); + + // Organise folder for deployment + Command::new("cp") + .args(["-r", "./target/doc", "./docs/api/"]) + .status() + .expect("failed to build docs folder"); + Ok(()) } -- GitLab