fix: just buyild stardust without installing to a prefix

This commit is contained in:
Gabriele Musco 2023-12-08 09:04:27 +00:00
parent 030fe86274
commit 8b1583a973

View file

@ -3,10 +3,10 @@ use std::{collections::VecDeque, path::PathBuf};
#[derive(Debug, Clone)]
pub struct StardustServerSpec {
repo: String,
branch: String,
debug: bool,
wayland_support: bool,
pub repo: String,
pub branch: String,
pub debug: bool,
pub wayland_support: bool,
}
impl Default for StardustServerSpec {
fn default() -> Self {
@ -21,42 +21,43 @@ impl Default for StardustServerSpec {
#[derive(Debug, Clone)]
pub struct StardustClientSpec {
repo: String,
branch: String,
debug: bool,
pub repo: String,
pub branch: String,
pub debug: bool,
}
pub fn get_build_stardust_jobs(
prefix_path: PathBuf,
server_spec: StardustServerSpec,
client_specs: &[StardustClientSpec],
) -> VecDeque<WorkerJob> {
let mut jobs = VecDeque::<WorkerJob>::new();
let server_git_dir = get_data_dir() + "/stardust-xr-server";
let server_git_job = Git {
let server_git = Git {
repo: server_spec.repo,
dir: server_git_dir.clone(),
dir: get_data_dir() + "/stardust/stardust-xr-server",
default_branch: server_spec.branch,
};
jobs.extend(server_git_job.get_pre_build_jobs(true));
let mut args = vec![
"install".into(),
"--path".into(),
server_git_dir,
"--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.extend(server_git.get_pre_build_jobs(true));
jobs.push_back(WorkerJob::new_cmd(
None,
"cargo".into(),
Some({
let mut args = vec![
"build".into(),
"--path".into(),
server_git.dir,
"--no-default-features".into(),
];
if server_spec.wayland_support {
args.push("--features".into());
args.push("wayland".into());
}
if !server_spec.debug {
args.push("--release".into());
}
args
}),
));
jobs
}