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
13 changes: 12 additions & 1 deletion crates/fbuild-build/src/pipeline/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,23 @@ impl BuildContext {
}

// 2. Load board config
//
// Use `from_board_id_in_project` (not the legacy `from_board_id`) so
// a `<project_dir>/boards/<board_id>.json` file is picked up when
// the bundled DB has no entry. Matches PlatformIO's auto-discovery
// of project-local board manifests and is the only knob `fbuild
// build` had to honor FastLED/fbuild#515 — without this the daemon
// build path silently dropped the project_dir context.
let t0 = std::time::Instant::now();
let board_id = env_config.get("board").ok_or_else(|| {
fbuild_core::FbuildError::ConfigError("missing 'board' in environment config".into())
})?;
let overrides = config.get_board_overrides(env_name)?;
let board = fbuild_config::BoardConfig::from_board_id(board_id, &overrides)?;
let board = fbuild_config::BoardConfig::from_board_id_in_project(
board_id,
&overrides,
Some(project_dir.as_path()),
)?;
if let Some(p) = perf.as_mut() {
p.record("board-load", t0.elapsed());
}
Expand Down
13 changes: 11 additions & 2 deletions crates/fbuild-build/src/script_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn resolve_extra_script_overlay(
}

let project_options = config.get_env_config(env_name)?;
let board_config = build_script_runtime_board_config(project_options)?;
let board_config = build_script_runtime_board_config(project_options, Some(project_dir))?;
let input = ScriptRuntimeInput {
project_dir: &project_dir.to_string_lossy(),
env_name,
Expand Down Expand Up @@ -290,13 +290,22 @@ fn find_python() -> Option<Vec<String>> {

fn build_script_runtime_board_config(
project_options: &HashMap<String, String>,
project_dir: Option<&Path>,
) -> fbuild_core::Result<HashMap<String, String>> {
let mut result = HashMap::new();
let Some(board_id) = project_options.get("board") else {
return Ok(result);
};

let board = fbuild_config::BoardConfig::from_board_id(board_id, &HashMap::new())?;
// Shares the same project-local boards/*.json resolution as the
// pipeline `BuildContext` and `compile_many::platform_for_board` so a
// user's `<project>/boards/<id>.json` is the single source of truth
// for every build-side board lookup. See FastLED/fbuild#515.
let board = fbuild_config::BoardConfig::from_board_id_in_project(
board_id,
&HashMap::new(),
project_dir,
)?;
result.insert("name".to_string(), board.name.clone());
result.insert("build.mcu".to_string(), board.mcu.clone());
result.insert("build.f_cpu".to_string(), board.f_cpu.clone());
Expand Down
Loading