From 8571224312b636d2fc94b347c0d72edecff77964 Mon Sep 17 00:00:00 2001 From: zarik5 Date: Fri, 26 Jul 2024 04:00:16 +0200 Subject: [PATCH] build(client_openxr): :hammer: Apply Meta store changes to manifest conditionally (#2281) --- alvr/client_openxr/Cargo.toml | 8 ++++---- alvr/xtask/src/build.rs | 16 +++++++++++++++- alvr/xtask/src/main.rs | 11 ++++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/alvr/client_openxr/Cargo.toml b/alvr/client_openxr/Cargo.toml index 41626e3b54..25565d9aa9 100644 --- a/alvr/client_openxr/Cargo.toml +++ b/alvr/client_openxr/Cargo.toml @@ -25,7 +25,7 @@ libc = "0.2" ndk-context = "0.1" [package.metadata.android] -package = "alvr.client.dev" +package = "alvr.client.dev" # Changed for Meta Store install_location = "auto" build_targets = ["aarch64-linux-android"] runtime_libs = "../../deps/android_openxr" @@ -123,9 +123,9 @@ name = "com.oculus.intent.category.VR" value = "vr_only" [[package.metadata.android.application.meta_data]] name = "com.oculus.supportedDevices" -value = "all" -# Use this for applab releases -# value = "quest2|questpro|quest3" +# Note: value is changed for the Meta store, which requires an explicit list of platforms. +# "all" is required to support Quest 1 which doesn't have newer platform names registered. +value = "all" [[package.metadata.android.application.meta_data]] name = "com.oculus.vr.focusaware" value = "true" diff --git a/alvr/xtask/src/build.rs b/alvr/xtask/src/build.rs index 044b90f557..171f9f13ff 100644 --- a/alvr/xtask/src/build.rs +++ b/alvr/xtask/src/build.rs @@ -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) { +pub fn build_android_client(profile: Profile, for_meta_store: bool) { let sh = Shell::new().unwrap(); let mut flags = vec![]; @@ -410,6 +410,20 @@ pub fn build_android_client(profile: Profile) { } } + 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, diff --git a/alvr/xtask/src/main.rs b/alvr/xtask/src/main.rs index fb4029c0a9..2446b3ee84 100644 --- a/alvr/xtask/src/main.rs +++ b/alvr/xtask/src/main.rs @@ -32,7 +32,8 @@ SUBCOMMANDS: format Autoformat all code check-format Check if code is correctly formatted package-streamer Build streamer with distribution profile, make archive - package-launcher Build launcher in release mode, make portable and installer versions + package-launcher Build launcher with distribution profile, make archive + package-client Build client with distribution profile package-client-lib Build client library then zip it clean Removes all build artifacts and dependencies bump Bump streamer and client package versions @@ -53,6 +54,7 @@ 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 of the platform (operative system or hardware name). snake_case @@ -169,6 +171,7 @@ 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 = args.opt_value_from_str("--platform").unwrap(); let version: Option = args.opt_value_from_str("--version").unwrap(); @@ -200,7 +203,7 @@ fn main() { } "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), + "build-client" => build::build_android_client(profile, false), "build-client-lib" => { build::build_android_client_core_lib(profile, link_stdcpp, all_targets) } @@ -229,7 +232,9 @@ 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), + "package-client" => { + build::build_android_client(Profile::Distribution, for_meta_store) + } "package-client-lib" => packaging::package_client_lib(link_stdcpp, all_targets), "format" => format::format(), "check-format" => format::check_format(),