flowey_lib_hvlite/_jobs/
build_and_publish_pipette.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Build and publish the pipette artifact

use crate::run_cargo_build::common::CommonProfile;
use crate::run_cargo_build::common::CommonTriple;
use flowey::node::prelude::*;

flowey_request! {
    pub struct Params {
        pub target: CommonTriple,
        pub profile: CommonProfile,

        pub artifact_dir: ReadVar<PathBuf>,
        pub done: WriteVar<SideEffect>,
    }
}

new_simple_flow_node!(struct Node);

impl SimpleFlowNode for Node {
    type Request = Params;

    fn imports(ctx: &mut ImportCtx<'_>) {
        ctx.import::<crate::artifact_pipette::publish::Node>();
        ctx.import::<crate::build_pipette::Node>();
    }

    fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
        let Params {
            target,
            profile,
            artifact_dir,
            done,
        } = request;

        let pipette = ctx.reqv(|v| crate::build_pipette::Request {
            profile,
            target,
            pipette: v,
        });

        ctx.req(crate::artifact_pipette::publish::Request {
            pipette,
            artifact_dir,
            done,
        });

        Ok(())
    }
}