flowey_lib_hvlite/_jobs/
cfg_common.rsuse flowey::node::prelude::*;
#[derive(Clone, Serialize, Deserialize)]
pub struct LocalOnlyParams {
pub interactive: bool,
pub auto_install: bool,
pub force_nuget_mono: bool,
pub external_nuget_auth: bool,
pub ignore_rust_version: bool,
}
flowey_request! {
#[derive(Clone)]
pub struct Params {
pub local_only: Option<LocalOnlyParams>,
pub verbose: ReadVar<bool>,
pub locked: bool,
pub deny_warnings: bool,
}
}
new_simple_flow_node!(struct Node);
impl SimpleFlowNode for Node {
type Request = Params;
fn imports(ctx: &mut ImportCtx<'_>) {
ctx.import::<crate::download_lxutil::Node>();
ctx.import::<crate::download_openhcl_kernel_package::Node>();
ctx.import::<crate::download_openvmm_deps::Node>();
ctx.import::<crate::download_uefi_mu_msvm::Node>();
ctx.import::<crate::git_checkout_openvmm_repo::Node>();
ctx.import::<crate::init_openvmm_cargo_config_deny_warnings::Node>();
ctx.import::<crate::install_git_credential_manager::Node>();
ctx.import::<crate::install_openvmm_rust_build_essential::Node>();
ctx.import::<flowey_lib_common::cfg_cargo_common_flags::Node>();
ctx.import::<flowey_lib_common::download_azcopy::Node>();
ctx.import::<flowey_lib_common::download_cargo_nextest::Node>();
ctx.import::<flowey_lib_common::download_nuget_exe::Node>();
ctx.import::<flowey_lib_common::download_protoc::Node>();
ctx.import::<flowey_lib_common::git_checkout::Node>();
ctx.import::<flowey_lib_common::install_dist_pkg::Node>();
ctx.import::<flowey_lib_common::install_azure_cli::Node>();
ctx.import::<flowey_lib_common::install_git::Node>();
ctx.import::<flowey_lib_common::install_nodejs::Node>();
ctx.import::<flowey_lib_common::install_nuget_azure_credential_provider::Node>();
ctx.import::<flowey_lib_common::install_rust::Node>();
ctx.import::<flowey_lib_common::nuget_install_package::Node>();
ctx.import::<flowey_lib_common::run_cargo_nextest_run::Node>();
ctx.import::<flowey_lib_common::use_gh_cli::Node>();
}
fn process_request(request: Self::Request, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> {
let Params {
local_only,
verbose,
locked,
deny_warnings,
} = request;
if matches!(ctx.backend(), FlowBackend::Github) {
if local_only.is_some() {
anyhow::bail!("can only set `local_only` params when using Local backend");
}
ctx.req(flowey_lib_common::install_azure_cli::Request::AutoInstall(
true,
));
ctx.req(flowey_lib_common::install_rust::Request::AutoInstall(true));
ctx.req(flowey_lib_common::install_rust::Request::IgnoreVersion(
false,
));
} else if matches!(ctx.backend(), FlowBackend::Ado) {
if local_only.is_some() {
anyhow::bail!("can only set `local_only` params when using Local backend");
}
ctx.req(flowey_lib_common::install_azure_cli::Request::AutoInstall(
true,
));
} else if matches!(ctx.backend(), FlowBackend::Local) {
let local_only =
local_only.ok_or(anyhow::anyhow!("missing essential request: local_only"))?;
let LocalOnlyParams {
interactive,
auto_install,
force_nuget_mono,
external_nuget_auth,
ignore_rust_version,
} = local_only;
{
ctx.req(
flowey_lib_common::install_dist_pkg::Request::LocalOnlyInteractive(interactive),
);
ctx.req(
flowey_lib_common::nuget_install_package::Request::LocalOnlyInteractive(
interactive,
),
);
ctx.req(
flowey_lib_common::nuget_install_package::Request::LocalOnlyInteractive(
interactive,
),
);
ctx.req(flowey_lib_common::use_gh_cli::Request::WithAuth(
flowey_lib_common::use_gh_cli::GhCliAuth::LocalOnlyInteractive,
));
ctx.req(flowey_lib_common::install_rust::Request::IgnoreVersion(
ignore_rust_version,
));
}
{
ctx.req(flowey_lib_common::install_rust::Request::AutoInstall(
auto_install,
));
ctx.req(
flowey_lib_common::install_nuget_azure_credential_provider::Request::LocalOnlyAutoInstall(
auto_install,
),
);
ctx.req(
flowey_lib_common::install_dist_pkg::Request::LocalOnlySkipUpdate(
!auto_install,
),
);
ctx.req(flowey_lib_common::install_nodejs::Request::AutoInstall(
auto_install,
));
ctx.req(flowey_lib_common::install_azure_cli::Request::AutoInstall(
auto_install,
));
ctx.req(
flowey_lib_common::install_git::Request::LocalOnlyAutoInstall(auto_install),
);
}
ctx.req(
flowey_lib_common::install_nuget_azure_credential_provider::Request::LocalOnlySkipAuthCheck(
external_nuget_auth,
),
);
ctx.req(
flowey_lib_common::download_nuget_exe::Request::LocalOnlyForceWsl2MonoNugetExe(
force_nuget_mono,
),
);
ctx.req(flowey_lib_common::git_checkout::Request::LocalOnlyRequireExistingClones(true));
} else {
anyhow::bail!("unsupported backend")
}
ctx.requests::<flowey_lib_common::cfg_cargo_common_flags::Node>([
flowey_lib_common::cfg_cargo_common_flags::Request::SetVerbose(verbose),
flowey_lib_common::cfg_cargo_common_flags::Request::SetLocked(locked),
]);
ctx.req(
crate::init_openvmm_cargo_config_deny_warnings::Request::DenyWarnings(deny_warnings),
);
Ok(())
}
}