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