flowey_lib_hvlite/
build_pipette.rs1use crate::run_cargo_build::common::CommonProfile;
7use crate::run_cargo_build::common::CommonTriple;
8use flowey::node::prelude::*;
9
10#[derive(Serialize, Deserialize)]
11#[serde(untagged)]
12pub enum PipetteOutput {
13 LinuxBin {
14 #[serde(rename = "pipette")]
15 bin: PathBuf,
16 #[serde(rename = "pipette.dbg")]
17 dbg: PathBuf,
18 },
19 WindowsBin {
20 #[serde(rename = "pipette.exe")]
21 exe: PathBuf,
22 #[serde(rename = "pipette.pdb")]
23 pdb: PathBuf,
24 },
25}
26
27impl Artifact for PipetteOutput {}
28
29flowey_request! {
30 pub struct Request {
31 pub target: CommonTriple,
32 pub profile: CommonProfile,
33 pub pipette: WriteVar<PipetteOutput>,
34 }
35}
36
37new_simple_flow_node!(struct Node);
38
39impl SimpleFlowNode for Node {
40 type Request = Request;
41
42 fn imports(ctx: &mut ImportCtx<'_>) {
43 ctx.import::<crate::run_cargo_build::Node>();
44 }
45
46 fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
47 let Request {
48 target,
49 profile,
50 pipette,
51 } = request;
52
53 let output = ctx.reqv(|v| crate::run_cargo_build::Request {
54 crate_name: "pipette".into(),
55 out_name: "pipette".into(),
56 crate_type: flowey_lib_common::run_cargo_build::CargoCrateType::Bin,
57 profile: profile.into(),
58 features: Default::default(),
59 target: target.as_triple(),
60 no_split_dbg_info: false,
61 extra_env: None,
62 pre_build_deps: Vec::new(),
63 output: v,
64 });
65
66 ctx.emit_minor_rust_step("report built pipette", |ctx| {
67 let pipette = pipette.claim(ctx);
68 let output = output.claim(ctx);
69 move |rt| {
70 let output = match rt.read(output) {
71 crate::run_cargo_build::CargoBuildOutput::WindowsBin { exe, pdb } => {
72 PipetteOutput::WindowsBin { exe, pdb }
73 }
74 crate::run_cargo_build::CargoBuildOutput::ElfBin { bin, dbg } => {
75 PipetteOutput::LinuxBin {
76 bin,
77 dbg: dbg.unwrap(),
78 }
79 }
80 _ => unreachable!(),
81 };
82
83 rt.write(pipette, &output);
84 }
85 });
86
87 Ok(())
88 }
89}