feat: stardust build info

This commit is contained in:
Nova 2023-12-06 15:44:09 -05:00
parent 6d48527d63
commit 468fd9a269
3 changed files with 63 additions and 12 deletions

View file

@ -1,26 +1,56 @@
use std::collections::VecDeque;
use crate::{ui::job_worker::job::WorkerJob, build_tools::git::Git, paths::{get_cache_dir, get_data_dir}};
use crate::ui::job_worker::job::WorkerJob;
use std::{collections::VecDeque, path::PathBuf};
#[derive(Debug, Clone)]
pub struct StardustServerSpec {
repo: String,
branch: String,
debug: bool,
wayland_support: bool,
}
impl Default for StardustServerSpec {
fn default() -> Self {
Self {
repo: "https://github.com/StardustXR/server.git".into(),
branch: "main".into(),
debug: false,
wayland_support: true,
}
}
}
#[derive(Debug, Clone)]
pub struct StardustClientSpec {
repo: String,
branch: String,
debug: bool,
}
pub fn get_build_stardust_jobs(server_spec: StardustServerSpec, client_specs: [StardustClientSpec]) -> VecDeque<WorkerJob> {
pub fn get_build_stardust_jobs(
prefix_path: PathBuf,
server_spec: StardustServerSpec,
client_specs: &[StardustClientSpec],
) -> VecDeque<WorkerJob> {
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: server_spec.repo,
dir: format!("{}/stardust/server", get_data_dir()),
default_branch: "main".into(),
};
jobs.extend(git.get_pre_build_jobs(true));
// jobs.push(WorkerJob::new_cmd(env, cmd, args));
let mut args = vec![
"install".into(),
"--git".into(),
server_spec.repo,
"--branch".into(),
server_spec.branch,
"--root".into(),
prefix_path.to_string_lossy().to_string(),
"--no-default-features".into(),
];
if server_spec.wayland_support {
args.push("--features".into());
args.push("wayland".into());
}
if server_spec.debug {
args.push("--debug".into());
}
jobs.push_back(WorkerJob::new_cmd(None, "cargo".into(), Some(args)));
jobs
}

View file

@ -6,4 +6,5 @@ pub mod mercury_deps;
pub mod monado_deps;
pub mod openhmd_deps;
pub mod pkexec_dep;
pub mod stardust_deps;
pub mod wivrn_deps;

View file

@ -0,0 +1,20 @@
use crate::{
depcheck::{check_dependencies, Dependency, DependencyCheckResult},
dependencies::common::{dep_cmake, dep_gcc, dep_git, dep_gpp, dep_openxr},
};
fn stardust_server_deps() -> Vec<Dependency> {
vec![dep_openxr(), dep_cmake(), dep_git(), dep_gcc(), dep_gpp()]
}
pub fn check_stardust_deps() -> Vec<DependencyCheckResult> {
check_dependencies(stardust_server_deps())
}
pub fn get_missing_stardust_deps() -> Vec<Dependency> {
check_stardust_deps()
.iter()
.filter(|res| !res.found)
.map(|res| res.dependency.clone())
.collect()
}