feat: extra profile flag for system profiles; disable building profiles that cannot be built

This commit is contained in:
Gabriele Musco 2024-08-01 09:45:12 +02:00
commit 281dabf534
4 changed files with 44 additions and 34 deletions

View file

@ -270,6 +270,8 @@ pub struct Profile {
pub prefix: PathBuf, pub prefix: PathBuf,
pub can_be_built: bool, pub can_be_built: bool,
pub editable: bool, pub editable: bool,
#[serde(default)]
pub is_system: bool,
pub pull_on_build: bool, pub pull_on_build: bool,
#[serde(default = "LighthouseDriver::default")] #[serde(default = "LighthouseDriver::default")]
/// Only applicable for Monado /// Only applicable for Monado
@ -335,6 +337,7 @@ impl Default for Profile {
uuid, uuid,
autostart_command: None, autostart_command: None,
skip_dependency_check: false, skip_dependency_check: false,
is_system: false,
} }
} }
} }

View file

@ -1,10 +1,8 @@
use std::collections::HashMap;
use crate::{ use crate::{
constants::APP_NAME,
paths::{data_monado_path, data_opencomposite_path, SYSTEM_PREFIX}, paths::{data_monado_path, data_opencomposite_path, SYSTEM_PREFIX},
profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType}, profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType},
}; };
use std::collections::HashMap;
pub fn system_monado_profile() -> Profile { pub fn system_monado_profile() -> Profile {
let mut environment: HashMap<String, String> = HashMap::new(); let mut environment: HashMap<String, String> = HashMap::new();
@ -15,9 +13,10 @@ pub fn system_monado_profile() -> Profile {
environment.insert("XRT_CURATED_GUI".into(), "1".into()); environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into()); environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
Profile { Profile {
is_system: true,
prefix: SYSTEM_PREFIX.into(), prefix: SYSTEM_PREFIX.into(),
uuid: "system-monado-default".into(), uuid: "system-monado-default".into(),
name: format!("System Monado - {name} Default", name = APP_NAME), name: "System Monado".into(),
can_be_built: false, can_be_built: false,
// does it apply to system profiles? // does it apply to system profiles?
xrservice_path: data_monado_path(), xrservice_path: data_monado_path(),

View file

@ -1,10 +1,8 @@
use std::collections::HashMap;
use crate::{ use crate::{
constants::APP_NAME,
paths::{data_opencomposite_path, data_wivrn_path, SYSTEM_PREFIX}, paths::{data_opencomposite_path, data_wivrn_path, SYSTEM_PREFIX},
profile::{Profile, ProfileFeatures, XRServiceType}, profile::{Profile, ProfileFeatures, XRServiceType},
}; };
use std::collections::HashMap;
pub fn system_wivrn_profile() -> Profile { pub fn system_wivrn_profile() -> Profile {
let mut environment: HashMap<String, String> = HashMap::new(); let mut environment: HashMap<String, String> = HashMap::new();
@ -12,9 +10,10 @@ pub fn system_wivrn_profile() -> Profile {
environment.insert("XRT_CURATED_GUI".into(), "1".into()); environment.insert("XRT_CURATED_GUI".into(), "1".into());
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into()); environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
Profile { Profile {
is_system: true,
prefix: SYSTEM_PREFIX.into(), prefix: SYSTEM_PREFIX.into(),
uuid: "system-wivrn-default".into(), uuid: "system-wivrn-default".into(),
name: format!("System WiVRn - {name} Default", name = APP_NAME), name: "System WiVRn".into(),
can_be_built: false, can_be_built: false,
// does it apply to system profiles? // does it apply to system profiles?
xrservice_path: data_wivrn_path(), xrservice_path: data_wivrn_path(),

View file

@ -419,7 +419,18 @@ impl AsyncComponent for App {
let mut missing_deps = vec![]; let mut missing_deps = vec![];
let mut jobs = VecDeque::<WorkerJob>::new(); let mut jobs = VecDeque::<WorkerJob>::new();
// profile per se can't be built, but we still need opencomp // profile per se can't be built, but we still need opencomp
if profile.can_be_built { if !profile.can_be_built {
alert(
"This profile cannot be built",
if profile.is_system {
Some("This is a system profile: it assumes you have everything already installed in your system using your distro package manager or other means.")
} else {
None
},
Some(&self.app_win.clone().upcast()),
);
return;
}
missing_deps.extend(match profile.xrservice_type { missing_deps.extend(match profile.xrservice_type {
XRServiceType::Monado => get_missing_monado_deps(), XRServiceType::Monado => get_missing_monado_deps(),
XRServiceType::Wivrn => get_missing_wivrn_deps(), XRServiceType::Wivrn => get_missing_wivrn_deps(),
@ -444,8 +455,6 @@ impl AsyncComponent for App {
XRServiceType::Monado => get_build_monado_jobs(&profile, clean_build), XRServiceType::Monado => get_build_monado_jobs(&profile, clean_build),
XRServiceType::Wivrn => get_build_wivrn_jobs(&profile, clean_build), XRServiceType::Wivrn => get_build_wivrn_jobs(&profile, clean_build),
}); });
// no listed deps for opencomp
}
jobs.extend(get_build_opencomposite_jobs(&profile, clean_build)); jobs.extend(get_build_opencomposite_jobs(&profile, clean_build));
if !(self.skip_depcheck || profile.skip_dependency_check || missing_deps.is_empty()) if !(self.skip_depcheck || profile.skip_dependency_check || missing_deps.is_empty())
{ {