Skip to content

Commit 7db608d

Browse files
authored
Dependencies: take craft-libs main at 23acc70493 (#4127)
* Updates: take craft-update from craft-libs main at 6e03f65bf craft-update moves from storytold/craft-libs at 1b34eba41 to 6e03f65bf, craft-libs main with the update fixes from #763 and #803. Cargo.lock records the new revision. The other craft-libs pins are unchanged. * Updates: take craft-update from craft-libs main at e98299546 craft-libs e98299546 includes #923: the check of whether the copy can install itself now runs on the update-check thread instead of in Updater::tick on the UI thread. * Dependencies: take craft-libs main at 3af2280ee3 Every craft-libs crate in the workspace moves to craft-libs main at 3af2280ee3, so the app builds against one craft-libs commit. - crates/codecs: the separate craft-avif-encode alias of craft-image-codecs is removed. With both on one commit, cargo refuses the same package under two names. On native targets the avif feature now enables craft-image-codecs' avif and threads features, so a build without avif, and the wasm32 build, still leave the AV1 encoder out. - crates/ui-egui: GroupLocation has two new fields, flyout_width and flyout_offset (storytold/craft-libs#627); the default dock location sets both to None, as craft-ui does for a new group. * Dependencies: take craft-libs main at 3af718585c Every craft-libs crate moves from 3af2280ee3 to craft-libs main at 3af718585c. craft-image-codecs now depends on the new craft-dds crate. * Flatpak: regenerate cargo sources for craft-libs at 3af718585c cargo-sources.json now lists the craft-libs git sources that Cargo.lock locks: one commit, 3af718585c, for every craft-libs crate, and the new craft-dds crate. It was generated with ./packaging/linux/flatpak/generate-cargo-sources.py. * Dependencies: take craft-libs main at 453b0da782 Every craft-libs crate moves from 3af718585c to craft-libs main at 453b0da782. Cargo.lock changes only the craft-libs source lines, and packaging/linux/flatpak/cargo-sources.json is regenerated with generate-cargo-sources.py for the new commit. craft-update now reads the installed files for a release the app offers on a thread of its own, and the prompt opens at a later tick (storytold/craft-libs#1149). startup_prompt_shows_and_closes offered a release and checked the prompt after one frame, so it failed when that thread had not answered yet. The test now waits for the thread's repaint request and ticks until the prompt opens. * Updates: startup prompt test fails instead of waiting forever The offer's thread sends its answer before it asks for a repaint, so the tick after that repaint reads the answer. The helper now ticks once after the repaint and asserts that the prompt is open, instead of waiting for another repaint that never comes when the answer opens no prompt. The test also gives its updater a pins file that does not exist, so a launcher choice on the machine running the tests does not stop the offer.
1 parent 51bb195 commit 7db608d

10 files changed

Lines changed: 189 additions & 980 deletions

File tree

‎Cargo.lock‎

Lines changed: 46 additions & 329 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,29 @@ rust-version = "1.95"
1010
repository = "https://github.com/storytold/lightcraft"
1111

1212
[workspace.dependencies]
13-
craft-webp-header = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ef5134ccc28db3a3aaba1e1a0c189340c5d277c" }
14-
craft-cms-profile = { package = "craft-cms", git = "https://github.com/storytold/craft-libs", rev = "eeb134def2daa7e03512b4946bd59d6b419b9484" }
15-
craft-plist = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "bea6ed1ff031b81df2d64be470485c1ca808847e" }
16-
craft-pdf-print = { package = "craft-pdf", git = "https://github.com/storytold/craft-libs", rev = "0fd30aeb3e02207d9d4c7c601540d9da45abf8de", default-features = false, features = ["write-raster"] }
17-
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["serde"] }
18-
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7" }
13+
craft-cms-profile = { package = "craft-cms", git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
14+
craft-plist = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
15+
craft-pdf-print = { package = "craft-pdf", git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", default-features = false, features = ["write-raster"] }
16+
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", features = ["serde"] }
17+
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
1918
# Canon CRW decoder shared with the other Craft apps
2019
craft-crw = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
21-
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "7f30d664695cd5ce14fc30659d36c3e32f234247" }
22-
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18", version = "0.1.0" }
23-
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "b77af389f30bb10de10d8436ca9b39fe94e3bb67", features = ["frames"] }
24-
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f", default-features = false, features = ["decode", "encode"] }
20+
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
21+
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", version = "0.1.0" }
22+
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", features = ["frames"] }
23+
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", default-features = false, features = ["decode", "encode"] }
2524
jixel = "=0.3.4"
2625
# Photo metadata: EXIF, IPTC-IIM, XMP packets and GPX track logs (craft-libs#949)
2726
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
28-
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "478c50560d3c6fad3d613af2a30b35c3bc9f4c0f" }
29-
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "c28356d400aed7575b04ec1551b4665107cfe845" }
30-
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "5c91598ccc86537a779f438d520fa6406c26efe6", features = ["av1", "av1-large-encode", "threads"] }
31-
# Isolate AVIF threading from the existing PNG/TIFF/WebP shared revision.
32-
craft-avif-encode = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "5ac7c9664c8d54aaf69d1bb826e187686c1a4e1a", default-features = false, features = ["avif", "threads"] }
33-
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f4758c01581d79577b9bf5046c06f4e77b1f18" }
27+
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
28+
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
29+
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", features = ["av1", "av1-large-encode", "threads"] }
30+
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
3431
# craft-update: app-specific pretend versions apply to startup and manual checks.
35-
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b", features = ["egui"] }
36-
craft-window = { git = "https://github.com/storytold/craft-libs", rev = "c5a1cbfb5f9049f9270955caffb5bee5997aebf7", features = ["egui"] }
32+
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", features = ["egui"] }
33+
craft-window = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", features = ["egui"] }
3734
# HDR gain maps: ISO 21496-1 and hdrgm metadata, compute and apply (moved from crates/codecs; craft-libs#904).
38-
craft-gainmap = { git = "https://github.com/storytold/craft-libs", rev = "9dcbd90c7d16e1a668b3afa057e940e2db328b93" }
35+
craft-gainmap = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
3936
# PSD/PSB: the header, colour mode data and image resources (craft-libs#885).
4037
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" }
4138
jpeg-encoder = { version = "0.7", default-features = false, features = ["std"] }
@@ -69,7 +66,7 @@ lightcraft-ui-egui = { path = "crates/ui-egui" }
6966
lightcraft-mcp = { path = "crates/mcp" }
7067
lightcraft-fetch = { path = "crates/fetch" }
7168
# HEIC/HEIF: the shared decoder (moved from crates/heif; craft-libs#784).
72-
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "4ffa307f1a0a6fbd8897318cc719440ab06e9c63", default-features = false }
69+
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", default-features = false }
7370
lightcraft-segment = { path = "crates/segment" }
7471
lightcraft-geocode = { path = "crates/geocode" }
7572
lightcraft-slideshow = { path = "crates/slideshow" }

