This commit is contained in:
Austen Adler 2024-05-23 11:13:38 -04:00
parent c546432de4
commit 69062c4c39

View File

@ -1,5 +1,4 @@
#![feature(try_blocks)] #![feature(try_blocks)]
#![feature(absolute_path)]
use anyhow::bail; use anyhow::bail;
use anyhow::Context; use anyhow::Context;
use anyhow::Result; use anyhow::Result;
@ -172,8 +171,7 @@ async fn build_docs() -> Result<LocalDocsPath> {
let root_path = output_path let root_path = output_path
.parent() .parent()
.map(|p| p.parent()) .and_then(|p| p.parent())
.flatten()
.context("Crate docs directory is invalid")?; .context("Crate docs directory is invalid")?;
if !root_path.is_dir() { if !root_path.is_dir() {
@ -210,9 +208,17 @@ struct LocalDocsPath {
#[serde(tag = "reason")] #[serde(tag = "reason")]
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
enum CargoDocLine { enum CargoDocLine {
CompilerArtifact { filenames: Vec<PathBuf> }, CompilerArtifact {
BuildFinished { success: bool }, filenames: Vec<PathBuf>,
},
BuildFinished {
success: bool,
},
// This is dead code, but serde won't deserialize if I use `()`, since it expects a map
// I could probably tell serde to deserialize the insides as a map, but it doesn't matter
#[allow(dead_code)]
BuildScriptExecuted(Value), BuildScriptExecuted(Value),
#[allow(dead_code)]
CompilerMessage(Value), CompilerMessage(Value),
} }
@ -228,8 +234,7 @@ async fn get_std_docs_path() -> Result<PathBuf> {
)); ));
let path = path let path = path
.parent() .parent()
.map(|p| p.parent()) .and_then(|p| p.parent())
.flatten()
.context("std docs directory is invalid")?; .context("std docs directory is invalid")?;
if !path.is_dir() { if !path.is_dir() {