Skip to content

Commit

Permalink
chore(xtask): Add build-meta-store (#2339)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp authored Aug 19, 2024
1 parent d15fe1c commit 67bd189
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 49 deletions.
16 changes: 1 addition & 15 deletions alvr/xtask/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ pub fn build_android_client_openxr_lib(profile: Profile, link_stdcpp: bool) {
build_android_lib_impl("client_openxr", profile, link_stdcpp, false)
}

pub fn build_android_client(profile: Profile, for_meta_store: bool) {
pub fn build_android_client(profile: Profile) {
let sh = Shell::new().unwrap();

let mut flags = vec![];
Expand Down Expand Up @@ -410,20 +410,6 @@ pub fn build_android_client(profile: Profile, for_meta_store: bool) {
}
}

if for_meta_store {
let manifest_path = afs::crate_dir("client_openxr").join("Cargo.toml");
let mut manifest_string = fs::read_to_string(&manifest_path).unwrap();

manifest_string = manifest_string.replace(
r#"package = "alvr.client.dev""#,
r#"package = "alvr.client""#,
);
manifest_string =
manifest_string.replace(r#"value = "all""#, r#"value = "quest2|questpro|quest3""#);

fs::write(manifest_path, manifest_string).unwrap();
}

let _push_guard = sh.push_dir(afs::crate_dir("client_openxr"));
cmd!(
sh,
Expand Down
54 changes: 28 additions & 26 deletions alvr/xtask/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ pub fn prepare_macos_deps() {
update_submodules(&sh);
}

fn get_android_openxr_loaders() {
fn get_android_openxr_loaders(only_khronos_loader: bool) {
fn get_openxr_loader(name: &str, url: &str, source_dir: &str) {
let sh = Shell::new().unwrap();
let temp_dir = afs::build_dir().join("temp_download");
Expand All @@ -320,32 +320,34 @@ fn get_android_openxr_loaders() {
"prefab/modules/openxr_loader/libs/android.arm64-v8a",
);

get_openxr_loader(
"_quest1",
"https://securecdn.oculus.com/binaries/download/?id=7577210995650755", // Version 64
"OpenXR/Libs/Android/arm64-v8a/Release",
);

get_openxr_loader(
"_pico",
"https://sdk.picovr.com/developer-platform/sdk/PICO_OpenXR_SDK_220.zip",
"libs/android.arm64-v8a",
);

get_openxr_loader(
"_yvr",
"https://developer.yvrdream.com/yvrdoc/sdk/openxr/yvr_openxr_mobile_sdk_2.0.0.zip",
"yvr_openxr_mobile_sdk_2.0.0/OpenXR/Libs/Android/arm64-v8a",
);

get_openxr_loader(
"_lynx",
"https://portal.lynx-r.com/downloads/download/16", // version 1.0.0
"jni/arm64-v8a",
);
if !only_khronos_loader {
get_openxr_loader(
"_quest1",
"https://securecdn.oculus.com/binaries/download/?id=7577210995650755", // Version 64
"OpenXR/Libs/Android/arm64-v8a/Release",
);

get_openxr_loader(
"_pico",
"https://sdk.picovr.com/developer-platform/sdk/PICO_OpenXR_SDK_220.zip",
"libs/android.arm64-v8a",
);

get_openxr_loader(
"_yvr",
"https://developer.yvrdream.com/yvrdoc/sdk/openxr/yvr_openxr_mobile_sdk_2.0.0.zip",
"yvr_openxr_mobile_sdk_2.0.0/OpenXR/Libs/Android/arm64-v8a",
);

get_openxr_loader(
"_lynx",
"https://portal.lynx-r.com/downloads/download/16", // version 1.0.0
"jni/arm64-v8a",
);
}
}

pub fn build_android_deps(skip_admin_priv: bool, all_targets: bool) {
pub fn build_android_deps(skip_admin_priv: bool, all_targets: bool, only_khronos_loader: bool) {
let sh = Shell::new().unwrap();

update_submodules(&sh);
Expand Down Expand Up @@ -376,5 +378,5 @@ pub fn build_android_deps(skip_admin_priv: bool, all_targets: bool) {
.run()
.unwrap();

get_android_openxr_loaders();
get_android_openxr_loaders(only_khronos_loader);
}
20 changes: 12 additions & 8 deletions alvr/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SUBCOMMANDS:
build-client Build client, then copy binaries to build folder
build-client-lib Build a C-ABI ALVR client library and header
build-client-xr-lib Build a C-ABI ALVR OpenXR entry point client library and header
build-meta-store Prepare dependencies and build client for Meta Store
run-streamer Build streamer and then open the dashboard
run-launcher Build launcher and then open it
format Autoformat all code
Expand Down Expand Up @@ -54,7 +55,6 @@ FLAGS:
--ci Do some CI related tweaks. Depends on the other flags and subcommand
--no-stdcpp Disable linking to libc++_shared with build-client-lib
--all-targets For prepare-deps and build-client-lib subcommand, will build for all android supported ABI targets
--meta-store Tweak manifest for Applab compatibility. For package-client subcommand
ARGS:
--platform <NAME> Name of the platform (operative system or hardware name). snake_case
Expand Down Expand Up @@ -171,7 +171,6 @@ fn main() {
let zsync = args.contains("--zsync");
let link_stdcpp = !args.contains("--no-stdcpp");
let all_targets = args.contains("--all-targets");
let for_meta_store = args.contains("--meta-store");

let platform: Option<String> = args.opt_value_from_str("--platform").unwrap();
let version: Option<String> = args.opt_value_from_str("--version").unwrap();
Expand All @@ -185,7 +184,9 @@ fn main() {
"windows" => dependencies::prepare_windows_deps(for_ci),
"linux" => dependencies::prepare_linux_deps(!no_nvidia),
"macos" => dependencies::prepare_macos_deps(),
"android" => dependencies::build_android_deps(for_ci, all_targets),
"android" => {
dependencies::build_android_deps(for_ci, all_targets, false)
}
_ => panic!("Unrecognized platform."),
}
} else {
Expand All @@ -195,15 +196,15 @@ fn main() {
dependencies::prepare_linux_deps(!no_nvidia);
}

dependencies::build_android_deps(for_ci, all_targets);
dependencies::build_android_deps(for_ci, all_targets, false);
}
}
"build-streamer" => {
build::build_streamer(profile, true, gpl, None, false, profiling, keep_config)
}
"build-launcher" => build::build_launcher(profile, true, false),
"build-server-lib" => build::build_server_lib(profile, true, None, false),
"build-client" => build::build_android_client(profile, false),
"build-client" => build::build_android_client(profile),
"build-client-lib" => {
build::build_android_client_core_lib(profile, link_stdcpp, all_targets)
}
Expand Down Expand Up @@ -232,9 +233,7 @@ fn main() {
}
"package-streamer" => packaging::package_streamer(gpl, root, appimage, zsync),
"package-launcher" => packaging::package_launcher(appimage),
"package-client" => {
build::build_android_client(Profile::Distribution, for_meta_store)
}
"package-client" => build::build_android_client(Profile::Distribution),
"package-client-lib" => packaging::package_client_lib(link_stdcpp, all_targets),
"format" => format::format(),
"check-format" => format::check_format(),
Expand All @@ -243,6 +242,11 @@ fn main() {
"clippy" => clippy(),
"check-msrv" => version::check_msrv(),
"kill-oculus" => kill_oculus_processes(),
"build-meta-store" => {
clean();
dependencies::build_android_deps(false, false, true);
packaging::package_client_openxr(true);
}
_ => {
println!("\nUnrecognized subcommand.");
println!("{HELP_STR}");
Expand Down
22 changes: 22 additions & 0 deletions alvr/xtask/src/packaging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
use alvr_filesystem as afs;
use std::{
env::consts::OS,
fs,
path::{Path, PathBuf},
};
use xshell::{cmd, Shell};
Expand Down Expand Up @@ -193,6 +194,27 @@ pub fn package_launcher(appimage: bool) {
}
}

pub fn replace_client_openxr_manifest(from_pattern: &str, to: &str) {
let manifest_path = afs::crate_dir("client_openxr").join("Cargo.toml");
let manifest_string = fs::read_to_string(&manifest_path)
.unwrap()
.replace(from_pattern, to);

fs::write(manifest_path, manifest_string).unwrap();
}

pub fn package_client_openxr(for_meta_store: bool) {
if for_meta_store {
replace_client_openxr_manifest(
r#"package = "alvr.client.stable""#,
r#"package = "alvr.client""#,
);
replace_client_openxr_manifest(r#"value = "all""#, r#"value = "quest2|questpro|quest3""#);
}

build::build_android_client(Profile::Distribution);
}

pub fn package_client_lib(link_stdcpp: bool, all_targets: bool) {
let sh = Shell::new().unwrap();

Expand Down

0 comments on commit 67bd189

Please sign in to comment.