Skip to content

Commit 726d100

Browse files
authored
Merge pull request #9 from OneNoted/release-0-4-0-prep
chore(release): prep 0.4.0
2 parents 3aded6e + e9575e0 commit 726d100

40 files changed

Lines changed: 7913 additions & 835 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ edition = "2024"
1919
homepage = "https://github.com/OneNoted/taskers"
2020
license = "MIT OR Apache-2.0"
2121
repository = "https://github.com/OneNoted/taskers"
22-
version = "0.3.1"
22+
version = "0.4.0"
2323

2424
[workspace.dependencies]
2525
adw = { package = "libadwaita", version = "0.9.1" }
@@ -46,13 +46,13 @@ ureq = "2.12.1"
4646
uuid = { version = "1.22.0", features = ["serde", "v7"] }
4747
webkit6 = { version = "0.6.1", features = ["v2_50"] }
4848
xz2 = "0.1"
49-
taskers-core = { version = "0.3.1", path = "crates/taskers-core" }
50-
taskers-cli = { version = "0.3.1", path = "crates/taskers-cli" }
51-
taskers-control = { version = "0.3.1", path = "crates/taskers-control" }
52-
taskers-domain = { version = "0.3.1", path = "crates/taskers-domain" }
53-
taskers-ghostty = { version = "0.3.1", path = "crates/taskers-ghostty" }
54-
taskers-host = { version = "0.3.1", path = "crates/taskers-host" }
55-
taskers-paths = { version = "0.3.1", path = "crates/taskers-paths" }
56-
taskers-runtime = { version = "0.3.1", path = "crates/taskers-runtime" }
57-
taskers-shell = { version = "0.3.1", path = "crates/taskers-shell" }
58-
taskers-shell-core = { version = "0.3.1", path = "crates/taskers-shell-core" }
49+
taskers-core = { version = "0.4.0", path = "crates/taskers-core" }
50+
taskers-cli = { version = "0.4.0", path = "crates/taskers-cli" }
51+
taskers-control = { version = "0.4.0", path = "crates/taskers-control" }
52+
taskers-domain = { version = "0.4.0", path = "crates/taskers-domain" }
53+
taskers-ghostty = { version = "0.4.0", path = "crates/taskers-ghostty" }
54+
taskers-host = { version = "0.4.0", path = "crates/taskers-host" }
55+
taskers-paths = { version = "0.4.0", path = "crates/taskers-paths" }
56+
taskers-runtime = { version = "0.4.0", path = "crates/taskers-runtime" }
57+
taskers-shell = { version = "0.4.0", path = "crates/taskers-shell" }
58+
taskers-shell-core = { version = "0.4.0", path = "crates/taskers-shell-core" }

