flowey_lib_hvlite/
install_openvmm_rust_build_essential.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Globally install a set of dependencies required to build Rust code in the
5//! OpenVMM repo.
6//!
7//! Notably - this node installs both the required Rust toolchain, as well as a
8//! protobuf compiler (which is transitively required by most OpenVMM crates).
9
10use flowey::node::prelude::*;
11
12flowey_request! {
13    pub struct Request(pub WriteVar<SideEffect>);
14}
15
16new_flow_node!(struct Node);
17
18impl FlowNode for Node {
19    type Request = Request;
20
21    fn imports(ctx: &mut ImportCtx<'_>) {
22        ctx.import::<crate::init_openvmm_magicpath_protoc::Node>();
23        ctx.import::<crate::init_openvmm_cargo_config_deny_warnings::Node>();
24        ctx.import::<flowey_lib_common::install_rust::Node>();
25    }
26
27    fn emit(requests: Vec<Self::Request>, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
28        if requests.is_empty() {
29            return Ok(());
30        }
31
32        let side_effects = [
33            ctx.reqv(crate::init_openvmm_cargo_config_deny_warnings::Request::Done),
34            ctx.reqv(crate::init_openvmm_magicpath_protoc::Request),
35            ctx.reqv(flowey_lib_common::install_rust::Request::EnsureInstalled),
36        ];
37
38        ctx.emit_side_effect_step(side_effects, requests.into_iter().map(|x| x.0));
39
40        Ok(())
41    }
42}