mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-19 19:14:53 +00:00
feat: add format check to ci
This commit is contained in:
parent
5420a2e975
commit
6cb835a47e
25 changed files with 122 additions and 81 deletions
|
@ -1,9 +1,22 @@
|
|||
image: "debian:testing"
|
||||
|
||||
stages:
|
||||
- check
|
||||
- test
|
||||
- deploy
|
||||
|
||||
cargo:fmtcheck:
|
||||
image: "rust:slim"
|
||||
stage: check
|
||||
script:
|
||||
- rustup component add rustfmt
|
||||
# Create blank versions of our configured files
|
||||
# so rustfmt does not yell about non-existent files or completely empty files
|
||||
- echo -e "" >> src/constants.rs
|
||||
- rustc -Vv && cargo -Vv
|
||||
- cargo fmt --version
|
||||
- cargo fmt --all -- --check
|
||||
|
||||
cargo:test:
|
||||
stage: test
|
||||
script:
|
||||
|
|
10
src/adb.rs
10
src/adb.rs
|
@ -1,11 +1,13 @@
|
|||
use std::path::Path;
|
||||
use crate::runner::Runner;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn get_adb_install_runner(apk_path: &String) -> Runner {
|
||||
let path = Path::new(apk_path);
|
||||
path.try_exists().expect("APK file provided does not exist");
|
||||
let runner = Runner::new(None, "adb".into(), vec![
|
||||
"install".into(), path.to_str().unwrap().to_string()
|
||||
]);
|
||||
let runner = Runner::new(
|
||||
None,
|
||||
"adb".into(),
|
||||
vec!["install".into(), path.to_str().unwrap().to_string()],
|
||||
);
|
||||
runner
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pub mod build_monado;
|
||||
pub mod build_libsurvive;
|
||||
pub mod build_opencomposite;
|
||||
pub mod build_basalt;
|
||||
pub mod build_wivrn;
|
||||
pub mod build_libsurvive;
|
||||
pub mod build_mercury;
|
||||
pub mod build_monado;
|
||||
pub mod build_opencomposite;
|
||||
pub mod build_wivrn;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::depcheck::{check_dependencies, Dependency, DependencyCheckResult, DepType};
|
||||
use crate::depcheck::{check_dependencies, DepType, Dependency, DependencyCheckResult};
|
||||
|
||||
fn basalt_deps() -> Vec<Dependency> {
|
||||
vec![
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::depcheck::{Dependency, DepType, check_dependencies, DependencyCheckResult};
|
||||
use crate::depcheck::{check_dependencies, DepType, Dependency, DependencyCheckResult};
|
||||
|
||||
fn libsurvive_deps() -> Vec<Dependency> {
|
||||
vec![
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::depcheck::{Dependency, DepType, DependencyCheckResult, check_dependencies};
|
||||
use crate::depcheck::{check_dependencies, DepType, Dependency, DependencyCheckResult};
|
||||
|
||||
fn mercury_deps() -> Vec<Dependency> {
|
||||
vec![
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pub mod monado_deps;
|
||||
pub mod libsurvive_deps;
|
||||
pub mod basalt_deps;
|
||||
pub mod wivrn_deps;
|
||||
pub mod adb_dep;
|
||||
pub mod pkexec_dep;
|
||||
pub mod basalt_deps;
|
||||
pub mod libsurvive_deps;
|
||||
pub mod mercury_deps;
|
||||
pub mod monado_deps;
|
||||
pub mod pkexec_dep;
|
||||
pub mod wivrn_deps;
|
||||
|
|
|
@ -2,9 +2,7 @@ use std::fmt::Display;
|
|||
|
||||
use crate::{
|
||||
profile::Profile,
|
||||
profiles::{
|
||||
lighthouse::lighthouse_profile, wivrn::wivrn_profile,
|
||||
},
|
||||
profiles::{lighthouse::lighthouse_profile, wivrn::wivrn_profile},
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
|
|
@ -43,7 +43,7 @@ pub fn download_file(url: String, path: String) -> JoinHandle<Result<(), reqwest
|
|||
writer.flush().expect("Failed to flush download writer");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e)
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -18,7 +18,9 @@ pub static ENV_VAR_DESCRIPTIONS: Map<&str, &str> = phf_map! {
|
|||
};
|
||||
|
||||
pub fn env_var_descriptions_as_paragraph() -> String {
|
||||
ENV_VAR_DESCRIPTIONS.into_iter()
|
||||
ENV_VAR_DESCRIPTIONS
|
||||
.into_iter()
|
||||
.map(|(k, v)| format!("{}: {}", k, v))
|
||||
.collect::<Vec<String>>().join("\n\n")
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n\n")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub mod active_runtime_json;
|
||||
pub mod monado_autorun;
|
||||
pub mod openvrpaths_vrpath;
|
||||
pub mod wivrn_config;
|
||||
pub mod monado_autorun;
|
||||
|
|
|
@ -125,7 +125,9 @@ pub fn set_current_openvrpaths_to_profile(profile: &Profile) -> Result<(), ()> {
|
|||
let dest = get_openvrpaths_vrpath_path();
|
||||
checkerr!(set_file_readonly(&dest, false));
|
||||
backup_steam_openvrpaths();
|
||||
checkerr!(dump_current_openvrpaths(&build_profile_openvrpaths(profile)));
|
||||
checkerr!(dump_current_openvrpaths(&build_profile_openvrpaths(
|
||||
profile
|
||||
)));
|
||||
checkerr!(set_file_readonly(&dest, true));
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
use crate::runner::Runner;
|
||||
use nix::{sys::statvfs::{statvfs, FsFlags}, errno::Errno};
|
||||
use nix::{
|
||||
errno::Errno,
|
||||
sys::statvfs::{statvfs, FsFlags},
|
||||
};
|
||||
use std::{
|
||||
fs::{self, copy, create_dir_all, remove_dir_all, File, OpenOptions},
|
||||
io::{BufReader, BufWriter},
|
||||
|
@ -102,7 +105,7 @@ pub fn mount_has_nosuid(path_s: &str) -> Result<bool, Errno> {
|
|||
let path = Path::new(path_s);
|
||||
match statvfs(path) {
|
||||
Ok(fstats) => Ok(fstats.flags().contains(FsFlags::ST_NOSUID)),
|
||||
Err(e) => Err(e)
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,22 +21,25 @@ impl<'de> Visitor<'de> for LogLevelStringVisitor {
|
|||
}
|
||||
|
||||
fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error, {
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(LogLevel::from_string(v.to_string()))
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error, {
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
Ok(LogLevel::from_string(v))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for LogLevel {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de> {
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
deserializer.deserialize_string(LogLevelStringVisitor)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ use relm4::{
|
|||
use ui::app::{App, AppInit};
|
||||
|
||||
pub mod adb;
|
||||
pub mod build_tools;
|
||||
pub mod builders;
|
||||
pub mod checkerr;
|
||||
pub mod config;
|
||||
pub mod constants;
|
||||
pub mod depcheck;
|
||||
|
@ -30,11 +32,9 @@ pub mod profile;
|
|||
pub mod profiles;
|
||||
pub mod runner;
|
||||
pub mod runner_pipeline;
|
||||
pub mod steamvr_utils;
|
||||
pub mod ui;
|
||||
pub mod xr_devices;
|
||||
pub mod build_tools;
|
||||
pub mod checkerr;
|
||||
pub mod steamvr_utils;
|
||||
|
||||
fn restore_steam_xr_files() {
|
||||
let active_runtime = get_current_active_runtime();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::{env, path::Path, fs::create_dir_all};
|
||||
use crate::constants::CMD_NAME;
|
||||
use std::{env, fs::create_dir_all, path::Path};
|
||||
|
||||
pub fn data_opencomposite_path() -> String {
|
||||
format!("{data}/opencomposite", data = get_data_dir())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pub mod valve_index;
|
||||
pub mod system_valve_index;
|
||||
pub mod wivrn;
|
||||
pub mod lighthouse;
|
||||
pub mod system_valve_index;
|
||||
pub mod valve_index;
|
||||
pub mod wivrn;
|
||||
|
|
|
@ -35,7 +35,9 @@ impl RunnerPipeline {
|
|||
}
|
||||
self.has_started = true;
|
||||
match self.get_current_runner() {
|
||||
None => { return; },
|
||||
None => {
|
||||
return;
|
||||
}
|
||||
Some(runner) => {
|
||||
runner.borrow_mut().start();
|
||||
}
|
||||
|
@ -48,7 +50,7 @@ impl RunnerPipeline {
|
|||
}
|
||||
|
||||
match self.get_current_runner() {
|
||||
None => {},
|
||||
None => {}
|
||||
Some(c_runner) => {
|
||||
let (status, log) = {
|
||||
let mut runner = c_runner.borrow_mut();
|
||||
|
@ -56,7 +58,7 @@ impl RunnerPipeline {
|
|||
};
|
||||
self.log.extend(log);
|
||||
match status {
|
||||
RunnerStatus::Running => {},
|
||||
RunnerStatus::Running => {}
|
||||
RunnerStatus::Stopped(ecode) => {
|
||||
match ecode {
|
||||
None => {} // should never get here
|
||||
|
@ -64,7 +66,7 @@ impl RunnerPipeline {
|
|||
self.last_exit_status = Some(0);
|
||||
self.current_index += 1;
|
||||
match self.get_current_runner() {
|
||||
None => {},
|
||||
None => {}
|
||||
Some(c_runner) => {
|
||||
c_runner.borrow_mut().start();
|
||||
}
|
||||
|
@ -91,7 +93,7 @@ impl RunnerPipeline {
|
|||
pub fn status(&self) -> RunnerStatus {
|
||||
match self.get_current_runner() {
|
||||
None => RunnerStatus::Stopped(self.last_exit_status),
|
||||
Some(_) => RunnerStatus::Running
|
||||
Some(_) => RunnerStatus::Running,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::constants::{get_developers, APP_NAME, REPO_URL, SINGLE_DEVELOPER, VERSION, APP_ID};
|
||||
use crate::constants::{get_developers, APP_ID, APP_NAME, REPO_URL, SINGLE_DEVELOPER, VERSION};
|
||||
use relm4::gtk::traits::GtkWindowExt;
|
||||
use relm4::prelude::*;
|
||||
use relm4::{ComponentParts, SimpleComponent};
|
||||
|
|
|
@ -149,10 +149,8 @@ impl SimpleComponent for BuildWindow {
|
|||
let mut n_content = self.content.clone();
|
||||
n_content.push_str(n_lines.as_str());
|
||||
self.set_content(n_content);
|
||||
self.textbuf.insert(
|
||||
&mut self.textbuf.end_iter(),
|
||||
n_lines.as_str()
|
||||
);
|
||||
self.textbuf
|
||||
.insert(&mut self.textbuf.end_iter(), n_lines.as_str());
|
||||
let textbuf = self.textbuf.clone();
|
||||
let textview = self.textview.as_ref().unwrap().clone();
|
||||
if is_at_bottom {
|
||||
|
|
|
@ -409,10 +409,14 @@ impl SimpleComponent for MainView {
|
|||
.emit(InstallWivrnBoxMsg::ClockTicking);
|
||||
}
|
||||
Self::Input::StartStopClicked => {
|
||||
sender.output(Self::Output::DoStartStopXRService).expect("Sender output failed");
|
||||
sender
|
||||
.output(Self::Output::DoStartStopXRService)
|
||||
.expect("Sender output failed");
|
||||
}
|
||||
Self::Input::RestartXRService => {
|
||||
sender.output(Self::Output::RestartXRService).expect("Sender output failed");
|
||||
sender
|
||||
.output(Self::Output::RestartXRService)
|
||||
.expect("Sender output failed");
|
||||
}
|
||||
Self::Input::XRServiceActiveChanged(active, profile) => {
|
||||
self.set_xrservice_active(active);
|
||||
|
@ -473,9 +477,11 @@ impl SimpleComponent for MainView {
|
|||
self.set_selected_profile(self.profiles.get(index as usize).unwrap().clone());
|
||||
}
|
||||
Self::Input::ProfileSelected(position) => {
|
||||
sender.output(MainViewOutMsg::ProfileSelected(
|
||||
self.profiles.get(position as usize).unwrap().clone(),
|
||||
)).expect("Sender output failed");
|
||||
sender
|
||||
.output(MainViewOutMsg::ProfileSelected(
|
||||
self.profiles.get(position as usize).unwrap().clone(),
|
||||
))
|
||||
.expect("Sender output failed");
|
||||
}
|
||||
Self::Input::EditProfile => {
|
||||
if self.selected_profile.editable {
|
||||
|
@ -500,7 +506,9 @@ impl SimpleComponent for MainView {
|
|||
self.profile_delete_confirm_dialog.present();
|
||||
}
|
||||
Self::Input::SaveProfile(prof) => {
|
||||
sender.output(Self::Output::SaveProfile(prof)).expect("Sender output failed");
|
||||
sender
|
||||
.output(Self::Output::SaveProfile(prof))
|
||||
.expect("Sender output failed");
|
||||
}
|
||||
Self::Input::DuplicateProfile => {
|
||||
if self.selected_profile.can_be_built {
|
||||
|
@ -570,7 +578,9 @@ impl SimpleComponent for MainView {
|
|||
let pdc_sender = sender.clone();
|
||||
profile_delete_confirm_dialog.connect_response(None, move |_, res| {
|
||||
if res == "yes" {
|
||||
pdc_sender.output(Self::Output::DeleteProfile).expect("Sender output failed");
|
||||
pdc_sender
|
||||
.output(Self::Output::DeleteProfile)
|
||||
.expect("Sender output failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
pub mod app;
|
||||
pub mod main_view;
|
||||
pub mod about_dialog;
|
||||
pub mod debug_view;
|
||||
pub mod build_window;
|
||||
pub mod libsurvive_setup_window;
|
||||
pub mod install_wivrn_box;
|
||||
pub mod steam_launch_options_box;
|
||||
pub mod profile_editor;
|
||||
pub mod factories;
|
||||
pub mod wivrn_conf_editor;
|
||||
pub mod devices_box;
|
||||
pub mod preference_rows;
|
||||
pub mod macros;
|
||||
pub mod util;
|
||||
pub mod alert;
|
||||
pub mod app;
|
||||
pub mod build_window;
|
||||
pub mod debug_view;
|
||||
pub mod devices_box;
|
||||
pub mod factories;
|
||||
pub mod install_wivrn_box;
|
||||
pub mod libsurvive_setup_window;
|
||||
pub mod macros;
|
||||
pub mod main_view;
|
||||
pub mod preference_rows;
|
||||
pub mod profile_editor;
|
||||
pub mod steam_launch_options_box;
|
||||
pub mod util;
|
||||
pub mod wivrn_conf_editor;
|
||||
|
|
|
@ -132,7 +132,7 @@ pub fn path_row<F: Fn(Option<String>) + 'static + Clone>(
|
|||
row
|
||||
}
|
||||
|
||||
pub fn combo_row<F: Fn(&adw::ComboRow,) + 'static>(
|
||||
pub fn combo_row<F: Fn(&adw::ComboRow) + 'static>(
|
||||
title: &str,
|
||||
description: Option<&str>,
|
||||
value: &str,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use crate::file_builders::wivrn_config::{dump_wivrn_config, get_wivrn_config, WivrnConfig, Encoder};
|
||||
use crate::file_builders::wivrn_config::{
|
||||
dump_wivrn_config, get_wivrn_config, Encoder, WivrnConfig,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use relm4::prelude::*;
|
||||
|
||||
|
@ -125,13 +127,15 @@ impl SimpleComponent for WivrnConfEditor {
|
|||
let scalex = self.scalex_entry.as_ref().unwrap().text().parse::<f32>();
|
||||
let scaley = self.scaley_entry.as_ref().unwrap().text().parse::<f32>();
|
||||
if scalex.is_ok() && scaley.is_ok() {
|
||||
self.conf.scale = Some([scalex.as_ref().unwrap().clone(), scaley.as_ref().unwrap().clone()]);
|
||||
self.conf.scale = Some([
|
||||
scalex.as_ref().unwrap().clone(),
|
||||
scaley.as_ref().unwrap().clone(),
|
||||
]);
|
||||
}
|
||||
if scalex.is_ok() || scaley.is_ok() {
|
||||
let scale = scalex.unwrap_or(scaley.unwrap());
|
||||
self.conf.scale = Some([scale, scale]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
self.conf.scale = None
|
||||
}
|
||||
|
||||
|
@ -141,14 +145,12 @@ impl SimpleComponent for WivrnConfEditor {
|
|||
enc.bitrate = Some(bitrate.unwrap());
|
||||
}
|
||||
let encoders = Encoder::as_vec();
|
||||
let encoder = encoders.get(
|
||||
self.encoder_combo.as_ref().unwrap().selected() as usize
|
||||
);
|
||||
let encoder =
|
||||
encoders.get(self.encoder_combo.as_ref().unwrap().selected() as usize);
|
||||
if encoder.is_some() {
|
||||
enc.encoder = encoder.unwrap().clone();
|
||||
}
|
||||
self.conf.encoders.insert(0, enc);
|
||||
|
||||
|
||||
dump_wivrn_config(&self.conf);
|
||||
self.win.as_ref().unwrap().close();
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum XRDevice {
|
||||
Head, Left, Right, Gamepad, Eyes, HandTrackingLeft, HandTrackingRight
|
||||
Head,
|
||||
Left,
|
||||
Right,
|
||||
Gamepad,
|
||||
Eyes,
|
||||
HandTrackingLeft,
|
||||
HandTrackingRight,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
@ -43,7 +49,7 @@ impl XRDevices {
|
|||
break;
|
||||
}
|
||||
match row.trim().split(": ").collect::<Vec<&str>>()[..] {
|
||||
[_, "<none>"] => {},
|
||||
[_, "<none>"] => {}
|
||||
["head", val] => devs.head = Some(val.to_string()),
|
||||
["left", val] => devs.left = Some(val.to_string()),
|
||||
["right", val] => devs.right = Some(val.to_string()),
|
||||
|
|
Loading…
Add table
Reference in a new issue