Skip to content
Merged
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
16 changes: 15 additions & 1 deletion crates/fbuild-build/src/apollo3/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,21 @@ impl BuildOrchestrator for Apollo3Orchestrator {
.await;

// 4. Ensure Apollo3 cores (SparkFun Arduino Apollo3 core)
let framework = fbuild_packages::library::Apollo3Cores::new(&params.project_dir);
// Honor `platform_packages` override from the env section
// (FastLED/fbuild#664, #681): if set, the override URL replaces the
// const-pinned default and gets its own cache subdir via
// `PackageBase::with_override`.
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinoambiqapollo3")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::Apollo3Cores::with_override(&params.project_dir, o),
None => fbuild_packages::library::Apollo3Cores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("Apollo3 cores at {}", framework_dir.display());

Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/ch32v/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,18 @@ impl BuildOrchestrator for Ch32vOrchestrator {
.await;

// 4. Ensure OpenWCH CH32V cores
let framework = fbuild_packages::library::Ch32vCores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduino-ch32v")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::Ch32vCores::with_override(&params.project_dir, o),
None => fbuild_packages::library::Ch32vCores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("CH32V cores at {}", framework_dir.display());

Expand Down
15 changes: 14 additions & 1 deletion crates/fbuild-build/src/esp8266/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,20 @@ impl BuildOrchestrator for Esp8266Orchestrator {
.await;

// 4. Ensure framework
let framework = fbuild_packages::library::Esp8266Framework::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinoespressif8266")
});
let framework = match __ovr {
Some(o) => {
fbuild_packages::library::Esp8266Framework::with_override(&params.project_dir, o)
}
None => fbuild_packages::library::Esp8266Framework::new(&params.project_dir),
};
let _framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("ESP8266 framework ready");
let board_id = ctx
Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/nrf52/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,18 @@ impl BuildOrchestrator for Nrf52Orchestrator {
.await;

// 4. Ensure NRF52 cores (Adafruit nRF52 Arduino core)
let framework = fbuild_packages::library::Nrf52Cores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinoadafruitnrf52")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::Nrf52Cores::with_override(&params.project_dir, o),
None => fbuild_packages::library::Nrf52Cores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("NRF52 cores at {}", framework_dir.display());

Expand Down
15 changes: 14 additions & 1 deletion crates/fbuild-build/src/renesas/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,20 @@ impl BuildOrchestrator for RenesasOrchestrator {
.await;

// 4. Ensure Renesas cores (ArduinoCore-renesas)
let framework = fbuild_packages::library::RenesasCores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinorenesas")
});
let framework = match __ovr {
Some(o) => {
fbuild_packages::library::RenesasCores::with_override(&params.project_dir, o)
}
None => fbuild_packages::library::RenesasCores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("Renesas cores at {}", framework_dir.display());

Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/rp2040/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,18 @@ impl BuildOrchestrator for Rp2040Orchestrator {
.await;

// 4. Ensure RP2040 cores (arduino-pico by earlephilhower)
let framework = fbuild_packages::library::Rp2040Cores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinopico")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::Rp2040Cores::with_override(&params.project_dir, o),
None => fbuild_packages::library::Rp2040Cores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("RP2040 cores at {}", framework_dir.display());
let board_id = ctx
Expand Down
18 changes: 16 additions & 2 deletions crates/fbuild-build/src/sam/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,21 @@ impl BuildOrchestrator for SamOrchestrator {
.await;

// 4. Ensure correct Arduino core based on MCU family
// Honor `platform_packages` override (FastLED/fbuild#664, #681). Only
// SAM (Due) is wired through this PR — SAMD's framework_name needs
// separate verification (see issue thread).
let __sam_ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduino-sam")
});
let (framework_dir, core_dir, variant_dir, linker_script_path, system_includes) =
if is_samd_mcu(&ctx.board.mcu) {
install_samd_core(params, &ctx.board.core, &ctx.board.variant).await?
} else {
install_sam_core(params, &ctx.board.core, &ctx.board.variant).await?
install_sam_core(params, &ctx.board.core, &ctx.board.variant, __sam_ovr).await?
};

let build_dir = &ctx.build_dir;
Expand Down Expand Up @@ -308,8 +318,12 @@ async fn install_sam_core(
params: &BuildParams,
core_name: &str,
variant_name: &str,
ovr: Option<fbuild_config::PackageOverride>,
) -> Result<(PathBuf, PathBuf, PathBuf, PathBuf, Vec<PathBuf>)> {
let framework = fbuild_packages::library::SamCores::new(&params.project_dir);
let framework = match ovr {
Some(o) => fbuild_packages::library::SamCores::with_override(&params.project_dir, o),
None => fbuild_packages::library::SamCores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("SAM cores at {}", framework_dir.display());

Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/silabs/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ impl BuildOrchestrator for SilabsOrchestrator {
)
.await;

let framework = fbuild_packages::library::SilabsCores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinosilabs")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::SilabsCores::with_override(&params.project_dir, o),
None => fbuild_packages::library::SilabsCores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("Silicon Labs cores at {}", framework_dir.display());

Expand Down
12 changes: 11 additions & 1 deletion crates/fbuild-build/src/stm32/orchestrator/arduino_mbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ pub(super) async fn build_arduino_mbed_stm32(
let eh_frame_policy =
crate::eh_frame_policy_compute::compute_eh_frame_policy(&ctx, params.profile, None);

let framework = fbuild_packages::library::ArduinoMbedCore::new(&params.project_dir);
// Honor `platform_packages` override from the env section
// (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| crate::package_override::resolve_override(env, "framework-arduino-mbed"));
let framework = match __ovr {
Some(o) => fbuild_packages::library::ArduinoMbedCore::with_override(&params.project_dir, o),
None => fbuild_packages::library::ArduinoMbedCore::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("Arduino mbed core at {}", framework_dir.display());

Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/stm32/orchestrator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ impl BuildOrchestrator for Stm32Orchestrator {
}

// 4. Ensure STM32duino cores
let framework = fbuild_packages::library::Stm32Cores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinoststm32")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::Stm32Cores::with_override(&params.project_dir, o),
None => fbuild_packages::library::Stm32Cores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("STM32 cores at {}", framework_dir.display());

Expand Down
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/teensy/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,18 @@ impl BuildOrchestrator for TeensyOrchestrator {
.await;

// 4. Ensure Teensy cores
let framework = fbuild_packages::library::TeensyCores::new(&params.project_dir);
// Honor `platform_packages` override (FastLED/fbuild#664, #681).
let __ovr = ctx
.config
.get_env_config(&params.env_name)
.ok()
.and_then(|env| {
crate::package_override::resolve_override(env, "framework-arduinoteensy")
});
let framework = match __ovr {
Some(o) => fbuild_packages::library::TeensyCores::with_override(&params.project_dir, o),
None => fbuild_packages::library::TeensyCores::new(&params.project_dir),
};
let framework_dir = fbuild_packages::Package::ensure_installed(&framework).await?;
tracing::info!("Teensy cores at {}", framework_dir.display());

Expand Down
8 changes: 7 additions & 1 deletion crates/fbuild-cli/tests/ci_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! produces usage errors. The inline parse tests in `main.rs::ci_tests`
//! cover positive-parse + mutual-exclusion contracts at unit-test speed.

use std::process::{Command, Output};
use std::process::{Command, Output, Stdio};
use std::time::{Duration, Instant};

/// Run a `Command` with a hard wall-clock budget (FastLED/fbuild#806).
Expand All @@ -14,8 +14,14 @@ use std::time::{Duration, Instant};
/// (e.g. a regression in clap parsing → infinite loop). 10 s is overkill
/// for `--help` / argument-validation paths, but keeps the test runner
/// from sitting on its 6 h job budget if the CLI ever does wedge.
///
/// stdout/stderr must be piped explicitly: `spawn()` inherits the parent
/// streams by default, so without this `wait_with_output()` reports an
/// empty stdout and the `--help`-content assertions panic spuriously.
/// `Command::output()` pipes for you; `spawn()` does not.
fn run_cli_or_timeout(mut cmd: Command) -> Output {
let budget = Duration::from_secs(10);
cmd.stdout(Stdio::piped()).stderr(Stdio::piped());
let mut child = cmd.spawn().expect("spawn fbuild");
let deadline = Instant::now() + budget;
loop {
Expand Down
8 changes: 7 additions & 1 deletion crates/fbuild-cli/tests/lib_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! that need a real framework install (Teensy, STM32, ...) are gated
//! behind `#[ignore]` and run manually.

use std::process::{Command, Output};
use std::process::{Command, Output, Stdio};
use std::time::{Duration, Instant};

/// Run a `Command` with a hard wall-clock budget (FastLED/fbuild#806).
Expand All @@ -15,8 +15,14 @@ use std::time::{Duration, Instant};
/// (e.g. a regression in clap parsing → infinite loop). 10 s is overkill
/// for `--help` / argument-validation paths, but keeps the test runner
/// from sitting on its 6 h job budget if the CLI ever does wedge.
///
/// stdout/stderr must be piped explicitly: `spawn()` inherits the parent
/// streams by default, so without this `wait_with_output()` reports an
/// empty stdout and the `--help`-content assertions panic spuriously.
/// `Command::output()` pipes for you; `spawn()` does not.
fn run_cli_or_timeout(mut cmd: Command) -> Output {
let budget = Duration::from_secs(10);
cmd.stdout(Stdio::piped()).stderr(Stdio::piped());
let mut child = cmd.spawn().expect("spawn fbuild");
let deadline = Instant::now() + budget;
loop {
Expand Down
20 changes: 20 additions & 0 deletions crates/fbuild-packages/src/library/apollo3_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ impl Apollo3Cores {
}
}

/// Construct with a consumer-supplied override (parsed from the env's
/// `platform_packages` line in `platformio.ini`). The default const-pinned
/// URL / version / checksum are replaced; `cache_subdir` and `name` are
/// preserved. See `PackageBase::with_override` and FastLED/fbuild#681.
pub fn with_override(project_dir: &Path, ovr: fbuild_config::PackageOverride) -> Self {
Self {
base: PackageBase::new(
"apollo3-core",
APOLLO3_CORE_VERSION,
APOLLO3_CORE_URL,
APOLLO3_CORE_URL,
None,
CacheSubdir::Platforms,
project_dir,
)
.with_override(ovr),
install_dir: None,
}
}

#[cfg(test)]
fn with_cache_root(project_dir: &Path, cache_root: &Path) -> Self {
Self {
Expand Down
20 changes: 20 additions & 0 deletions crates/fbuild-packages/src/library/arduino_mbed_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ impl ArduinoMbedCore {
}
}

/// Construct with a consumer-supplied override (parsed from the env's
/// `platform_packages` line in `platformio.ini`). The default const-pinned
/// URL / version / checksum are replaced; `cache_subdir` and `name` are
/// preserved. See `PackageBase::with_override` and FastLED/fbuild#681.
pub fn with_override(project_dir: &Path, ovr: fbuild_config::PackageOverride) -> Self {
Self {
base: PackageBase::new(
"arduino-mbed-core",
ARDUINO_MBED_CORE_VERSION,
ARDUINO_MBED_CORE_URL,
ARDUINO_MBED_CORE_URL,
None,
CacheSubdir::Platforms,
project_dir,
)
.with_override(ovr),
install_dir: None,
}
}

#[cfg(test)]
fn with_cache_root(project_dir: &Path, cache_root: &Path) -> Self {
Self {
Expand Down
20 changes: 20 additions & 0 deletions crates/fbuild-packages/src/library/ch32v_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ impl Ch32vCores {
}
}

/// Construct with a consumer-supplied override (parsed from the env's
/// `platform_packages` line in `platformio.ini`). The default const-pinned
/// URL / version / checksum are replaced; `cache_subdir` and `name` are
/// preserved. See `PackageBase::with_override` and FastLED/fbuild#681.
pub fn with_override(project_dir: &Path, ovr: fbuild_config::PackageOverride) -> Self {
Self {
base: PackageBase::new(
"ch32v-core",
CH32V_CORE_VERSION,
CH32V_CORE_URL,
CH32V_CORE_URL,
None,
CacheSubdir::Platforms,
project_dir,
)
.with_override(ovr),
install_dir: None,
}
}

#[cfg(test)]
fn with_cache_root(project_dir: &Path, cache_root: &Path) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions crates/fbuild-packages/src/library/esp8266_framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ impl Esp8266Framework {
}
}

/// Construct with a consumer-supplied override (parsed from the env's
/// `platform_packages` line in `platformio.ini`). The default const-pinned
/// URL / version / checksum are replaced; `cache_subdir` and `name` are
/// preserved. See `PackageBase::with_override` and FastLED/fbuild#681.
pub fn with_override(project_dir: &Path, ovr: fbuild_config::PackageOverride) -> Self {
Self {
base: PackageBase::new(
"esp8266-arduino",
ESP8266_FRAMEWORK_VERSION,
ESP8266_FRAMEWORK_URL,
ESP8266_FRAMEWORK_URL,
None,
CacheSubdir::Platforms,
project_dir,
)
.with_override(ovr),
}
}

#[cfg(test)]
fn with_cache_root(project_dir: &Path, cache_root: &Path) -> Self {
Self {
Expand Down
Loading
Loading