Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package new assets-builder' artefacts using meta tree #381

Merged
merged 7 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
124 changes: 31 additions & 93 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions cargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-playdate"
version = "0.5.0-beta.4"
version = "0.5.0-beta.5"
readme = "README.md"
description = "Build tool for neat yellow console."
keywords = ["playdate", "build", "cargo", "plugin", "cargo-subcommand"]
Expand Down Expand Up @@ -43,7 +43,7 @@ toml.workspace = true
toml_edit = { version = "0.22", features = ["serde"] }
regex.workspace = true
byteorder = "1.5"
zip = { version = "1.1", features = ["time"] }
zip = { version = "2.1", features = ["time"] }
walkdir = "2.5"

anyhow = "1.0"
Expand Down
11 changes: 9 additions & 2 deletions cargo/src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ pub mod proto {
pub struct AssetsArtifactsNew<'t, 'cfg> {
artifacts: Vec<AssetsArtifact>,
index: BTreeMap<RootKey, Vec<usize>>,
tree: &'t MetaDeps<'cfg>,
pub tree: &'t MetaDeps<'cfg>,
}


impl AssetsArtifactsNew<'_, '_> {
pub fn len(&self) -> usize { self.artifacts.len() }
pub fn artifacts(&self) -> &[AssetsArtifact] { &self.artifacts }
pub fn index(&self) -> &BTreeMap<RootKey, Vec<usize>> { &self.index }

pub fn iter(&self) -> impl Iterator<Item = (&RootNode, impl Iterator<Item = &AssetsArtifact>)> {
self.index
.iter()
Expand Down Expand Up @@ -119,7 +123,10 @@ pub mod proto {

// checking cache, apply each plan:
for (index, plan) in plans.plans.into_iter().enumerate() {
let key = plans.index.iter().find(|(_, v)| **v == index).expect("key").0;
let key = plans.index
.iter()
.find_map(|(k, i)| (*i == index).then_some(k))
.ok_or_else(|| anyhow::anyhow!("No assets-plan key in plan #{index}"))?;

log::debug!("#{index} build (dev:{}) {}", key.dev, key.id);

Expand Down
Loading
Loading