‎crates/codecs/Cargo.toml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ craft-gainmap = { workspace = true }
1616
craft-cms = { workspace = true }
1717
craft-jpeg = { workspace = true }
1818
craft-image-codecs = { workspace = true }
19-
craft-webp-header = { workspace = true }
20-
# Isolate BMP routing until the shared prerequisite lands; other codec pins stay unchanged.
21-
craft-bmp-header = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "a9efd722b49924588448fba5c59f36d3aee3f4c6", default-features = false }
22-
craft-image-codecs-sef = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "cae7c1d8a6fec9a9ee136169918c5dd20ca509a0" }
2319
craft-metadata = { workspace = true }
2420
craft-tiff = { workspace = true }
2521
craft-gif = { workspace = true }
@@ -33,7 +29,7 @@ craft-jxl = { workspace = true, optional = true }
3329

3430
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
3531
craft-video = { workspace = true, optional = true }
36-
craft-avif-encode = { workspace = true, optional = true }
32+
craft-image-codecs = { workspace = true, optional = true, features = ["avif", "threads"] }
3733

3834
[features]
3935
default = ["parallel", "jxl", "avif"]
@@ -45,7 +41,7 @@ jxl = ["dep:craft-jxl"]
4541
# PhotoCraft); `cargo xtask ci` clippies and tests it (`--features heif`), releases don't ship it yet.
4642
heif = ["dep:craft-heif"]
4743
## AVIF/AV1 encoding via craft-image-codecs / craft-video (pure Rust), plus the shared AVIF decoder. Native targets only; a no-op on wasm32.
48-
avif = ["dep:craft-video", "dep:craft-avif-encode", "craft-image-codecs/avif-decode"]
44+
avif = ["dep:craft-video", "dep:craft-image-codecs", "craft-image-codecs/avif-decode"]
4945

