Skip to content

Commit

Permalink
Get rid of get_resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu-tow committed Jun 14, 2022
1 parent 34faf21 commit d6e3557
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ use ide_ci::programs::cargo;
use ide_ci::programs::rustc;
use ide_ci::programs::Cargo;
use ide_ci::programs::Git;
use std::any::type_name;
use std::time::Duration;
use tempfile::tempdir;
use tokio::process::Child;
Expand Down Expand Up @@ -296,10 +295,10 @@ impl Processor {
Target: IsTarget + IsTargetSource + Send + Sync + 'static,
Target: Resolvable,
{
let target = self.target();
let target = self.target::<Target>();
let get_task = self.target().map(|target| self.resolve(target, target_source));
let context = self.context();
async move { get_resolved(target?, context, get_task?.await?).await }.boxed()
async move { target?.get(context, get_task?.await?).await }.boxed()
}

pub fn build<Target: Resolvable>(&self, job: BuildJob<Target>) -> BoxFuture<'static, Result> {
Expand Down Expand Up @@ -631,34 +630,6 @@ impl WatchResolvable for Gui {
}
}

#[tracing::instrument(skip_all, fields(?target, ?get_task), err)]
pub async fn get_resolved<Target>(
target: Target,
context: project::Context,
get_task: GetTargetJob<Target>,
) -> Result<Target::Artifact>
where
Target: IsTarget + Send + Sync + 'static,
{
// We upload only built artifacts. There would be no point in uploading something that
// we've just downloaded.
let should_upload_artifact = matches!(get_task.inner, Source::BuildLocally(_)) && is_in_env();
let artifact = target.get(context, get_task).await?;
info!(
"Got target {}, should it be uploaded? {}",
type_name::<Target>(),
should_upload_artifact
);
if should_upload_artifact {
let upload_job = target.upload_artifact(ready(Ok(artifact.clone())));
// global::spawn(upload_job);
// info!("Spawned upload job for {}.", type_name::<Target>());
warn!("Forcing the job.");
upload_job.await?;
}
Ok(artifact)
}

#[tracing::instrument(err)]
pub async fn main_internal(config: enso_build::config::Config) -> Result {
setup_logging()?;
Expand Down

0 comments on commit d6e3557

Please sign in to comment.