Skip to content
Closed
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
8 changes: 8 additions & 0 deletions crates/fbuild-build/src/avr/avr_linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ impl Linker for AvrLinker {
&self.size_path
}

fn ar_path(&self) -> Option<&Path> {
Some(&self.ar_path)
}

fn objcopy_path(&self) -> Option<&Path> {
Some(&self.objcopy_path)
}

fn report_size(&self, elf_path: &Path) -> Result<SizeInfo> {
crate::linker::LinkerBase::report_size(
&self.size_path,
Expand Down
49 changes: 49 additions & 0 deletions crates/fbuild-build/src/avr/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,22 @@ impl BuildOrchestrator for AvrOrchestrator {

let mcu_config = super::mcu_config::get_avr_config()?;

// Snapshot for the optional build_info.json emitter — captured
// before `defines` is moved into the compiler. See
// FastLED/fbuild#297.
let info_snapshot = if params.emit_build_info {
Some(crate::build_info::BuildInfoSnapshot {
board: ctx.board.clone(),
defines: defines.clone(),
include_dirs: include_dirs.clone(),
sketch_sources: sources.sketch_sources.clone(),
link_flags: ctx.overlay_link_flags.clone(),
link_libs: ctx.overlay_link_libs.clone(),
})
} else {
None
};

let compiler = AvrCompiler::new(
toolchain.get_gcc_path(),
toolchain.get_gxx_path(),
Expand Down Expand Up @@ -286,6 +302,39 @@ impl BuildOrchestrator for AvrOrchestrator {
start,
)?;

// Emit build_info.json (PIO-compatible) for downstream FastLED
// tooling when the caller opted in. See FastLED/fbuild#297.
if let Some(snap) = info_snapshot {
if build_result.success {
let example_name = params
.example_name
.clone()
.or_else(|| crate::build_info::default_example_name(&params.project_dir));
let inputs = crate::build_info::OrchestratorBuildInfoInputs {
project_dir: &params.project_dir,
env_name: &params.env_name,
board: &snap.board,
compiler: &compiler,
linker: &linker,
include_dirs: &snap.include_dirs,
defines: &snap.defines,
link_libs: &snap.link_libs,
link_flags: &snap.link_flags,
sketch_sources: &snap.sketch_sources,
frameworks: vec!["arduino".to_string()],
platform: "atmelavr",
prog_path: build_result
.firmware_path
.as_deref()
.or(build_result.elf_path.as_deref()),
example_name: example_name.as_deref(),
};
if let Err(e) = crate::build_info::emit_build_info_for_orchestrator(inputs) {
tracing::warn!("failed to emit build_info.json: {}", e);
}
}
}

// 10. Persist fingerprint so the next warm invocation can hit the
// fast path. Skip this for compile-db-only / symbol-analysis runs
// — they don't produce the full artifact set the fast path
Expand Down
Loading