5046
[dev-dependencies]
5147
# tests record why they skip (`cargo xtask ci` lists the skips)

‎crates/codecs/src/encode.rs‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -290,23 +290,9 @@ pub fn encode_avif(img: &EncodeImage, quality: u8, speed: u8, meta: &EncodeMeta)
290290
img.validate()?;
291291
#[cfg(all(feature = "avif", not(target_arch = "wasm32")))]
292292
{
293-
// Keep AVIF on its threading-capable shared revision without changing other codecs.
294-
use craft_avif_encode::{ChannelLayout, Image};
295-
let n = img.width as usize * img.height as usize * img.channels as usize;
296-
let layout = match img.channels {
297-
1 => ChannelLayout::Gray,
298-
2 => ChannelLayout::GrayA,
299-
3 => ChannelLayout::Rgb,
300-
_ => ChannelLayout::Rgba,
301-
};
302-
let mut ic_img = match img.samples {
303-
Samples::U8(s) => Image::from_u8(img.width, img.height, layout, s[..n].to_vec()),
304-
Samples::U16(s) => Image::from_u16(img.width, img.height, layout, &s[..n]),
305-
Samples::F32(_) => return Err(Error::Encode("AVIF encoder needs 8- or 16-bit samples".into())),
306-
}
307-
.map_err(|e| Error::Encode(e.to_string()))?;
293+
let mut ic_img = shared_image(img, Some("AVIF encoder needs 8- or 16-bit samples"))?;
308294
ic_img.meta.exif = meta.exif.map(|e| e.to_vec());
309-
craft_avif_encode::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string()))
295+
craft_image_codecs::encode_avif_with_speed(&ic_img, quality, speed).map_err(|e| Error::Encode(e.to_string()))
310296
}
311297
#[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))]
312298
{
@@ -384,10 +370,10 @@ pub fn encode_avif_hdr(width: u32, height: u32, rgb: &[f32], quality: u8, speed:
384370
{
385371
let _ = (w, h, n);
386372
let t = match transfer {
387-
HdrTransfer::Pq => craft_avif_encode::HdrTransfer::Pq,
388-
HdrTransfer::Hlg => craft_avif_encode::HdrTransfer::Hlg,
373+
HdrTransfer::Pq => craft_image_codecs::HdrTransfer::Pq,
374+
HdrTransfer::Hlg => craft_image_codecs::HdrTransfer::Hlg,
389375
};
390-
craft_avif_encode::encode_avif_hdr(width, height, rgb, quality, speed, meta.exif, t).map_err(|e| Error::Encode(e.to_string()))
376+
craft_image_codecs::encode_avif_hdr(width, height, rgb, quality, speed, meta.exif, t).map_err(|e| Error::Encode(e.to_string()))
391377
}
392378
#[cfg(not(all(feature = "avif", not(target_arch = "wasm32"))))]
393379
{

‎crates/codecs/src/jpeg.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
use crate::convert::{Buf, Meta, Model, Raw, check_size, finish};
55
use crate::{DecodeOptions, Decoded, Error, Format, Result, Thumbnail, ThumbnailSource, exif};
6-
use craft_image_codecs_sef::jpeg_sef::{reaches_eoi, repair as without_sef_trailer};
6+
use craft_image_codecs::jpeg_sef::{reaches_eoi, repair as without_sef_trailer};
77

88
const F: Format = Format::Jpeg;
99

‎crates/codecs/src/sniff.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn sniff(b: &[u8]) -> Option<Format> {
132132
if b.starts_with(b"II+\0") || b.starts_with(b"MM\0+") {
133133
return Some(Format::Tiff);
134134
}
135-
if craft_bmp_header::bmp_probe::is_supported_header(b) {
135+
if craft_image_codecs::bmp_probe::is_supported_header(b) {
136136
return Some(Format::Bmp);
137137
}
138138
None

‎crates/codecs/src/webp.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) fn decode(bytes: &[u8], opts: &DecodeOptions) -> Result<Decoded> {
4141
/// animation frame), or one that runs past the end of the file (truncated). The compressed data
4242
/// itself is not checked.
4343
pub(crate) fn header(bytes: &[u8]) -> Result<(u32, u32, u16)> {
44-
let (w, h, orientation) = craft_webp_header::webp_probe::header(bytes).map_err(err)?;
44+
let (w, h, orientation) = craft_image_codecs::webp_probe::header(bytes).map_err(err)?;
4545
check_size(F, w as u64, h as u64, &DecodeOptions::default())?;
4646
Ok((w, h, orientation))
4747
}

‎crates/ui-egui/src/dialogs/updates_ui.rs‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,32 @@ mod tests {
185185
}
186186
}
187187

188+
/// Offers `release` and returns once its prompt is open. The updater reads the installed
189+
/// files for an offer on a thread of its own. That thread sends its answer and then asks the
190+
/// first context the updater was ticked with for a repaint, so the tick after that repaint
191+
/// reads the answer and opens the prompt. `updater` must not have been ticked before, or the
192+
/// repaint goes to another context. The test fails when the launcher manages this copy or
193+
/// when the answered offer opens no prompt.
194+
#[cfg(not(target_arch = "wasm32"))]
195+
fn offer_and_wait(updater: &mut Updater, release: craft_update::Release) {
196+
let ctx = egui::Context::default();
197+
let (answered, wait) = std::sync::mpsc::channel();
198+
ctx.set_repaint_observer(move |info| {
199+
if info.delay.is_zero() {
200+
let _ = answered.send(());
201+
}
202+
});
203+
// Keeps `ctx` for the offer's thread.
204+
updater.tick(&ctx);
205+
updater.offer(release);
206+
assert!(updater.managed().is_none(), "the launcher manages this copy, so it ignored the offer");
207+
if !updater.prompt_open() {
208+
wait.recv().unwrap();
209+
updater.tick(&ctx);
210+
}
211+
assert!(updater.prompt_open(), "the answered offer opened no prompt");
212+
}
213+
188214
#[test]
189215
#[cfg(not(target_arch = "wasm32"))]
190216
fn startup_prompt_shows_and_closes() {
@@ -197,7 +223,10 @@ mod tests {
197223
html_url: "https://github.com/storytold/lightcraft/releases/tag/v99.0.0".into(),
198224
..Default::default()
199225
};
200-
app.updates_rt.updater.offer(release);
226+
// A missing pins file means stable releases, whatever the launcher on this machine chose.
227+
let no_pins = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("no-launcher-pins.json");
228+
app.updates_rt.updater = Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")).with_pins_path(no_pins);
229+
offer_and_wait(&mut app.updates_rt.updater, release);
201230

202231
let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
203232
show(&mut app, ui.ctx());

‎crates/ui-egui/src/docking.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn home(workspace: &Workspace, panel: Panel) -> Location<Panel> {
123123
size: None,
124124
stack: None,
125125
sibling: Vec::new(),
126-
group: Some(GroupLocation { minimized: false, height: None, column: Some(column) }),
126+
group: Some(GroupLocation { minimized: false, height: None, flyout_width: None, flyout_offset: None, column: Some(column) }),
127127
}
128128
}
129129

0 commit comments

Comments
 (0)