Files
dioxus/packages/cli/src/rustc.rs
T
Jonathan Kelley 8334f7fbaa feat: device hot-reload, tools-relative adb, auto port bind (#3586)
* wip: bind to 0.0.0.0 instead of 127.0.0.1

* dont hang in background - ignore suspend commands when tty is disabled

* use system adb

* pass configs through to android mobile launch

* fix: line sizes + clear pushes frame

* dont resume window state on mobile

* fix screen sizing for ipad

* attempt and fail to implement codesigning

* Clippy and note about safety in android bindings
2025-01-20 17:42:13 -08:00

41 lines
1.1 KiB
Rust

use crate::Result;
use anyhow::Context;
use std::path::PathBuf;
use tokio::process::Command;
#[derive(Debug, Default)]
pub struct RustcDetails {
pub sysroot: PathBuf,
pub version: String,
}
impl RustcDetails {
/// Find the current sysroot location using the CLI
pub async fn from_cli() -> Result<RustcDetails> {
let sysroot = Command::new("rustc")
.args(["--print", "sysroot"])
.output()
.await
.map(|out| String::from_utf8(out.stdout))?
.context("Failed to extract rustc sysroot output")?;
let rustc_version = Command::new("rustc")
.args(["--version"])
.output()
.await
.map(|out| String::from_utf8(out.stdout))?
.context("Failed to extract rustc version output")?;
Ok(Self {
sysroot: sysroot.trim().into(),
version: rustc_version.trim().into(),
})
}
pub fn has_wasm32_unknown_unknown(&self) -> bool {
self.sysroot
.join("lib/rustlib/wasm32-unknown-unknown")
.exists()
}
}