Skip to content

Commit

Permalink
release: 0.11.11
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Oct 18, 2024
2 parents a690f84 + 6c4d75e commit 2a21f6b
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 125 deletions.
33 changes: 16 additions & 17 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Project Dependencies
Package: refract
Version: 0.11.10
Generated: 2024-10-02 02:23:31 UTC
Version: 0.11.11
Generated: 2024-10-18 02:20:14 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [adler2](https://github.com/oyvindln/adler2) | 2.0.0 | [Jonas Schievink](mailto:[email protected]) and [oyvindln](mailto:[email protected]) | 0BSD, Apache-2.0, or MIT |
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.11 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
| [argyle](https://github.com/Blobfolio/argyle) | 0.8.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [argyle](https://github.com/Blobfolio/argyle) | 0.10.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [atk](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [atk-sys](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [bitflags](https://github.com/bitflags/bitflags) | 2.6.0 | The Rust Project Developers | Apache-2.0 or MIT |
| [bytemuck](https://github.com/Lokathor/bytemuck) | 1.18.0 | [Lokathor](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
| [bytemuck](https://github.com/Lokathor/bytemuck) | 1.19.0 | [Lokathor](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
| [cairo-rs](https://github.com/gtk-rs/gtk-rs-core) | 0.18.5 | The gtk-rs Project Developers | MIT |
| [cairo-sys-rs](https://github.com/gtk-rs/gtk-rs-core) | 0.18.2 | The gtk-rs Project Developers | MIT |
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
Expand All @@ -27,13 +27,13 @@
| [fastrand](https://github.com/smol-rs/fastrand) | 2.1.1 | [Stjepan Glavina](mailto:[email protected]) | Apache-2.0 or MIT |
| [field-offset](https://github.com/Diggsey/rust-field-offset) | 0.3.6 | [Diggory Blake](mailto:[email protected]) | Apache-2.0 or MIT |
| [flate2](https://github.com/rust-lang/flate2-rs) | 1.0.34 | [Alex Crichton](mailto:[email protected]) and [Josh Triplett](mailto:[email protected]) | Apache-2.0 or MIT |
| [futures-channel](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-core](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-executor](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-io](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-macro](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-task](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-util](https://github.com/rust-lang/futures-rs) | 0.3.30 | | Apache-2.0 or MIT |
| [futures-channel](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-core](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-executor](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-io](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-macro](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-task](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [futures-util](https://github.com/rust-lang/futures-rs) | 0.3.31 | | Apache-2.0 or MIT |
| [gdk](https://github.com/gtk-rs/gtk3-rs) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [gdk-pixbuf](https://github.com/gtk-rs/gtk-rs-core) | 0.18.5 | The gtk-rs Project Developers | MIT |
| [gdk-pixbuf-sys](https://github.com/gtk-rs/gtk-rs-core) | 0.18.0 | The gtk-rs Project Developers | MIT |
Expand All @@ -54,29 +54,28 @@
| [jpegxl-sys](https://github.com/inflation/jpegxl-rs) | 0.11.1+libjxl-0.11.0 | [Inflation](mailto:[email protected]) | GPL-3.0-or-later |
| [libaom-sys](https://github.com/njaard/libavif-rs) | 0.17.0+libaom.3.9.1 | [Charles Samuels](mailto:[email protected]), [Paolo Barbolini](mailto:[email protected]), and [Kornel](mailto:[email protected]) | BSD-2-Clause |
| [libavif-sys](https://github.com/njaard/libavif-rs) | 0.17.0+libavif.1.0.4 | [Charles Samuels](mailto:[email protected]) and [Paolo Barbolini](mailto:[email protected]) | BSD-2-Clause |
| [libc](https://github.com/rust-lang/libc) | 0.2.159 | The Rust Project Developers | Apache-2.0 or MIT |
| [libc](https://github.com/rust-lang/libc) | 0.2.161 | The Rust Project Developers | Apache-2.0 or MIT |
| [libwebp-sys2](https://github.com/qnighy/libwebp-sys2-rs) | 0.1.9 | [Masaki Hara](mailto:[email protected]) | BSD-3-Clause |
| [link-cplusplus](https://github.com/dtolnay/link-cplusplus) | 1.0.9 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [lodepng](https://github.com/kornelski/lodepng-rust.git) | 3.10.7 | [Kornel](mailto:[email protected]) and [Lode Vandevenne](mailto:[email protected]) | Zlib |
| [memchr](https://github.com/BurntSushi/memchr) | 2.7.4 | [Andrew Gallant](mailto:[email protected]) and bluss | MIT or Unlicense |
| [memoffset](https://github.com/Gilnaa/memoffset) | 0.9.1 | [Gilad Naaman](mailto:[email protected]) | MIT |
| [miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) | 0.8.0 | [Frommi](mailto:[email protected]) and [oyvindln](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
| [once_cell](https://github.com/matklad/once_cell) | 1.20.1 | [Aleksey Kladov](mailto:[email protected]) | Apache-2.0 or MIT |
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.2.10 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [once_cell](https://github.com/matklad/once_cell) | 1.20.2 | [Aleksey Kladov](mailto:[email protected]) | Apache-2.0 or MIT |
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.4.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [pango](https://github.com/gtk-rs/gtk-rs-core) | 0.18.3 | The gtk-rs Project Developers | MIT |
| [pango-sys](https://github.com/gtk-rs/gtk-rs-core) | 0.18.0 | The gtk-rs Project Developers | MIT |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | 0.2.14 | | Apache-2.0 or MIT |
| [pin-utils](https://github.com/rust-lang-nursery/pin-utils) | 0.1.0 | [Josef Brandl](mailto:[email protected]) | Apache-2.0 or MIT |
| [portable-atomic](https://github.com/taiki-e/portable-atomic) | 1.9.0 | | Apache-2.0 or MIT |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | 1.3.1 | [Bastian Köcher](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | 2.0.0 | [Bastian Köcher](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro-error](https://gitlab.com/CreepySkeleton/proc-macro-error) | 1.0.4 | [CreepySkeleton](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro-error-attr](https://gitlab.com/CreepySkeleton/proc-macro-error) | 1.0.4 | [CreepySkeleton](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.86 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.88 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
| [quote](https://github.com/dtolnay/quote) | 1.0.37 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [rayon](https://github.com/rayon-rs/rayon) | 1.10.0 | [Niko Matsakis](mailto:[email protected]) and [Josh Stone](mailto:[email protected]) | Apache-2.0 or MIT |
| [rayon-core](https://github.com/rayon-rs/rayon) | 1.12.1 | [Niko Matsakis](mailto:[email protected]) and [Josh Stone](mailto:[email protected]) | Apache-2.0 or MIT |
| [refract_core](https://github.com/Blobfolio/refract) | 0.11.10 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [refract_core](https://github.com/Blobfolio/refract) | 0.11.11 | [Josh Stoik](mailto:[email protected]) | WTFPL |
| [rgb](https://github.com/kornelski/rust-rgb) | 0.8.50 | [Kornel Lesiński](mailto:[email protected]) and [James Forster](mailto:[email protected]) | MIT |
| [serde](https://github.com/serde-rs/serde) | 1.0.210 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
| [slab](https://github.com/tokio-rs/slab) | 0.4.9 | [Carl Lerche](mailto:[email protected]) | MIT |
Expand Down
8 changes: 5 additions & 3 deletions refract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "refract"
version = "0.11.10"
version = "0.11.11"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand Down Expand Up @@ -88,17 +88,19 @@ label = "<PATH(s)…>"
description = "Image and/or directory paths to re-encode. Directories will be crawled recursively."

[build-dependencies]
argyle = "0.10.*"
dowser = "0.9.*"
oxford_join = "0.4.*"
toml = "0.8.14"
version-compare = "0.2.*"

[dependencies]
argyle = "0.8.*"
argyle = "0.10.*"
crossbeam-channel = "0.5.*"
dactyl = "0.7.*"
dowser = "0.9.*"
gtk = "=0.18.1"
oxford_join = "0.2.*"
oxford_join = "0.4.*"
write_atomic = "0.5.*"

[dependencies.refract_core]
Expand Down
33 changes: 29 additions & 4 deletions refract/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ This is used to compile a resource bundle of the various assets that need to
be pulled into GTK.
*/

use argyle::KeyWordsBuilder;
use dowser::Extension;
use oxford_join::JoinFmt;
use std::{
collections::HashMap,
ffi::OsStr,
fs::File,
io::Write,
io::{
BufWriter,
Write,
},
path::PathBuf,
process::{
Command,
Expand All @@ -31,11 +36,29 @@ pub fn main() {
println!("cargo:rerun-if-changed=Cargo.toml");
println!("cargo:rerun-if-changed=skel");

build_cli();
build_credits();
build_exts();
build_resources();
}

/// # Build CLI Keys.
fn build_cli() {
let mut builder = KeyWordsBuilder::default();
builder.push_keys([
"-h", "--help",
"--no-avif",
"--no-jxl",
"--no-webp",
"--no-lossless",
"--no-lossy",
"--no-ycbcr",
"-V", "--version",
]);
builder.push_keys_with_values(["-l", "--list"]);
builder.save(_out_path("argyle.rs").expect("Missing OUT_DIR."));
}

/// # Build Credits.
///
/// This compiles a list of crates used as direct dependencies (to both GTK and
Expand Down Expand Up @@ -88,11 +111,13 @@ fn build_credits() {
list.dedup();

// Save them as a slice value!
let mut file = _out_path("about-credits.txt")
let mut file = BufWriter::new(
_out_path("about-credits.txt")
.and_then(|p| File::create(p).ok())
.expect("Missing OUT_DIR.");
.expect("Missing OUT_DIR.")
);

file.write_fmt(format_args!("&[{}]", list.join(",")))
write!(&mut file, "&[{}]", JoinFmt::new(list.iter(), ","))
.and_then(|_| file.flush())
.expect("Unable to save credits.");
}
Expand Down
118 changes: 41 additions & 77 deletions refract/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ use share::{
};
use window::Window;

use argyle::{
Argue,
ArgyleError,
FLAG_HELP,
FLAG_VERSION,
};
use argyle::Argument;
use dowser::Dowser;
use gtk::{
glib::Bytes,
Expand Down Expand Up @@ -121,11 +116,8 @@ pub(crate) const CLI_NO_YCBCR: u8 = 0b0010_0000;
fn main() {
match _main() {
Ok(()) => {},
Err(RefractError::Argue(ArgyleError::WantsVersion)) => {
println!(concat!("Refract v", env!("CARGO_PKG_VERSION")));
},
Err(RefractError::Argue(ArgyleError::WantsHelp)) => {
helper();
Err(e @ (RefractError::PrintHelp | RefractError::PrintVersion)) => {
println!("{e}");
},
Err(e) => {
eprintln!("Error: {e}");
Expand Down Expand Up @@ -155,23 +147,46 @@ fn _main() -> Result<(), RefractError> {
);

// Load CLI arguments, if any.
let args = Argue::new(FLAG_HELP | FLAG_VERSION)?.with_list();
let args = argyle::args()
.with_keywords(include!(concat!(env!("OUT_DIR"), "/argyle.rs")));

let mut paths = Dowser::default();
let mut flags = 0_u8;
for arg in args {
match arg {
Argument::Key("-h" | "--help") => return Err(RefractError::PrintHelp),
Argument::Key("--no-avif") => { flags |= CLI_NO_AVIF; },
Argument::Key("--no-jxl") => { flags |= CLI_NO_JXL; },
Argument::Key("--no-webp") => { flags |= CLI_NO_WEBP; },
Argument::Key("--no-lossless") => { flags |= CLI_NO_LOSSLESS; },
Argument::Key("--no-lossy") => { flags |= CLI_NO_LOSSY; },
Argument::Key("--no-ycbcr") => { flags |= CLI_NO_YCBCR; },
Argument::Key("-V" | "--version") => return Err(RefractError::PrintVersion),

Argument::KeyWithValue("-l" | "--list", s) => if let Ok(s) = std::fs::read_to_string(s) {
paths = paths.with_paths(s.lines().filter_map(|line| {
let line = line.trim();
if line.is_empty() { None }
else { Some(line) }
}));
},

// Assume paths.
Argument::Other(s) => { paths = paths.with_path(s); },
Argument::InvalidUtf8(s) => { paths = paths.with_path(s); },

// Nothing else is relevant.
_ => {},
}
}

application.connect_activate(move |app| {
// Parse CLI setting overrides.
let flags = args.bitflags([
(&b"--no-avif"[..], CLI_NO_AVIF),
(&b"--no-jxl"[..], CLI_NO_JXL),
(&b"--no-webp"[..], CLI_NO_WEBP),
(&b"--no-lossless"[..], CLI_NO_LOSSLESS),
(&b"--no-lossy"[..], CLI_NO_LOSSY),
(&b"--no-ycbcr"[..], CLI_NO_YCBCR),
]);

let window = Rc::new(Window::new(app, flags).expect("Unable to build GTK window."));
let paths = Dowser::default()
.with_paths(args.args_os())
.into_vec_filtered(window::is_jpeg_png);
let window = Rc::new(Window::new(app, flags)
.expect("Unable to build GTK window."));

// We have to clone this because GTK doesn't do Rust properly. Haha.
let paths = paths.clone().into_vec_filtered(window::is_jpeg_png);

setup_ui(&window, paths);
window.paint();
});
Expand Down Expand Up @@ -347,54 +362,3 @@ fn setup_ui_window(window: &Rc<Window>) {
preview_cb!(connect_hide, hide, 0.0);
}
}

#[cold]
/// # Print Help.
fn helper() {
println!(concat!(
r"
..oFaa7l;'
=>r??\O@@@@QNk;
:|Fjjug@@@@@@@@N}}:
^/aPePN@@@@peWQ@Qez;
=iKBDB@@@O^:.::\kQO=~
=iKQ@QWOP: ~gBQw'|Qgz,
=i6RwEQ#s' N@RQQl i@D: ", "\x1b[38;5;199mRefract\x1b[0;38;5;69m v", env!("CARGO_PKG_VERSION"), "\x1b[0m", r#"
=?|>a@@Nv'^Q@@@Qe ,aW| Guided image conversion from
==;.\QQ@6,|Q@@@@p.;;+\, JPEG/PNG to AVIF/JPEG-XL/WebP.
'\tlFw9Wgs~W@@@@S ,;'
.^|QQp6D6t^iDRo;
~b@BEwDEu|:::
rR@Q6t7|=='
'i6Ko\=;
`''''`
USAGE:
refract [FLAGS] [OPTIONS] <PATH(S)>...
FORMAT FLAGS:
--no-avif Skip AVIF encoding.
--no-jxl Skip JPEG-XL encoding.
--no-webp Skip WebP encoding.
MODE FLAGS:
--no-lossless Skip lossless encoding passes.
--no-lossy Skip lossy encoding passes.
--no-ycbcr Skip AVIF YCbCr encoding passes.
MISC FLAGS:
-h, --help Print help information and exit.
-V, --version Print version information and exit.
OPTIONS:
-l, --list <FILE> Read (absolute) image and/or directory paths from this
text file — or STDIN if "-" — one path per line, instead
of or in addition to those specified inline via
<PATH(S)>.
TRAILING ARGS:
<PATH(S)>... Image and/or directory paths to re-encode. Directories
will be crawled recursively.
"#
));
}
4 changes: 2 additions & 2 deletions refract/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use gtk::{
prelude::*,
ResponseType,
};
use oxford_join::OxfordJoinFmt;
use refract_core::{
EncodeIter,
FLAG_NO_AVIF_YCBCR,
Expand Down Expand Up @@ -1109,7 +1110,6 @@ impl Window {
///
/// This triggers when an encoding session starts.
fn log_start(&self, count: usize, encoders: &[ImageKind]) {
use oxford_join::OxfordJoin;
use std::fmt::Write;

if encoders.is_empty() || count == 0 { return; }
Expand All @@ -1124,7 +1124,7 @@ impl Window {
),
count.nice_inflect("image", "images"),
encoders.len().nice_inflect("encoder", "encoders"),
encoders.oxford_and(),
OxfordJoinFmt::and(encoders),
);
self.add_flag(FLAG_TICK_STATUS);
}
Expand Down
8 changes: 2 additions & 6 deletions refract_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "refract_core"
version = "0.11.10"
version = "0.11.11"
license = "WTFPL"
authors = ["Josh Stoik <[email protected]>"]
edition = "2021"
Expand All @@ -19,10 +19,6 @@ version = "=3.10.7"
default-features = false
features = [ "rust_backend" ]

[dependencies.argyle]
version = "0.8.*"
optional = true

[dependencies.jpegxl-sys]
version = "=0.11.1"
default-features = false
Expand All @@ -47,7 +43,7 @@ default = []

# This feature adds a few generic RefractError types for the binary. It is not
# something external crates implementing this library would really need to use.
bin = [ "argyle" ]
bin = []

# This feature enables decoding support for the next-gen image formats, i.e.
# WebP, AVIF, and JPEG XL.
Expand Down
Loading

0 comments on commit 2a21f6b

Please sign in to comment.