Skip to content

Commit 44facc0

Browse files
authored
Support glob patterns in copy-to-archive (#2432)
...and ship all of the Cosmo sequencer register JSON files, just for fun
1 parent f4be456 commit 44facc0

5 files changed

Lines changed: 26 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ fletcher = { version = "0.3", default-features = false }
8282
fnv = { version = "1.0.7", default-features = false }
8383
getrandom = { version = "0.2", default-features = false }
8484
goblin = { version = "0.4.3", default-features = true } # goblin::Object doesn't work without everything enabled
85+
glob = { version = "0.3.3", default-features = false }
8586
heapless = { version = "0.7.17", default-features = false }
8687
heck = { version = "0.5.0", default-features = false }
8788
hkdf = { version = "0.12", default-features = false }

app/cosmo/base.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,14 @@ max-sizes = {flash = 131072, ram = 16384 }
202202
stacksize = 2600
203203
start = true
204204
task-slots = ["sys", {spi = "spi2_driver"}, "auxflash"]
205+
copy-to-archive = ["register_defs"]
205206

206207
[tasks.spartan7_loader.config]
207208
program_l = "sys_api::Port::B.pin(1)"
208209
init_l = "sys_api::Port::B.pin(6)"
209210
config_done = "sys_api::Port::B.pin(4)"
210211
user_reset_l = "sys_api::Port::A.pin(6)"
211-
212-
[tasks.cosmo_seq.config]
213-
fpga_image = "cosmo-a.bin"
214-
register_defs = "cosmo-regs-a.json"
212+
register_defs = "cosmo-seq/*.json"
215213

216214
[tasks.hash_driver]
217215
name = "drv-stm32h7-hash-server"

build/xtask/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ directories = { workspace = true }
2323
dunce = { workspace = true }
2424
filetime = { workspace = true }
2525
fnv = { workspace = true }
26+
glob = { workspace = true }
2627
goblin = { workspace = true }
2728
hex = "0.4"
2829
hubtools = { workspace = true }

build/xtask/src/dist.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -955,14 +955,20 @@ fn build_archive(
955955
let dir = pkg.manifest_path.parent().unwrap();
956956

957957
let f = dir.join(s);
958-
let task_dir = PathBuf::from("task").join(name).join(s);
959-
archive.copy(f, task_dir).with_context(|| {
960-
format!(
961-
"task {name}: failed to copy \"{s}\" in {} \
962-
into the archive",
963-
dir.display()
964-
)
965-
})?;
958+
let task_dir = PathBuf::from("task").join(name);
959+
for f in glob::glob(f.to_str().unwrap())? {
960+
let f = f?;
961+
let task_file = f.strip_prefix(dir)?;
962+
archive
963+
.copy(&f, task_dir.join(task_file))
964+
.with_context(|| {
965+
format!(
966+
"task {name}: failed to copy \"{s}\" in {} \
967+
into the archive",
968+
dir.display()
969+
)
970+
})?;
971+
}
966972
}
967973
Some(_) => {
968974
bail!(

0 commit comments

Comments
 (0)