Skip to content

Commit

Permalink
build(client_openxr): 🔨 Apply Meta store changes to manifest conditio…
Browse files Browse the repository at this point in the history
…nally (alvr-org#2281)
  • Loading branch information
zmerp authored and failboat committed Aug 17, 2024
1 parent df79ab7 commit 8571224
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
8 changes: 4 additions & 4 deletions alvr/client_openxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
16 changes: 15 additions & 1 deletion 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) {
pub fn build_android_client(profile: Profile, for_meta_store: bool) {
let sh = Shell::new().unwrap();

let mut flags = vec![];
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 8 additions & 3 deletions alvr/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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> Name of the platform (operative system or hardware name). snake_case
Expand Down Expand Up @@ -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<String> = args.opt_value_from_str("--platform").unwrap();
let version: Option<String> = args.opt_value_from_str("--version").unwrap();
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 8571224

Please sign in to comment.