Skip to main content

cuenv_workspaces/materializer/
mod.rs

1//! Materialization of dependencies into execution environments.
2//!
3//! This module handles the "materialization" step where dependencies resolved
4//! in the graph are made available to the task execution environment.
5//! This typically involves:
6//! - Locating the dependency artifacts (in global cache, local `node_modules`, etc.)
7//! - Symlinking or copying them into the hermetic environment
8//! - Ensuring workspace members are linked correctly
9
10pub mod cargo_deps;
11pub mod node_modules;
12
13use crate::core::types::{LockfileEntry, Workspace};
14use crate::error::Result;
15use std::path::Path;
16
17/// Trait for materializing dependencies.
18pub trait Materializer {
19    /// Materialize dependencies into the target directory.
20    ///
21    /// This should populate `target_dir` (e.g., with a `node_modules` folder
22    /// or `target` directory) containing the necessary dependencies.
23    ///
24    /// # Errors
25    ///
26    /// Returns an error if dependencies cannot be linked or copied into the
27    /// target directory (for example, due to missing files or filesystem
28    /// permission issues).
29    fn materialize(
30        &self,
31        workspace: &Workspace,
32        entries: &[LockfileEntry],
33        target_dir: &Path,
34    ) -> Result<()>;
35}