#![cfg(feature = "android")] use crossbundle_lib::commands::build::{android::AndroidBuildCommand, BuildContext}; use crossbundle_tools::{ commands::gen_minimal_project, types::{android_manifest::from_str, AndroidStrategy, AndroidTarget, Config, Shell}, }; #[test] /// Create macroquad minimal project with full cargo toml metadata in a /// temporary directory to test manifest generating. fn test_cargo_metadata() { let tempdir = tempfile::tempdir().unwrap(); let project_path = tempdir.path(); let macroquad_project = true; gen_minimal_project(project_path, macroquad_project).unwrap(); let target_dir = std::path::PathBuf::from(project_path).join("target"); std::fs::create_dir_all(&target_dir).unwrap(); let shell = Shell::new(); let config = Config::new(shell, target_dir.clone()); let context = BuildContext::new(&config, Some(target_dir)).unwrap(); let android_build_command = AndroidBuildCommand { target: vec![AndroidTarget::Aarch64], strategy: AndroidStrategy::NativeApk, ..Default::default() }; let example = android_build_command.shared.example.as_ref(); let (_, _, package_name) = AndroidBuildCommand::needed_project_dirs(example, &context).unwrap(); config .status_message("Starting apk build process", &package_name) .unwrap(); let android_manifest = AndroidBuildCommand::get_android_manifest(&context, AndroidStrategy::NativeApk).unwrap(); let expected_manifest = r#" "#; let expected_manifest = from_str(expected_manifest).unwrap(); assert_eq!(expected_manifest, android_manifest); }