flowey_lib_hvlite/
artifact_openvmm_hcl_sizecheck.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Artifact: `openhcl` binary to use for PR binary size comparison
5
6/// Publish the artifact.
7pub mod publish {
8    use crate::build_openvmm_hcl::OpenvmmHclOutput;
9    use flowey::node::prelude::*;
10
11    flowey_request! {
12        pub struct Request {
13            pub openvmm_openhcl_x86: ReadVar<OpenvmmHclOutput>,
14            pub artifact_dir: ReadVar<PathBuf>,
15            pub done: WriteVar<SideEffect>,
16        }
17    }
18
19    new_simple_flow_node!(struct Node);
20
21    impl SimpleFlowNode for Node {
22        type Request = Request;
23
24        fn imports(_ctx: &mut ImportCtx<'_>) {}
25
26        fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
27            let Request {
28                openvmm_openhcl_x86,
29                artifact_dir,
30                done,
31            } = request;
32
33            ctx.emit_rust_step("copying openhcl build to publish dir", |ctx| {
34                done.claim(ctx);
35                let artifact_dir = artifact_dir.claim(ctx);
36                let openvmm_openhcl_x86 = openvmm_openhcl_x86.claim(ctx);
37
38                move |rt| {
39                    let artifact_dir = rt.read(artifact_dir);
40                    let openvmm_openhcl_x86 = rt.read(openvmm_openhcl_x86);
41                    fs_err::copy(openvmm_openhcl_x86.bin, artifact_dir.join("openhcl"))?;
42
43                    Ok(())
44                }
45            });
46
47            Ok(())
48        }
49    }
50}