From be4c50f02003e7c8aba37cf99d12cc143b10ad7d Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Mon, 15 Apr 2024 07:03:17 +0200 Subject: [PATCH] feat: command line option to skip dependency checks --- src/ui/app.rs | 9 ++++++++- src/ui/cmdline_opts.rs | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ui/app.rs b/src/ui/app.rs index 0e50ccd..c7e6f2b 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -103,6 +103,9 @@ pub struct App { #[tracker::do_not_track] wivrn_conf_editor: Option>, + + #[tracker::do_not_track] + skip_depcheck: bool, } #[derive(Debug)] @@ -460,7 +463,7 @@ impl SimpleComponent for App { // no listed deps for opencomp } jobs.extend(get_build_opencomposite_jobs(&profile, clean_build)); - if !missing_deps.is_empty() { + if !(self.skip_depcheck || missing_deps.is_empty()) { missing_deps.sort_unstable(); missing_deps.dedup(); // dedup only works if sorted, hence the above let distro = LinuxDistro::get(); @@ -731,6 +734,9 @@ impl SimpleComponent for App { if opts.start { sender.input(Msg::DoStartStopXRService) } + if opts.skip_depcheck { + self.skip_depcheck = true; + } } } } @@ -821,6 +827,7 @@ impl SimpleComponent for App { restart_xrservice: false, libmonado: None, wivrn_conf_editor: None, + skip_depcheck: false, }; let widgets = view_output!(); diff --git a/src/ui/cmdline_opts.rs b/src/ui/cmdline_opts.rs index c7ccd7b..5208b8a 100644 --- a/src/ui/cmdline_opts.rs +++ b/src/ui/cmdline_opts.rs @@ -11,12 +11,14 @@ use gtk4::{ pub struct CmdLineOpts { pub start: bool, pub profile_uuid: Option, + pub skip_depcheck: bool, } impl CmdLineOpts { const OPT_START: (&'static str, char) = ("start", 'S'); const OPT_LIST_PROFILES: (&'static str, char) = ("list-profiles", 'l'); const OPT_PROFILE: (&'static str, char) = ("profile", 'p'); + const OPT_SKIP_DEPCHECK: (&'static str, char) = ("skip-dependency-check", 'd'); pub fn init(app: &impl IsA) { app.add_main_option( @@ -43,6 +45,14 @@ impl CmdLineOpts { "Switch to the profile indicated by the UUID", None, ); + app.add_main_option( + Self::OPT_SKIP_DEPCHECK.0, + glib::Char::try_from(Self::OPT_SKIP_DEPCHECK.1).unwrap(), + glib::OptionFlags::IN_MAIN, + glib::OptionArg::None, + "Skip dependency checks when building profiles", + None, + ); } /// returns true if the application should quit @@ -67,6 +77,7 @@ impl CmdLineOpts { Ok(None) => None, Ok(Some(variant)) => Some(variant), }, + skip_depcheck: opts.contains(Self::OPT_SKIP_DEPCHECK.0), } } }