Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pub enum SyncTarget {
Studio,
/// Write assets to the .asphalt-debug folder.
Debug,
/// Generate code from existing lockfile entries only.
/// Fails if any asset is not already in the lockfile.
Existing,
}

impl SyncTarget {
Expand Down
1 change: 1 addition & 0 deletions src/sync/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl Progress {
SyncTarget::Cloud { dry_run: true } => "checked",
SyncTarget::Cloud { dry_run: false } => "uploaded",
SyncTarget::Studio | SyncTarget::Debug => "written",
SyncTarget::Existing => "resolved",
};
parts.push(format!("{} {}", self.new, target_msg));
}
Expand Down
1 change: 1 addition & 0 deletions src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub async fn sync(args: SyncArgs, mp: MultiProgress) -> anyhow::Result<()> {
SyncTarget::Studio => {
Some(TargetBackend::Studio(backend::Studio::new(params).await?))
}
SyncTarget::Existing => None,
}
},
};
Expand Down
9 changes: 8 additions & 1 deletion src/sync/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
lockfile::Lockfile,
sync::TargetBackend,
};
use anyhow::Context;
use anyhow::{Context, bail};
use fs_err::tokio as fs;
use log::{debug, warn};
use relative_path::PathExt;
Expand Down Expand Up @@ -124,6 +124,13 @@ async fn process_entry(
.existing_lockfile
.get(&state.input_name, &asset.hash);

if matches!(state.params.target, SyncTarget::Existing) && lockfile_entry.is_none() {
bail!(
"Asset '{}' is not in the lockfile. Upload it first with 'asphalt sync'.",
rel_path
);
}

{
let mut seen_hashes = state.seen_hashes.lock().await;

Expand Down