crates/taskers-app/src/linux_install.rs

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::{
99
use anyhow::{Context, Result, anyhow};
1010

1111
const SKIP_DESKTOP_INTEGRATION_ENV: &str = "TASKERS_SKIP_DESKTOP_INTEGRATION";
12+
const RELEASE_EXECUTABLE_NAMES: &[&str] = &["taskers", "taskers-gtk"];
1213

1314
pub fn run(args: &[OsString]) -> Result<ExitStatus> {
1415
install_linux_user_assets()?;
@@ -78,6 +79,8 @@ pub fn install_linux_user_assets() -> Result<()> {
7879
let legacy_desktop_launcher = cargo_bin_home
7980
.as_deref()
8081
.map(|path| path.join("taskers-gtk-desktop-launch"));
82+
let launcher_release_execs =
83+
launcher_managed_release_execs(&taskers_paths::default_release_install_root());
8184
let desktop_entry = include_str!(concat!(
8285
env!("CARGO_MANIFEST_DIR"),
8386
"/assets/taskers.desktop.in"
@@ -88,6 +91,7 @@ pub fn install_linux_user_assets() -> Result<()> {
8891
&desktop_launcher,
8992
&launcher,
9093
legacy_desktop_launcher.as_deref(),
94+
&launcher_release_execs,
9195
)? {
9296
fs::write(&desktop_entry_path, desktop_entry)
9397
.with_context(|| format!("failed to write {}", desktop_entry_path.display()))?;
@@ -172,6 +176,7 @@ fn should_update_desktop_entry(
172176
desktop_launcher: &Path,
173177
launcher: &Path,
174178
legacy_desktop_launcher: Option<&Path>,
179+
launcher_release_execs: &[String],
175180
) -> Result<bool> {
176181
let Ok(existing) = fs::read_to_string(path) else {
177182
return Ok(true);
@@ -188,12 +193,38 @@ fn should_update_desktop_entry(
188193
if let Some(legacy_desktop_launcher) = legacy_desktop_launcher {
189194
managed_execs.push(desktop_exec(legacy_desktop_launcher));
190195
}
196+
managed_execs.extend(launcher_release_execs.iter().cloned());
191197

192198
Ok(managed_execs
193199
.iter()
194200
.any(|candidate| candidate == existing_exec))
195201
}
196202

203+
fn launcher_managed_release_execs(release_root: &Path) -> Vec<String> {
204+
let mut execs = Vec::new();
205+
let Ok(versions) = fs::read_dir(release_root) else {
206+
return execs;
207+
};
208+
209+
for version in versions.flatten() {
210+
let Ok(targets) = fs::read_dir(version.path()) else {
211+
continue;
212+
};
213+
214+
for target in targets.flatten() {
215+
let bin_dir = target.path().join("bin");
216+
for executable_name in RELEASE_EXECUTABLE_NAMES {
217+
let executable = bin_dir.join(executable_name);
218+
if executable.is_file() {
219+
execs.push(desktop_exec(&executable));
220+
}
221+
}
222+
}
223+
}
224+
225+
execs
226+
}
227+
197228
fn remove_legacy_desktop_integration(legacy_desktop_launcher: Option<&Path>) -> Result<bool> {
198229
let Some(legacy_desktop_launcher) = legacy_desktop_launcher else {
199230
return Ok(false);
@@ -332,8 +363,8 @@ fn remove_path(path: &Path) -> Result<()> {
332363
mod tests {
333364
use super::{
334365
desktop_exec, desktop_launch_wrapper_contents, exit_code_from_status,
335-
launcher_path_looks_installed, path_taskers_executable, remove_legacy_desktop_integration,
336-
should_update_desktop_entry,
366+
launcher_managed_release_execs, launcher_path_looks_installed, path_taskers_executable,
367+
remove_legacy_desktop_integration, should_update_desktop_entry,
337368
};
338369
#[cfg(unix)]
339370
use std::os::unix::fs::symlink;
@@ -401,7 +432,7 @@ mod tests {
401432

402433
let launcher = PathBuf::from("/home/notes/.local/bin/taskers");
403434
assert!(
404-
!should_update_desktop_entry(&desktop_entry, &launcher, &launcher, None)
435+
!should_update_desktop_entry(&desktop_entry, &launcher, &launcher, None, &[])
405436
.expect("decision"),
406437
);
407438
}
@@ -418,7 +449,7 @@ mod tests {
418449
.expect("desktop entry");
419450

420451
assert!(
421-
should_update_desktop_entry(&desktop_entry, &launcher, &launcher, None)
452+
should_update_desktop_entry(&desktop_entry, &launcher, &launcher, None, &[])
422453
.expect("decision")
423454
);
424455
}
@@ -442,6 +473,40 @@ mod tests {
442473
&desktop_launcher,
443474
&launcher,
444475
Some(&legacy_launcher),
476+
&[],
477+
)
478+
.expect("decision")
479+
);
480+
}
481+
482+
#[test]
483+
fn updates_launcher_managed_release_desktop_entry() {
484+
let temp = tempdir().expect("tempdir");
485+
let desktop_entry = temp.path().join("dev.taskers.app.desktop");
486+
let desktop_launcher = PathBuf::from("/home/notes/.local/bin/taskers-desktop-launch");
487+
let launcher = PathBuf::from("/home/notes/.cargo/bin/taskers");
488+
let release_root = temp.path().join("releases");
489+
let release_exec = release_root
490+
.join("0.4.0")
491+
.join("x86_64-unknown-linux-gnu")
492+
.join("bin")
493+
.join("taskers-gtk");
494+
fs::create_dir_all(release_exec.parent().expect("bin dir")).expect("create release dir");
495+
fs::write(&release_exec, "#!/bin/sh\n").expect("release executable");
496+
fs::write(
497+
&desktop_entry,
498+
format!("[Desktop Entry]\nExec={}\n", desktop_exec(&release_exec)),
499+
)
500+
.expect("desktop entry");
501+
502+
let release_execs = launcher_managed_release_execs(&release_root);
503+
assert!(
504+
should_update_desktop_entry(
505+
&desktop_entry,
506+
&desktop_launcher,
507+
&launcher,
508+
None,
509+
&release_execs,
445510
)
446511
.expect("decision")
447512
);

0 commit comments

Comments
 (0)