nativeview-cli 0.1.0-rc.1

Developer CLI (`nv`) for Native View Engine: dev hot-reload, builds, pairing, SDK management, app scaffolding, and docs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
//! Deterministic `--dry-run` plan formatter for `nv build` and `nv run`.

use std::collections::BTreeMap;
use std::path::Path;

use nativeview_cli::manifest::{AndroidShell, AppPresenceConfig, NvManifest};

use super::android::bundle::{
    android_apk_output_path, android_app_cdylib_spec, android_cmake_configure_args,
    android_debug_keystore, android_image_cabi_rustc_args, android_image_cabi_spec_for_target,
    android_runtime_spec, android_shell_cache_dir, ANDROID_RUST_TARGET,
};
use super::android::compose::compose_project_dir;
use super::android::run::android_launch_component;
use super::android::tools::NinjaLocation;
use super::apple::ios_bundle::{
    ios_sim_app_cdylib_spec, ios_sim_cmake_configure_args, ios_sim_host_cache_dir,
    ios_sim_runtime_spec, IOS_SIM_CMAKE_TARGET, IOS_SIM_RUST_TARGET,
};
use super::apple::macos_bundle::{macos_bundle_id, should_direct_exec_macos};
use super::host_cache::{
    cmake_build_args, cmake_configure_args, host_cache_dir, modules_cache_key,
    prebuild_runtime_spec, prebuild_win_a11y_spec, HostShell,
};
use super::pipeline::{
    app_cdylib_spec, app_wasm_spec, BuildTarget, BuiltAppArtifact, ResolvedBuildPlan,
};

/// Appends manifest-configured desktop shell flags (`--presence`, `--width`, `--height`).
pub(crate) fn append_manifest_shell_args(args: &mut Vec<String>, manifest: &NvManifest) {
    if manifest.app.presence != AppPresenceConfig::Standard {
        args.push("--presence".to_owned());
        args.push(manifest.app.presence.as_str().to_owned());
    }
    if let Some(w) = manifest.app.width {
        args.push("--width".to_owned());
        args.push(w.to_string());
    }
    if let Some(h) = manifest.app.height {
        args.push("--height".to_owned());
        args.push(h.to_string());
    }
}

/// Computes CLI launch arguments passed to a Linux/Windows host shell binary.
pub(crate) fn desktop_shell_launch_args(
    shell: HostShell,
    dylib_path: &Path,
    manifest: &NvManifest,
    extra_args: &[String],
) -> Vec<String> {
    let mut args = vec!["--dylib".to_owned(), dylib_path.display().to_string()];
    append_manifest_shell_args(&mut args, manifest);
    if shell == HostShell::Skia {
        args.push("--no-ws".to_owned());
    }
    args.extend(extra_args.iter().cloned());
    args
}
use crate::cargo_env::{AppContext, NvSdkRoot};

/// Launch-specific options rendered in `[run]` sections of `nv run --dry-run`.
#[derive(Debug, Clone, Copy)]
pub(crate) struct PlanRunOptions<'a> {
    pub http_port: u16,
    pub direct: bool,
    pub device: Option<&'a str>,
    pub headless: bool,
    pub pair_only: bool,
    pub pair_uri: Option<&'a str>,
    pub shell_args: &'a [String],
}

