Refactor main.rs: Print resolution in resolve

This simplified `entry`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-18 17:21:35 +10:00
parent bcb46cd736
commit 119192f8ee
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -274,10 +274,6 @@ async fn entry() -> Result<()> {
resolutions.push(await_task(task).await??); resolutions.push(await_task(task).await??);
} }
for resolution in &resolutions {
resolution.print(&opts);
}
uithread.confirm().await?; uithread.confirm().await?;
resolutions resolutions
@ -301,9 +297,6 @@ async fn entry() -> Result<()> {
tokio::spawn(async move { tokio::spawn(async move {
let resolution = await_task(task).await??; let resolution = await_task(task).await??;
resolution.print(&opts);
install(resolution, opts, temp_dir_path, target).await install(resolution, opts, temp_dir_path, target).await
}) })
}) })
@ -454,7 +447,7 @@ async fn resolve(
fetchers.add(QuickInstall::new(&client, &fetcher_data).await); fetchers.add(QuickInstall::new(&client, &fetcher_data).await);
} }
match fetchers.first_available().await { let resolution = match fetchers.first_available().await {
Some(fetcher) => { Some(fetcher) => {
// Build final metadata // Build final metadata
let fetcher_target = fetcher.target(); let fetcher_target = fetcher.target();
@ -476,17 +469,21 @@ async fn resolve(
install_path.to_path_buf(), install_path.to_path_buf(),
)?; )?;
Ok(Resolution::Fetch { Resolution::Fetch {
fetcher, fetcher,
package, package,
crate_name, crate_name,
version, version,
bin_path, bin_path,
bin_files, bin_files,
}) }
} }
None => Ok(Resolution::InstallFromSource { package }), None => Resolution::InstallFromSource { package },
} };
resolution.print(&opts);
Ok(resolution)
} }
fn collect_bin_files( fn collect_bin_files(