mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-30 13:50:38 +00:00
Save time on default xtask build (#3647)
This commit is contained in:
parent
f71127446b
commit
e05d588f72
@ -12,9 +12,9 @@ console = "0.15.10"
|
||||
env_logger = "0.11.5"
|
||||
esp-metadata = { path = "../esp-metadata", features = ["clap"] }
|
||||
jiff = { version = "0.2.13" }
|
||||
kuchikiki = "0.8.2"
|
||||
kuchikiki = { version = "0.8.2", optional = true }
|
||||
log = "0.4.22"
|
||||
minijinja = "2.5.0"
|
||||
minijinja = { version = "2.5.0", default-features = false }
|
||||
opener = { version = "0.7.2", optional = true }
|
||||
rocket = { version = "0.5.1", optional = true }
|
||||
semver = { version = "1.0.23", features = ["serde"] }
|
||||
@ -45,7 +45,7 @@ urlencoding = { version = "2.1.3", optional = true }
|
||||
pretty_assertions = "1.2.0"
|
||||
|
||||
[features]
|
||||
deploy-docs = ["dep:reqwest"]
|
||||
deploy-docs = ["dep:reqwest", "dep:kuchikiki"]
|
||||
preview-docs = ["dep:opener", "dep:rocket"]
|
||||
semver-checks = [ "dep:cargo-semver-checks", "dep:rustdoc-types", "dep:flate2", "dep:temp-file" ]
|
||||
release = ["semver-checks", "dep:opener", "dep:urlencoding"]
|
||||
|
@ -5,15 +5,14 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use anyhow::{Context as _, Result, ensure};
|
||||
use anyhow::{ensure, Context as _, Result};
|
||||
use clap::ValueEnum;
|
||||
use esp_metadata::Config;
|
||||
use kuchikiki::traits::*;
|
||||
use minijinja::Value;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use crate::{Chip, Package, cargo::CargoArgsBuilder};
|
||||
use crate::{cargo::CargoArgsBuilder, Chip, Package};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Build Documentation
|
||||
@ -82,6 +81,7 @@ pub fn build_documentation(
|
||||
)?;
|
||||
|
||||
// Patch the generated documentation to include a select box for the version:
|
||||
#[cfg(feature = "deploy-docs")]
|
||||
patch_documentation_index_for_package(workspace, package, &version, &base_url)?;
|
||||
}
|
||||
|
||||
@ -247,12 +247,15 @@ fn cargo_doc(workspace: &Path, package: Package, chip: Option<Chip>) -> Result<P
|
||||
Ok(crate::windows_safe_path(&docs_path))
|
||||
}
|
||||
|
||||
#[cfg(feature = "deploy-docs")]
|
||||
fn patch_documentation_index_for_package(
|
||||
workspace: &Path,
|
||||
package: &Package,
|
||||
version: &semver::Version,
|
||||
base_url: &Option<String>,
|
||||
) -> Result<()> {
|
||||
use kuchikiki::traits::*;
|
||||
|
||||
let package_name = package.to_string().replace('-', "_");
|
||||
let package_path = workspace.join("docs").join(package.to_string());
|
||||
let version_path = package_path.join(version.to_string());
|
||||
@ -498,7 +501,7 @@ where
|
||||
let source = fs::read_to_string(resources.join(template))
|
||||
.context(format!("Failed to read {template}"))?;
|
||||
|
||||
let mut env = minijinja::Environment::new();
|
||||
let mut env = minijinja::Environment::empty();
|
||||
env.add_template(template, &source)?;
|
||||
|
||||
let tmpl = env.get_template(template)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user