arcature-cli 2026.2.0

Developer lifecycle CLI for Arcature applications.
Documentation
//! The host target triple (AP2.1-10).
//!
//! The host target triple (e.g. `x86_64-unknown-linux-gnu`,
//! `x86_64-pc-windows-msvc`) is the bundle target label suffix and the SBOM
//! `target` field. This is the *host* target (the machine `arc package` runs
//! on); cross-compilation targets are out of scope for the wave-1 slice and
//! would set `--target-label` explicitly.

use crate::process::ProcessSpec;
use crate::tool::Tool;

/// The host target triple (e.g. `x86_64-unknown-linux-gnu`,
/// `x86_64-pc-windows-msvc`). Used as the bundle target label suffix and
/// the SBOM `target` field. This is the *host* target (the machine `arc
/// package` runs on); cross-compilation targets are out of scope for the
/// wave-1 slice and would set `--target-label` explicitly.
pub(super) fn host_target_triple() -> String {
    // `rustc -vV` prints `host: <triple>` on a stable line. Parse it
    // rather than hardcoding per-platform strings (the build host is the
    // packaging host; cross-compilation is an explicit override).
    let spec = ProcessSpec::new(Tool::Rustc.executable(), ".");
    let output = match crate::process::run_capture(&spec.arg("-vV")) {
        Ok(bytes) => bytes,
        Err(_) => {
            // Fallback: the std `consts` give the OS + ARCH but not the
            // full triple (no ABI suffix like `gnu` vs `msvc`). Use a
            // best-effort label and let the operator override with
            // `--target-label`. This is honest: we could not determine the
            // full triple, so we label it with what we know.
            return format!("{}-unknown", std::env::consts::ARCH);
        }
    };
    let text = String::from_utf8_lossy(&output);
    for line in text.lines() {
        if let Some(rest) = line.strip_prefix("host: ") {
            return rest.trim().to_owned();
        }
    }
    format!("{}-unknown", std::env::consts::ARCH)
}