/// Formats a deterministic `--dry-run` plan for `nv build` or `nv run`.
pub(crate) fn format_app_plan(
    app: &AppContext,
    sdk_root: Option<&NvSdkRoot>,
    manifest: &NvManifest,
    plan: &ResolvedBuildPlan,
    run_opts: Option<PlanRunOptions<'_>>,
) -> String {
    let profile = if plan.release { "release" } else { "debug" };
    let info = app.manifest_app_info();
    let sdk_display = sdk_root
        .map(|s| s.path().display().to_string())
        .unwrap_or_else(|| "<none (standalone web)>".to_owned());
    let mut out = format!(
        "Native View Engine — {} Plan\n  app:      {} ({}, lib={})\n  manifest: {}\n  sdk_root: {}\n  target:   {}{}\n  profile:  {profile}\n  modules:  {}\n  out_dir:  {}\n\n",
        if run_opts.is_some() { "Run" } else { "Build" },
        manifest.resolved_name(&info),
        app.package_name,
        app.lib_name,
        app.manifest_path.display(),
        sdk_display,
        plan.target.as_str(),
        plan.shell.map(|s| format!(" (shell={})", s.as_str())).unwrap_or_default(),
        modules_cache_key(&app.host_modules),
        plan.out_dir.display(),
    );

    match plan.target {
        BuildTarget::Macos | BuildTarget::Linux | BuildTarget::Windows => {
            if let Some(sdk) = sdk_root {
                format_desktop_plan(&mut out, app, sdk, manifest, plan, profile, run_opts);
            }
        }
        BuildTarget::Web => {
            let wasm_cmd = app_wasm_spec(app, plan.release).cargo_args().join(" ");
            let pwa_dir = plan.out_dir.join("pwa");
            out.push_str(&format!("[1/3] WASM cdylib\n  cmd  cargo {wasm_cmd}\n\n"));
            out.push_str(&format!(
                "[2/3] wasm-bindgen\n  cmd  wasm-bindgen --target web --no-typescript --out-dir {}/pkg <wasm>\n\n",
                pwa_dir.display()
            ));
            out.push_str(&format!("[3/3] Web bundle\n  pwa  {}\n", pwa_dir.display()));
            if manifest.web.extension.is_some() {
                out.push_str(&format!("  ext  {}\n", plan.out_dir.join("extension").display()));
            }
            if let Some(run) = run_opts {
                out.push_str(&format!(
                    "\n[run]\n  serve {} at http://localhost:{}/\n",
                    pwa_dir.display(),
                    run.http_port
                ));
            }
        }
        BuildTarget::IosSim => {
            if let Some(sdk) = sdk_root {
                format_ios_sim_plan(&mut out, app, sdk, manifest, plan, profile, run_opts);
            }
        }
        BuildTarget::Android => {
            if let Some(sdk) = sdk_root {
                format_android_plan(&mut out, app, sdk, manifest, plan, profile, run_opts);
            }
        }
        BuildTarget::WebPkg | BuildTarget::RnPkg | BuildTarget::NitroUiPkg => {
            out.push_str("[export] handled by export_pkg::format_export_plan.\n");
        }
    }
    out
}

