(args: &[String], cwd: &Path)
| 872 | let result = if universal_macos { |
| 873 | compile_universal_macos_project_bundle(&project_dir, options) |
| 874 | } else { |
| 875 | compile_project_bundle(&project_dir, options) |
| 876 | }; |
| 877 | result |
| 878 | .map(|_| { |
| 879 | log_done("Project Bundle Built"); |
| 880 | }) |
| 881 | .map_err(|err| { |
| 882 | format!( |
| 883 | "project pipeline failed for {}: {err}", |
| 884 | project_dir.display() |
| 885 | ) |
| 886 | }) |
| 887 | } |
| 888 | |
| 889 | fn validate_cli_native_target(target: &str) -> Result<(), String> { |
| 890 | let valid = !target.is_empty() |
| 891 | && !target.starts_with('-') |
| 892 | && target.contains('-') |
| 893 | && target |
| 894 | .bytes() |
| 895 | .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_')); |
| 896 | if valid { |
| 897 | Ok(()) |
| 898 | } else { |
| 899 | Err(format!("invalid native Rust target triple `{target}`")) |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | fn parse_cli_target(args: &[String]) -> Result<CliTarget, String> { |
| 904 | let Some(raw) = parse_flag_value(args, "--target") else { |
| 905 | return Ok(CliTarget::Native); |
| 906 | }; |
| 907 | match raw.trim().to_ascii_lowercase().as_str() { |
| 908 | "native" => Ok(CliTarget::Native), |
| 909 | "web" => Ok(CliTarget::Web), |
| 910 | "android" => Ok(CliTarget::Android), |
| 911 | other => Err(format!( |
| 912 | "invalid `--target {other}`. use `native`, `web`, or `android`." |
| 913 | )), |
| 914 | } |
| 915 | } |
| 916 | |
| 917 | fn build_web_command(args: &[String], cwd: &Path) -> Result<(), String> { |
| 918 | let profile = args.iter().any(|a| a == "--profile"); |
| 919 | if args.iter().any(|a| a == "--console") { |
| 920 | return Err("`--console` is not supported with `--target web`".to_string()); |
| 921 | } |
| 922 | let project_dir = parse_flag_value(args, "--path") |
| 923 | .map(|p| resolve_local_path(&p, cwd)) |
| 924 | .unwrap_or_else(|| cwd.to_path_buf()); |
| 925 | let project_dir = project_dir.canonicalize().unwrap_or(project_dir); |
| 926 | update_workspace_vscode_linked_projects(&workspace_root(), &project_dir)?; |
| 927 | update_project_vscode_linked_projects(&project_dir)?; |
| 928 | log_step("Building Web Project Bundle"); |
| 929 | compile_project_bundle( |
| 930 | &project_dir, |
| 931 | ProjectBuildOptions::new(profile, false) |
no test coverage detected