Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/vite_command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ publish = false
rust-version.workspace = true

[dependencies]
fspy = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
tracing = { workspace = true }
Expand All @@ -19,6 +18,9 @@ which = { workspace = true, features = ["tracing"] }
[target.'cfg(not(target_os = "windows"))'.dependencies]
nix = { workspace = true, features = ["term"] }

[target.'cfg(not(target_os = "android"))'.dependencies]
fspy = { workspace = true }

[dev-dependencies]
tempfile = { workspace = true }
tokio = { workspace = true, features = ["macros", "test-util"] }
Expand Down
9 changes: 8 additions & 1 deletion crates/vite_command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ use std::{
process::{ExitStatus, Stdio},
};

#[cfg(not(target_os = "android"))]
use fspy::AccessMode;
use tokio::process::Command;
#[cfg(not(target_os = "android"))]
use tokio_util::sync::CancellationToken;
use vite_error::Error;
use vite_path::{AbsolutePath, AbsolutePathBuf, RelativePathBuf};
#[cfg(not(target_os = "android"))]
use vite_path::RelativePathBuf;
use vite_path::{AbsolutePath, AbsolutePathBuf};

/// Result of running a command with fspy tracking.

#[cfg(not(target_os = "android"))]
#[derive(Debug)]
pub struct FspyCommandResult {
/// The termination status of the command.
Expand Down Expand Up @@ -160,6 +166,7 @@ where
/// # Returns
///
/// Returns a FspyCommandResult containing the exit status and path accesses.
#[cfg(not(target_os = "android"))]
pub async fn run_command_with_fspy<I, S>(
bin_name: &str,
args: I,
Expand Down
14 changes: 13 additions & 1 deletion crates/vite_js_runtime/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub struct Platform {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Os {
Linux,
Android,
Darwin,
Windows,
}
Expand Down Expand Up @@ -51,6 +52,10 @@ impl Os {
{
Self::Linux
}
#[cfg(target_os = "android")]
{
Self::Android
}
#[cfg(target_os = "macos")]
{
Self::Darwin
Expand All @@ -59,7 +64,13 @@ impl Os {
{
Self::Windows
}
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
#[cfg(not(any(
target_os = "android",
target_os = "linux",
target_os = "macos",
target_os = "windows",
target_os = "android"
)))]
{
compile_error!(
"Unsupported operating system. vite_js_runtime only supports Linux, macOS, and Windows."
Expand All @@ -72,6 +83,7 @@ impl fmt::Display for Os {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Linux => write!(f, "linux"),
Self::Android => write!(f, "android"),
Self::Darwin => write!(f, "darwin"),
Self::Windows => write!(f, "windows"),
}
Expand Down
7 changes: 4 additions & 3 deletions crates/vite_js_runtime/src/providers/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl NodeProvider {
const fn archive_format(platform: Platform) -> ArchiveFormat {
match platform.os {
Os::Windows => ArchiveFormat::Zip,
Os::Linux | Os::Darwin => ArchiveFormat::TarGz,
Os::Linux | Os::Darwin | Os::Android => ArchiveFormat::TarGz,
}
}

Expand Down Expand Up @@ -576,6 +576,7 @@ impl JsRuntimeProvider for NodeProvider {
fn platform_string(&self, platform: Platform) -> Str {
let os = match platform.os {
Os::Linux => "linux",
Os::Android => "android",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid constructing nonexistent android-* Node artifacts

Setting Os::Android to "android" makes get_download_info build URLs like node-v<ver>-android-arm64.tar.gz, but Node's published dist artifacts are named with linux-*, darwin-*, and win-* prefixes (no android-* entries). On Android hosts that need runtime auto-installation (no system Node available), this change will consistently fetch a non-existent archive and fail runtime setup, so Android support appears enabled but cannot complete installs.

Useful? React with 👍 / 👎.

Os::Darwin => "darwin",
Os::Windows => "win",
};
Expand Down Expand Up @@ -615,14 +616,14 @@ impl JsRuntimeProvider for NodeProvider {
fn binary_relative_path(&self, platform: Platform) -> Str {
match platform.os {
Os::Windows => "node.exe".into(),
Os::Linux | Os::Darwin => "bin/node".into(),
Os::Linux | Os::Darwin | Os::Android => "bin/node".into(),
}
}

fn bin_dir_relative_path(&self, platform: Platform) -> Str {
match platform.os {
Os::Windows => "".into(),
Os::Linux | Os::Darwin => "bin".into(),
Os::Linux | Os::Darwin | Os::Android => "bin".into(),
}
}

Expand Down
Loading