new: surface cargo vendor failures and pin the vendoring toolchain
This commit is contained in:
@@ -51,6 +51,17 @@ impl OutputFile {
|
||||
}
|
||||
}
|
||||
|
||||
/// What the template post-write hook did to the freshly written tree,
|
||||
/// threaded through [`super::scaffold`] so the flow can react (e.g. word
|
||||
/// the post-scaffold verification offer differently when vendoring failed).
|
||||
#[derive(Debug, Clone, Copy, Default)]
|
||||
pub struct ScaffoldOutcome {
|
||||
/// The vendoring step did not complete (host `cargo` missing, `cargo
|
||||
/// vendor` failed, or the offline config could not be written): the
|
||||
/// package will not build until the dependencies are vendored manually.
|
||||
pub vendoring_failed: bool,
|
||||
}
|
||||
|
||||
/// Metadata extracted from an existing project by [`Template::probe`], used
|
||||
/// by the interactive wizard to pre-fill its answers (explicit flags always
|
||||
/// win). Every field is optional; probe failures are silent and the generic
|
||||
@@ -126,13 +137,16 @@ pub trait Template: Sync {
|
||||
/// Hook run after the generated files have been written to `tree` and
|
||||
/// before the orig tarball is created, for templates that need to run
|
||||
/// host tooling over the freshly written tree (e.g. `cargo vendor`, so
|
||||
/// the vendored sources land inside the tarball).
|
||||
/// the vendored sources land inside the tarball). Returns the outcome
|
||||
/// the flow should know about ([`ScaffoldOutcome`]); failures that leave
|
||||
/// the tree in place but not buildable are reported through it instead
|
||||
/// of failing the scaffold.
|
||||
fn post_write(
|
||||
&self,
|
||||
_opts: &NewOptions,
|
||||
_tree: &Path,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
Ok(())
|
||||
) -> Result<ScaffoldOutcome, Box<dyn std::error::Error>> {
|
||||
Ok(ScaffoldOutcome::default())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user