Set up a single executor based on its support level on the current system.
(
executor: &dyn Executor,
system_info: &SystemInfo,
setup_cache_dir: Option<&Path>,
run_environment: &RunEnvironment,
)
| 85 | |
| 86 | /// Set up a single executor based on its support level on the current system. |
| 87 | async fn setup_executor( |
| 88 | executor: &dyn Executor, |
| 89 | system_info: &SystemInfo, |
| 90 | setup_cache_dir: Option<&Path>, |
| 91 | run_environment: &RunEnvironment, |
| 92 | ) -> Result<()> { |
| 93 | let support_level = executor.support_level(system_info); |
| 94 | if support_level == ExecutorSupport::Unsupported { |
| 95 | info!( |
| 96 | "Skipping setup for the {} executor: not supported on {}", |
| 97 | executor.name(), |
| 98 | system_info.os |
| 99 | ); |
| 100 | return Ok(()); |
| 101 | } |
| 102 | |
| 103 | info!( |
| 104 | "Setting up the environment for the executor: {}", |
| 105 | executor.name() |
| 106 | ); |
| 107 | let result = setup_and_grant(executor, system_info, setup_cache_dir, run_environment).await; |
| 108 | |
| 109 | match result { |
| 110 | // We publish no tooling for this host, so the executor could only try. Leave the |
| 111 | // installation to the user and carry on with the other executors. |
| 112 | Err(error) if support_level == ExecutorSupport::RequiresManualInstallation => { |
| 113 | warn!( |
| 114 | "Could not set up the {} executor on {}, install its tooling manually: {error}", |
| 115 | executor.name(), |
| 116 | system_info.os |
| 117 | ); |
| 118 | Ok(()) |
| 119 | } |
| 120 | result => result, |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | async fn setup_and_grant( |
| 125 | executor: &dyn Executor, |
no test coverage detected