Skip to content

feat: make Arduino.h injection conditional during ino preprocessing #646

Description

@zackees

Context

The current .ino preprocessing path emits #include <Arduino.h> into the generated .ino.cpp file unconditionally.

That is correct for Arduino-compatible builds, but it is too aggressive for targets or test environments where Arduino.h is not present. In those cases fbuild should not force Arduino semantics onto the generated translation unit.

Relevant area:

  • crates/fbuild-build/src/source_scanner.rs

Proposal

Only inject #include <Arduino.h> when Arduino.h is actually available/resolvable for the active build environment.

If Arduino.h is not available, omit the include and continue generating the .ino.cpp file without it.

Acceptance criteria

  • .ino preprocessing injects #include <Arduino.h> when the header is available.
  • .ino preprocessing omits #include <Arduino.h> when the header is not available.
  • The behavior is covered by tests for both available and unavailable header cases.
  • The generated output remains stable across repeated runs when inputs and header availability do not change.

Open questions

  • What is the best availability check: board package metadata, include path probing, compiler preflight, or an existing build context signal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions