Keep preprocessors/backends execution order deterministic

There's a regression caused by recent refactor work, as it used to execute preprocessors/backends in a deterministic way, but now this is not the case, which causes trouble when some backends implicitly depend on the result from another backend and happen to work (e.g. mdbook-pdf). The root cause is that a HashMap has no order, so this PR switches this into `BTreeMap` instead.

Signed-off-by: Hollow Man <hollowman@opensuse.org>
This commit is contained in:
Hollow Man 2025-08-18 13:49:12 +03:00 committed by Eric Huss
parent 21f2435182
commit a0a01ecd60

View file

@ -48,7 +48,7 @@ use crate::utils::log_backtrace;
use anyhow::{Context, Error, Result, bail}; use anyhow::{Context, Error, Result, bail};
use log::{debug, trace}; use log::{debug, trace};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::{BTreeMap, HashMap};
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
@ -214,7 +214,7 @@ impl Config {
} }
/// Returns the configuration for all preprocessors. /// Returns the configuration for all preprocessors.
pub fn preprocessors<'de, T: Deserialize<'de>>(&self) -> Result<HashMap<String, T>> { pub fn preprocessors<'de, T: Deserialize<'de>>(&self) -> Result<BTreeMap<String, T>> {
self.preprocessor self.preprocessor
.clone() .clone()
.try_into() .try_into()
@ -222,7 +222,7 @@ impl Config {
} }
/// Returns the configuration for all renderers. /// Returns the configuration for all renderers.
pub fn outputs<'de, T: Deserialize<'de>>(&self) -> Result<HashMap<String, T>> { pub fn outputs<'de, T: Deserialize<'de>>(&self) -> Result<BTreeMap<String, T>> {
self.output self.output
.clone() .clone()
.try_into() .try_into()