mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-01 21:58:43 +00:00
feat: add ability to specify ref in repo urls
This commit is contained in:
parent
625602a6cf
commit
5420a2e975
7 changed files with 86 additions and 5 deletions
|
@ -9,6 +9,23 @@ pub struct Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Git {
|
impl Git {
|
||||||
|
fn get_repo(&self) -> String {
|
||||||
|
self.repo
|
||||||
|
.split('#')
|
||||||
|
.next()
|
||||||
|
.expect("Could not get repo url")
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_ref(&self) -> Option<String> {
|
||||||
|
let mut split = self.repo.split('#');
|
||||||
|
split.next().expect("Could not get repo url");
|
||||||
|
match split.next() {
|
||||||
|
None => None,
|
||||||
|
Some(s) => Some(s.into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_reset_runner(&self) -> Runner {
|
pub fn get_reset_runner(&self) -> Runner {
|
||||||
Runner::new(
|
Runner::new(
|
||||||
None,
|
None,
|
||||||
|
@ -34,10 +51,26 @@ impl Git {
|
||||||
Runner::new(
|
Runner::new(
|
||||||
None,
|
None,
|
||||||
"git".into(),
|
"git".into(),
|
||||||
vec!["clone".into(), self.repo.clone(), self.dir.clone(), "--recurse-submodules".into()],
|
vec![
|
||||||
|
"clone".into(),
|
||||||
|
self.get_repo(),
|
||||||
|
self.dir.clone(),
|
||||||
|
"--recurse-submodules".into(),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_checkout_ref_runner(&self) -> Option<Runner> {
|
||||||
|
match self.get_ref() {
|
||||||
|
Some(r) => Some(Runner::new(
|
||||||
|
None,
|
||||||
|
"git".into(),
|
||||||
|
vec!["-C".into(), self.dir.clone(), "checkout".into(), r],
|
||||||
|
)),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_clone_or_not_runner(&self) -> Option<Runner> {
|
pub fn get_clone_or_not_runner(&self) -> Option<Runner> {
|
||||||
let path_s = format!("{}/.git", self.dir.clone());
|
let path_s = format!("{}/.git", self.dir.clone());
|
||||||
let path = Path::new(&path_s);
|
let path = Path::new(&path_s);
|
||||||
|
|
|
@ -19,6 +19,15 @@ pub fn get_build_basalt_runners(profile: &Profile, clean_build: bool) -> Vec<Run
|
||||||
Some(r) => runners.push(r),
|
Some(r) => runners.push(r),
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
|
match git.get_checkout_ref_runner() {
|
||||||
|
Some(r) => {
|
||||||
|
runners.push(r);
|
||||||
|
if profile.pull_on_build {
|
||||||
|
runners.push(git.get_pull_runner());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
let build_dir = format!("{}/build", profile.features.basalt.path.as_ref().unwrap());
|
let build_dir = format!("{}/build", profile.features.basalt.path.as_ref().unwrap());
|
||||||
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
||||||
|
|
|
@ -19,6 +19,15 @@ pub fn get_build_libsurvive_runners(profile: &Profile, clean_build: bool) -> Vec
|
||||||
Some(r) => runners.push(r),
|
Some(r) => runners.push(r),
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
|
match git.get_checkout_ref_runner() {
|
||||||
|
Some(r) => {
|
||||||
|
runners.push(r);
|
||||||
|
if profile.pull_on_build {
|
||||||
|
runners.push(git.get_pull_runner());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
let build_dir = format!(
|
let build_dir = format!(
|
||||||
"{}/build",
|
"{}/build",
|
||||||
|
|
|
@ -19,6 +19,15 @@ pub fn get_build_monado_runners(profile: &Profile, clean_build: bool) -> Vec<Run
|
||||||
Some(r) => runners.push(r),
|
Some(r) => runners.push(r),
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
|
match git.get_checkout_ref_runner() {
|
||||||
|
Some(r) => {
|
||||||
|
runners.push(r);
|
||||||
|
if profile.pull_on_build {
|
||||||
|
runners.push(git.get_pull_runner());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
let build_dir = format!("{}/build", profile.xrservice_path);
|
let build_dir = format!("{}/build", profile.xrservice_path);
|
||||||
let mut env: HashMap<String, String> = HashMap::new();
|
let mut env: HashMap<String, String> = HashMap::new();
|
||||||
|
|
|
@ -19,6 +19,15 @@ pub fn get_build_opencomposite_runners(profile: &Profile, clean_build: bool) ->
|
||||||
Some(r) => runners.push(r),
|
Some(r) => runners.push(r),
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
|
match git.get_checkout_ref_runner() {
|
||||||
|
Some(r) => {
|
||||||
|
runners.push(r);
|
||||||
|
if profile.pull_on_build {
|
||||||
|
runners.push(git.get_pull_runner());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
let build_dir = format!("{}/build", profile.opencomposite_path);
|
let build_dir = format!("{}/build", profile.opencomposite_path);
|
||||||
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
||||||
|
|
|
@ -19,6 +19,15 @@ pub fn get_build_wivrn_runners(profile: &Profile, clean_build: bool) -> Vec<Runn
|
||||||
Some(r) => runners.push(r),
|
Some(r) => runners.push(r),
|
||||||
None => {}
|
None => {}
|
||||||
};
|
};
|
||||||
|
match git.get_checkout_ref_runner() {
|
||||||
|
Some(r) => {
|
||||||
|
runners.push(r);
|
||||||
|
if profile.pull_on_build {
|
||||||
|
runners.push(git.get_pull_runner());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
let build_dir = format!("{}/build", profile.xrservice_path);
|
let build_dir = format!("{}/build", profile.xrservice_path);
|
||||||
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
||||||
|
|
|
@ -90,6 +90,7 @@ impl SimpleComponent for ProfileEditor {
|
||||||
},
|
},
|
||||||
add: xrservicegrp = &adw::PreferencesGroup {
|
add: xrservicegrp = &adw::PreferencesGroup {
|
||||||
set_title: "XR Service",
|
set_title: "XR Service",
|
||||||
|
set_description: Some("When specifying a repository, you can set a specific git ref (branch, tag, commit...) by appending a '#' followed by the ref"),
|
||||||
add: {
|
add: {
|
||||||
withclones![prof];
|
withclones![prof];
|
||||||
&combo_row(
|
&combo_row(
|
||||||
|
@ -151,7 +152,7 @@ impl SimpleComponent for ProfileEditor {
|
||||||
},
|
},
|
||||||
add: opencompgrp = &adw::PreferencesGroup {
|
add: opencompgrp = &adw::PreferencesGroup {
|
||||||
set_title: "OpenComposite",
|
set_title: "OpenComposite",
|
||||||
set_description: Some("OpenVR driver built on top of OpenXR"),
|
set_description: Some("OpenVR driver built on top of OpenXR\n\nWhen specifying a repository, you can set a specific git ref (branch, tag, commit...) by appending a '#' followed by the ref"),
|
||||||
add: {
|
add: {
|
||||||
withclones![prof];
|
withclones![prof];
|
||||||
&path_row(
|
&path_row(
|
||||||
|
@ -177,7 +178,7 @@ impl SimpleComponent for ProfileEditor {
|
||||||
},
|
},
|
||||||
add: libsurvivegrp = &adw::PreferencesGroup {
|
add: libsurvivegrp = &adw::PreferencesGroup {
|
||||||
set_title: "Libsurvive",
|
set_title: "Libsurvive",
|
||||||
set_description: Some("Lighthouse tracking driver"),
|
set_description: Some("Lighthouse tracking driver\n\nWhen specifying a repository, you can set a specific git ref (branch, tag, commit...) by appending a '#' followed by the ref"),
|
||||||
add: {
|
add: {
|
||||||
withclones![prof];
|
withclones![prof];
|
||||||
&switch_row(
|
&switch_row(
|
||||||
|
@ -214,7 +215,7 @@ impl SimpleComponent for ProfileEditor {
|
||||||
},
|
},
|
||||||
add: basaltgrp = &adw::PreferencesGroup {
|
add: basaltgrp = &adw::PreferencesGroup {
|
||||||
set_title: "Basalt",
|
set_title: "Basalt",
|
||||||
set_description: Some("Camera based SLAM tracking driver"),
|
set_description: Some("Camera based SLAM tracking driver\n\nWhen specifying a repository, you can set a specific git ref (branch, tag, commit...) by appending a '#' followed by the ref"),
|
||||||
add: {
|
add: {
|
||||||
withclones![prof];
|
withclones![prof];
|
||||||
&switch_row(
|
&switch_row(
|
||||||
|
@ -294,7 +295,9 @@ impl SimpleComponent for ProfileEditor {
|
||||||
Self::Input::SaveProfile => {
|
Self::Input::SaveProfile => {
|
||||||
let prof = self.profile.borrow();
|
let prof = self.profile.borrow();
|
||||||
if prof.validate() {
|
if prof.validate() {
|
||||||
sender.output(ProfileEditorOutMsg::SaveProfile(prof.clone())).expect("Sender output failed");
|
sender
|
||||||
|
.output(ProfileEditorOutMsg::SaveProfile(prof.clone()))
|
||||||
|
.expect("Sender output failed");
|
||||||
self.win.as_ref().unwrap().close();
|
self.win.as_ref().unwrap().close();
|
||||||
} else {
|
} else {
|
||||||
self.win.as_ref().unwrap().add_toast(
|
self.win.as_ref().unwrap().add_toast(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue