microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
flowey/flowey_hvlite/src/pipelines/mod.rs
67lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | use flowey::pipeline::prelude::*; |
| 5 | use restore_packages::RestorePackagesCli; |
| 6 | |
| 7 | pub mod build_igvm; |
| 8 | pub mod checkin_gates; |
| 9 | pub mod custom_vmfirmwareigvm_dll; |
| 10 | pub mod restore_packages; |
| 11 | |
| 12 | #[derive(clap::Subcommand)] |
| 13 | #[expect(clippy::large_enum_variant)] |
| 14 | pub enum OpenvmmPipelines { |
| 15 | /// Alias for root-level `regen` command. |
| 16 | // DEVNOTE: this enables the useful `cargo xflowey regen` alias |
| 17 | Regen { |
| 18 | #[arg(trailing_var_arg = true, allow_hyphen_values = true, hide = true)] |
| 19 | args: Vec<String>, |
| 20 | }, |
| 21 | |
| 22 | BuildIgvm(build_igvm::BuildIgvmCli), |
| 23 | CustomVmfirmwareigvmDll(custom_vmfirmwareigvm_dll::CustomVmfirmwareigvmDllCli), |
| 24 | |
| 25 | /// Flowey pipelines primarily designed to run in CI. |
| 26 | #[clap(subcommand)] |
| 27 | Ci(OpenvmmPipelinesCi), |
| 28 | |
| 29 | /// Install tools needed to build OpenVMM |
| 30 | RestorePackages(RestorePackagesCli), |
| 31 | } |
| 32 | |
| 33 | #[derive(clap::Subcommand)] |
| 34 | pub enum OpenvmmPipelinesCi { |
| 35 | CheckinGates(checkin_gates::CheckinGatesCli), |
| 36 | } |
| 37 | |
| 38 | impl IntoPipeline for OpenvmmPipelines { |
| 39 | fn into_pipeline(self, pipeline_hint: PipelineBackendHint) -> anyhow::Result<Pipeline> { |
| 40 | match self { |
| 41 | OpenvmmPipelines::Regen { args } => { |
| 42 | std::process::Command::new("cargo") |
| 43 | .args([ |
| 44 | "run", |
| 45 | "-p", |
| 46 | "flowey_hvlite", |
| 47 | "--profile", |
| 48 | "flowey", |
| 49 | "--", |
| 50 | "regen", |
| 51 | ]) |
| 52 | .args(args) |
| 53 | .spawn()? |
| 54 | .wait()?; |
| 55 | std::process::exit(0) |
| 56 | } |
| 57 | |
| 58 | OpenvmmPipelines::BuildIgvm(cmd) => cmd.into_pipeline(pipeline_hint), |
| 59 | OpenvmmPipelines::CustomVmfirmwareigvmDll(cmd) => cmd.into_pipeline(pipeline_hint), |
| 60 | |
| 61 | OpenvmmPipelines::Ci(cmd) => match cmd { |
| 62 | OpenvmmPipelinesCi::CheckinGates(cmd) => cmd.into_pipeline(pipeline_hint), |
| 63 | }, |
| 64 | OpenvmmPipelines::RestorePackages(cmd) => cmd.into_pipeline(pipeline_hint), |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |