fix(library-select): honor Arduino library spec for 1.0 flat layout; release v2.2.6#268
Conversation
…release v2.2.6 Closes #267 (Fix 2 — the scanner correctness fix). ## The bug `fbuild 2.2.5` fails to build any sketch for `teensy41`: fatal error: ft2build.h: No such file or directory 23 | #include <ft2build.h> compilation terminated. The offending file is `framework-arduinoteensy/libraries/ssd1351/fontconvert/fontconvert.c` — a *host-only* desktop tool that links `-lfreetype`. ssd1351 ships it as a font preprocessor; it was never intended to be ARM-cross-compiled. ## Root cause `collect_library_sources` in `framework_library.rs` walked the entire library directory recursively for 1.0 flat-layout libraries (no `src/`), violating the Arduino library specification. The spec says: - **1.5 recursive layout** (has `src/`): scan `src/**` only. - **1.0 flat layout** (no `src/`): scan root *non-recursively* plus the literal `utility/` subdirectory. Subdirectories like `fontconvert/`, `util/`, `Fonts/`, `examples/`, and `extras/` must be ignored. The ssd1351 author parked `fontconvert.c` in `fontconvert/` (not `utility/`) precisely so Arduino IDE / PlatformIO would skip it. fbuild's recursive walk swept it in. ## The fix Rewrite `collect_library_sources` to dispatch on layout: - 1.5 (has `src/`): recurse into `src/` only — already correct. - 1.0 (no `src/`): `collect_root_level_sources` (non-recursive) + recurse into `utility/` only. This matches `arduino-cli` exactly and protects fbuild from any well-formed library shipping companion tooling in a non-`utility/` subdirectory. ## Tests - `collect_library_sources_flat_layout_arduino_spec` — fixture mimics ssd1351 (root .cpp + utility/ + fontconvert/ + util/ + Fonts/ + examples/). Asserts only root + utility/ are returned; fontconvert/ (with the `#include <ft2build.h>` that breaks the build), util/, Fonts/, and examples/ are dropped. - `collect_library_sources_recursive_layout_arduino_spec` — fixture with `src/SPI.cpp`, `src/sub/bar.cpp`, root-level `baz.cpp`, and `examples/`. Asserts only `src/**` is returned; root `baz.cpp` and examples/ are dropped. Full workspace cargo check / clippy / fmt / test all green. ## Release v2.2.6 Patch release rolling up the #267 scanner-correctness fix. Both teensy41 regressions from earlier today (#261 LTO tmpdir, #263 bundled FastLED dup) carry over from v2.2.5. Cargo.toml + pyproject.toml bumped to 2.2.6. ## Deferred (out of scope for this PR) Fix 1 from #267 — investigate why ssd1351 is reaching the compile set at all when Blink doesn't `#include <ssd1351.h>` — is a separate LDF-leak investigation. With Fix 2 in place, even if ssd1351 IS selected, only `ssd1351.cpp` at the root would be compiled (which should cross-compile fine for ARM). The user-reported build failure is resolved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes Arduino library specification compliance in source discovery. The library scanner now correctly dispatches on layout type: 1.5 layouts with ChangesArduino Library Specification Compliance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #267 (Fix 2 — scanner correctness). Cuts release v2.2.6.
The bug
fbuild 2.2.5fails to build any sketch forteensy41:The offending file is
framework-arduinoteensy/libraries/ssd1351/fontconvert/fontconvert.c— a host-only desktop tool that links-lfreetype. ssd1351 ships it as a font preprocessor; it was never meant to be ARM-cross-compiled.Root cause
collect_library_sourcesinframework_library.rswalked the entire library directory recursively for 1.0 flat-layout libraries (nosrc/), violating the Arduino library spec:src/): scansrc/**only.src/): scan root non-recursively plus literalutility/.Subdirectories like
fontconvert/,util/,Fonts/,examples/,extras/must be ignored. The ssd1351 author parkedfontconvert.cinfontconvert/(notutility/) precisely so Arduino IDE and PlatformIO would skip it. fbuild's recursive walk swept it in.Fix
Rewrite
collect_library_sourcesto dispatch on layout — 1.5 stays recursive intosrc/; 1.0 is non-recursive at root plus a single recurse intoutility/. Matchesarduino-cliexactly.Regression tests
collect_library_sources_flat_layout_arduino_spec— ssd1351 fixture. Asserts root + utility/ only; fontconvert/ + util/ + Fonts/ + examples/ are all dropped.collect_library_sources_recursive_layout_arduino_spec—src/fixture. Asserts onlysrc/**; root-levelbaz.cppdropped.Release v2.2.6
Cargo + pyproject bumped to 2.2.6. On merge,
release-auto.ymltriggers (path filter matchesCargo.toml+pyproject.toml).Deferred (separate work)
Fix 1 from #267 — investigate why ssd1351 is reaching the compile set at all when Blink doesn't
#include <ssd1351.h>. With Fix 2 in place, even if ssd1351 IS selected, onlyssd1351.cppat the root would be compiled (which cross-compiles fine for ARM). The user-reported build failure is resolved by Fix 2 alone.Test plan
soldr cargo check --workspace --all-targets— cleansoldr cargo clippy --workspace --all-targets -- -D warnings— cleansoldr cargo fmt --all -- --check— cleansoldr cargo test --workspace— all green; new framework_library tests passrelease-auto.ymlships v2.2.6 to PyPI + GitHubbash compile teensy41succeeds on v2.2.6🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Bug Fixes
src/directories now recursively scan only that directory, while libraries withoutsrc/scan the root non-recursively plus theutility/subdirectory. Other subdirectories are now properly excluded.