Skip to content
Draft
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
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lp-app/lpa-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ async-trait = "0.1"
serde = { version = "1", features = ["derive"] }
lp-riscv-elf = { path = "../../lp-riscv/lp-riscv-elf", optional = true, features = ["std"] }
lp-riscv-emu = { path = "../../lp-riscv/lp-riscv-emu", optional = true, default-features = false }
log = { workspace = true, features = ["std"], optional = true }
serialport = { version = "4.8", optional = true }
hashbrown = { workspace = true, optional = true }
log = { workspace = true, features = ["std"], optional = true }

[features]
default = ["host"]
Expand Down
30 changes: 30 additions & 0 deletions lp-app/lpa-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,36 @@ where
Ok(ClientOutcome::new((), events))
}

/// Whole-project replace, then load: StopAll → clear dir → chunked
/// writes → LoadProject. The open-a-library-project primitive
/// (load-as-push, D19).
pub async fn replace_and_load_project(
&mut self,
project_id: &str,
files: &[(String, Vec<u8>)],
) -> ClientResult<ClientOutcome<WireProjectHandle>> {
let mut events = Vec::new();
let stop = self.send_request(ClientRequest::StopAllProjects).await?;
events.extend(stop.events);
validate_project_deploy_response(&ClientRequest::StopAllProjects, &stop.value.msg)?;

let deploy_files: Vec<ProjectDeployFile> = files
.iter()
.map(|(path, bytes)| ProjectDeployFile::new(path.clone(), bytes.clone()))
.collect();
let replace = self.replace_project_files(project_id, deploy_files).await?;
events.extend(replace.events);

let request = ClientRequest::LoadProject {
path: crate::project_deploy::project_load_path(project_id),
};
let outcome = self.send_request(request.clone()).await?;
events.extend(outcome.events);
let handle = validate_project_deploy_response(&request, &outcome.value.msg)?
.ok_or_else(|| ClientError::Protocol("load did not return a handle".into()))?;
Ok(ClientOutcome::new(handle, events))
}

/// Canonical package hash of a project directory (push/pull verify).
pub async fn hash_package(&mut self, project_id: &str) -> ClientResult<ClientOutcome<String>> {
let outcome = self
Expand Down
7 changes: 6 additions & 1 deletion lp-app/lpa-studio-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ description = "Headless LightPlayer Studio application core"
[dependencies]
lpa-client = { path = "../lpa-client", default-features = false }
lpa-link = { path = "../lpa-link" }
lpc-history = { path = "../../lp-core/lpc-history", default-features = false }
lpc-model = { path = "../../lp-core/lpc-model" }
lpc-view = { path = "../../lp-core/lpc-view" }
lpc-wire = { path = "../../lp-core/lpc-wire" }
lpfs = { path = "../../lp-base/lpfs", default-features = false }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
zip = { version = "2", default-features = false, features = ["deflate"] }
async-trait = { version = "0.1", optional = true }
js-sys = { version = "0.3", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
Expand All @@ -26,7 +31,7 @@ web-sys = { version = "0.3", optional = true, features = ["Window"] }
# LightPlayer server (simulator session, no UI). Never built for wasm.
lpa-server = { path = "../lpa-server" }
lpc-shared = { path = "../../lp-core/lpc-shared", features = ["std"] }
lpfs = { path = "../../lp-base/lpfs", features = ["std"] }
lpfs = { path = "../../lp-base/lpfs", features = ["std"] } # std for host tests

[features]
default = []
Expand Down
Loading
Loading