fn format_ios_sim_plan(
    out: &mut String,
    app: &AppContext,
    sdk_root: &NvSdkRoot,
    manifest: &NvManifest,
    plan: &ResolvedBuildPlan,
    profile: &str,
    run_opts: Option<PlanRunOptions<'_>>,
) {
    let info = app.manifest_app_info();
    let min_ios = manifest.apple.min_ios.as_str();
    let pair_only = run_opts.is_some_and(|r| r.pair_only || r.pair_uri.is_some());
    if pair_only {
        out.push_str("[1/3] App cdylib\n  skip --pair-only (no embedded iOS app cdylib)\n\n");
    } else {
        let app_cmd =
            ios_sim_app_cdylib_spec(app, plan.release, None, min_ios).cargo_args().join(" ");
        out.push_str(&format!(
            "[1/3] App cdylib ({IOS_SIM_RUST_TARGET})\n  cmd  cargo {app_cmd}\n\n"
        ));
    }

    let build_dir =
        ios_sim_host_cache_dir(&app.target_directory, plan.release, min_ios, &app.host_modules);
    let rt_lib = if sdk_root.is_packaged_sdk() {
        sdk_root
            .path()
            .join("lib")
            .join(IOS_SIM_RUST_TARGET)
            .join("libnv_runtime.a")
    } else {
        app.target_directory
            .join(IOS_SIM_RUST_TARGET)
            .join(profile)
            .join("libnv_runtime.a")
    };
    let cfg = ios_sim_cmake_configure_args(
        &sdk_root.path().join("hosts").join("ios-shell"),
        &build_dir,
        plan.release,
        &app.host_modules,
        &rt_lib,
        min_ios,
        true,
    );
    let bld = cmake_build_args(&build_dir, IOS_SIM_CMAKE_TARGET, plan.release, false);
    if sdk_root.is_packaged_sdk() {
        out.push_str(&format!(
            "[2/3] iOS Simulator host shell (packaged SDK prebuilt runtime)\n  prebuilt libnv_runtime.a ({IOS_SIM_RUST_TARGET})\n  cache {}\n  cmd  cmake {}\n  cmd  cmake {}\n\n",
            build_dir.display(),
            cfg.join(" "),
            bld.join(" "),
        ));
    } else {
        let rt_spec =
            ios_sim_runtime_spec(sdk_root.path(), &app.target_directory, plan.release, None, min_ios);
        out.push_str(&format!(
            "[2/3] iOS Simulator host shell\n  cmd  cargo {}\n  cache {}\n  cmd  cmake {}\n  cmd  cmake {}\n\n",
            rt_spec.cargo_args().join(" "),
            build_dir.display(),
            cfg.join(" "),
            bld.join(" "),
        ));
    }

    let exe = manifest.resolved_executable(&info);
    let bundle_id = manifest.resolved_id(&info);
    let bundle = plan.out_dir.join(format!("{exe}.app"));
    let binary = bundle.join(&exe);
    out.push_str(&format!(
        "[3/3] iOS Simulator .app bundle\n  bundle    {}\n  bundle_id {bundle_id}\n  binary    {}\n",
        bundle.display(),
        binary.display(),
    ));
    if !pair_only {
        out.push_str(&format!("  dylib     {}/libnv_app.dylib\n", bundle.display()));
    }

    if let Some(run) = run_opts {
        let dev = run.device.unwrap_or("<auto-booted-or-newest-iPhone>");
        let extra = if run.shell_args.is_empty() {
            String::new()
        } else {
            format!(" {}", run.shell_args.join(" "))
        };
        let env_prefix = match run.pair_uri {
            Some(uri) => format!("SIMCTL_CHILD_NV_PAIR_CONNECT={uri} "),
            None => String::new(),
        };
        out.push_str(&format!(
            "\n[run]\n  device   {dev} (headless={})\n  cmd  xcrun simctl install {dev} {}\n  cmd  {env_prefix}xcrun simctl launch {dev} {bundle_id}{extra}\n",
            run.headless,
            bundle.display(),
        ));
    }
}

fn format_android_plan(
    out: &mut String,
    app: &AppContext,
    sdk_root: &NvSdkRoot,
    manifest: &NvManifest,
    plan: &ResolvedBuildPlan,
    profile: &str,
    run_opts: Option<PlanRunOptions<'_>>,
) {
    let info = app.manifest_app_info();
    let app_id = manifest
        .resolved_android_id(&info)
        .unwrap_or_else(|_| manifest.resolved_id(&info));
    let shell = match plan.shell {
        Some(HostShell::Compose) => AndroidShell::Compose,
        _ => AndroidShell::View,
    };
    let min_sdk = manifest.android.min_sdk;
    let target_sdk = manifest.android.target_sdk;
    let rt_cmd = android_runtime_spec(sdk_root.path(), &app.target_directory, plan.release, BTreeMap::new())
        .cargo_args()
        .join(" ");
    let img_cmd = android_image_cabi_spec_for_target(
        sdk_root.path(),
        &app.target_directory,
        ANDROID_RUST_TARGET,
        plan.release,
        BTreeMap::new(),
    )
    .cargo_args_with_rustc(&android_image_cabi_rustc_args())
    .join(" ");
    let app_cmd = android_app_cdylib_spec(app, plan.release, BTreeMap::new()).cargo_args().join(" ");
    let cache_dir = android_shell_cache_dir(&app.target_directory, min_sdk, plan.release);
    let rt_lib = app.target_directory.join(ANDROID_RUST_TARGET).join(profile).join("libnv_runtime.a");
    let img_lib = app.target_directory.join(ANDROID_RUST_TARGET).join(profile).join("libnativeview_image.so");
    let cfg = android_cmake_configure_args(
        &sdk_root.path().join("hosts/android-shell"),
        &cache_dir,
        Path::new("<ndk>/build/cmake/android.toolchain.cmake"),
        min_sdk,
        plan.release,
        &rt_lib,
        &img_lib,
        &NinjaLocation::OnPath,
    );
    let apk_path = android_apk_output_path(&plan.out_dir, &app.lib_name, plan.release);

    if sdk_root.is_packaged_sdk() {
        out.push_str(&format!(
            "[1/3] Native arm64-v8a libraries ({ANDROID_RUST_TARGET}, min_sdk={min_sdk}, packaged SDK prebuilt)\n\
             \x20 abi      prebuilt SDK headers (read-only)\n\
             \x20 prebuilt libnv_android_shell.so + libnativeview_image.so (runtime[\"android-all\"])\n\
             \x20 cmd      cargo {app_cmd}\n\n",
        ));
    } else {
        out.push_str(&format!(
            "[1/3] Native arm64-v8a libraries ({ANDROID_RUST_TARGET}, min_sdk={min_sdk})\n\
             \x20 abi   cargo xtask codegen abi (workspace checkout)\n\
             \x20 cmd   cargo {rt_cmd}\n\
             \x20 cmd   cargo {img_cmd}\n\
             \x20 cmd   cargo {app_cmd}\n\
             \x20 cache {}\n\
             \x20 cmd   cmake {}\n\
             \x20 cmd   cmake --build {} --target nv_android_shell --parallel\n\n",
            cache_dir.display(),
            cfg.join(" "),
            cache_dir.display(),
        ));
    }

    match shell {
        AndroidShell::View => {
            let ks = android_debug_keystore(&app.target_directory);
            out.push_str(&format!(
                "[2/3] Android View host Java + DEX (HotSpot JDK)\n\
                 \x20 cmd   javac --release 11 -Xlint:all -Werror -cp <android.jar> <host-java,backends/android,canvas,image,linking,media-fit,svg,android-app>\n\
                 \x20 cmd   d8 --min-api {min_sdk} --lib <android.jar> <classes>\n\n\
                 [3/3] Signed zero-Gradle APK\n\
                 \x20 cmd   aapt2 link --min-sdk-version {min_sdk} --target-sdk-version {target_sdk}\n\
                 \x20 libs  lib/arm64-v8a/{{libnv_android_shell.so,libnativeview_image.so,libnv_app.so,libc++_shared.so}} (uncompressed)\n\
                 \x20 ks    {}\n\
                 \x20 apk   {}\n\
                 \x20 id    {app_id}\n",
                ks.display(),
                apk_path.display(),
            ));
        }
        AndroidShell::Compose => {
            let proj = compose_project_dir(&app.target_directory, &app.lib_name);
            let gradlew = sdk_root.path().join("packages/backends/compose/gradlew");
            let task = if plan.release { "assembleRelease" } else { "assembleDebug" };
            let has_camera = app.host_modules.iter().any(|m| m == "camera");
            let deps = if has_camera {
                "io.github.nativeview:nativeview-standard-android, io.github.nativeview:camera"
            } else {
                "io.github.nativeview:nativeview-standard-android"
            };
            out.push_str(&format!(
                "[2/3] Synthesize cached Android Compose project\n\
                 \x20 dir   {}\n\
                 \x20 deps  {deps}\n\
                 \x20 libs  src/main/jniLibs/arm64-v8a/{{libnv_android_shell.so,libnv_app.so,libc++_shared.so}}\n\n\
                 [3/3] Assemble Compose APK (HotSpot JDK 17–23)\n\
                 \x20 cmd   {} -p {} {task} --no-daemon\n\
                 \x20 apk   {}\n\
                 \x20 id    {app_id}\n",
                proj.display(),
                gradlew.display(),
                proj.display(),
                apk_path.display(),
            ));
        }
    }

    if let Some(run) = run_opts {
        let serial = run.device.unwrap_or("<first-online-adb-device>");
        let component = android_launch_component(&app_id, shell);
        out.push_str(&format!(
            "\n[run]\n  cmd  adb -s {serial} install -r {}\n  cmd  adb -s {serial} shell am start -W -n {component}\n",
            apk_path.display(),
        ));
    }
}

fn format_desktop_plan(
    out: &mut String,
    app: &AppContext,
    sdk_root: &NvSdkRoot,
    manifest: &NvManifest,
    plan: &ResolvedBuildPlan,
    profile: &str,
    run_opts: Option<PlanRunOptions<'_>>,
) {
    let info = app.manifest_app_info();
    let shell = plan.shell.unwrap_or(HostShell::Skia);
    let dll_suffix = match plan.target {
        BuildTarget::Macos => ".dylib",
        BuildTarget::Linux => ".so",
        _ => ".dll",
    };
    let app_cmd = app_cdylib_spec(app, plan.release, dll_suffix).cargo_args().join(" ");
    out.push_str(&format!("[1/3] App cdylib\n  cmd  cargo {app_cmd}\n\n"));

    out.push_str("[2/3] Host shell\n");
    if shell == HostShell::Skia {
        if sdk_root.is_packaged_sdk() {
            out.push_str("  prebuilt nv-skia-shell (from packaged SDK)\n\n");
        } else {
            let rel = if plan.release { " --release" } else { "" };
            out.push_str(&format!(
                "  cmd  cargo build -p nativeview-skia-shell --bin nativeview-skia-shell{rel}\n\n"
            ));
        }
    } else if let Some(hdir) = shell.cmake_host_dir()
        && let Some(target_name) = shell.cmake_target_name()
    {
        let is_win = plan.target == BuildTarget::Windows;
        let build_dir =
            host_cache_dir(&app.target_directory, shell, plan.release, &app.host_modules);
        if sdk_root.is_packaged_sdk() {
            out.push_str("  prebuilt libnv_runtime (from packaged SDK)\n");
            if shell == HostShell::Windows {
                out.push_str("  prebuilt nv_accessibility_windows (optional, from packaged SDK)\n");
            }
        } else {
            let rt_spec =
                prebuild_runtime_spec(sdk_root.path(), &app.target_directory, plan.release, is_win);
            out.push_str(&format!("  cmd  cargo {}\n", rt_spec.cargo_args().join(" ")));
            if shell == HostShell::Windows {
                let a11y_spec =
                    prebuild_win_a11y_spec(sdk_root.path(), &app.target_directory, plan.release);
                out.push_str(&format!("  cmd  cargo {}\n", a11y_spec.cargo_args().join(" ")));
            }
        }
        let rt_lib = app.target_directory.join(profile).join(format!(
            "{}nv_runtime{}",
            if is_win { "" } else { "lib" },
            if is_win { ".lib" } else { ".a" }
        ));
        let win_a11y = (shell == HostShell::Windows).then(|| {
            (
                app.target_directory.join(profile).join("nativeview_accessibility_windows.dll"),
                app.target_directory.join(profile).join("nativeview_accessibility_windows.dll.lib"),
            )
        });
        let use_ninja = !is_win;
        let cfg = cmake_configure_args(
            &sdk_root.path().join("hosts").join(hdir),
            &build_dir,
            shell,
            plan.release,
            &app.host_modules,
            &rt_lib,
            win_a11y.as_ref().map(|(d, i)| (d.as_path(), i.as_path())),
            use_ninja,
            plan.target == BuildTarget::Macos,
        );
        let bld = cmake_build_args(&build_dir, target_name, plan.release, is_win && !use_ninja);
        out.push_str(&format!("  cache {}\n", build_dir.display()));
        out.push_str(&format!("  cmd  cmake {}\n", cfg.join(" ")));
        out.push_str(&format!("  cmd  cmake {}\n\n", bld.join(" ")));
    }

    if plan.target == BuildTarget::Macos {
        let exe = manifest.resolved_executable(&info);
        let bundle_id = macos_bundle_id(manifest, &info, shell);
        let bundle = plan.out_dir.join(format!("{exe}.app"));
        let binary = bundle.join("Contents").join("MacOS").join(&exe);
        out.push_str(&format!(
            "[3/3] macOS .app bundle\n  bundle    {}\n  bundle_id {bundle_id}\n  binary    {}\n  dylib     {}/Contents/Frameworks/libnv_app.dylib\n",
            bundle.display(),
            binary.display(),
            bundle.display(),
        ));
        if let Some(run) = run_opts {
            if should_direct_exec_macos(run.direct, run.shell_args) {
                let extra = if run.shell_args.is_empty() {
                    String::new()
                } else {
                    format!(" {}", run.shell_args.join(" "))
                };
                out.push_str(&format!("\n[run]\n  cmd  {}{extra}\n", binary.display()));
            } else {
                let extra = if run.shell_args.is_empty() {
                    String::new()
                } else {
                    format!(" --args {}", run.shell_args.join(" "))
                };
                out.push_str(&format!("\n[run]\n  cmd  open -W -n {}{extra}\n", bundle.display()));
            }
        }
    } else {
        let exe_name = shell.cmake_target_name().unwrap_or("nativeview-skia-shell");
        let exe_suffix = if plan.target == BuildTarget::Windows { ".exe" } else { "" };
        let staged_exe = plan.out_dir.join(format!("{exe_name}{exe_suffix}"));
        let staged_lib = plan.out_dir.join(format!(
            "{}{}{}",
            if plan.target == BuildTarget::Windows { "" } else { "lib" },
            app.lib_name,
            dll_suffix
        ));
        out.push_str(&format!(
            "[3/3] Stage desktop bundle\n  exe   {}\n  dylib {}\n",
            staged_exe.display(),
            staged_lib.display()
        ));
        if let Some(run) = run_opts {
            let args = desktop_shell_launch_args(shell, &staged_lib, manifest, run.shell_args);
            out.push_str(&format!(
                "\n[run]\n  cmd  {} {}\n",
                staged_exe.display(),
                args.join(" ")
            ));
        }
    }
}

/// Formats the post-build artifact summary for non-export app targets.
pub(crate) fn format_built_app_summary(built: &BuiltAppArtifact) -> String {
    let mut summary = String::from("==> Build complete:\n");
    match built {
        BuiltAppArtifact::MacosApp { app_bundle, executable, dylib, bundle_id } => {
            summary.push_str(&format!(
                "    bundle:    {}\n    bundle_id: {bundle_id}\n    binary:    {}\n    dylib:     {}\n",
                app_bundle.display(),
                executable.display(),
                dylib.display(),
            ));
        }
        BuiltAppArtifact::IosSimApp { app_bundle, executable, dylib, bundle_id } => {
            summary.push_str(&format!(
                "    bundle:    {}\n    bundle_id: {bundle_id}\n    binary:    {}\n",
                app_bundle.display(),
                executable.display(),
            ));
            if let Some(d) = dylib {
                summary.push_str(&format!("    dylib:     {}\n", d.display()));
            }
        }
        BuiltAppArtifact::DesktopStaged { shell_binary, app_dylib, .. } => {
            summary.push_str(&format!(
                "    shell: {}\n    dylib: {}\n",
                shell_binary.display(),
                app_dylib.display(),
            ));
        }
        BuiltAppArtifact::WebBundle { pwa_dir, extension_dir } => {
            summary.push_str(&format!("    pwa: {}\n", pwa_dir.display()));
            if let Some(ext) = extension_dir {
                summary.push_str(&format!("    ext: {}\n", ext.display()));
            }
        }
        BuiltAppArtifact::AndroidApk { apk_path, app_id, shell } => {
            summary.push_str(&format!(
                "    apk:    {}\n    app_id: {app_id}\n    shell:  {}\n",
                apk_path.display(),
                shell.as_str(),
            ));
        }
    }
    summary
}