Skip to content

fix: ensure generated ino cpp reuse is stable on Windows paths and line endings #649

Description

@zackees

Context

fbuild avoids rewriting generated .ino.cpp files when the generated content is unchanged. That is important because unnecessary rewrites can invalidate compiler caches.

However, Windows-specific path formatting and line-ending behavior could still cause byte-level output changes even when the .ino source has not meaningfully changed. Generated #line directives are a likely risk area.

Relevant area:

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

Proposal

Investigate and harden generated .ino.cpp stability across Windows path formats, path separators, drive-letter casing, absolute vs relative paths, and line endings.

Acceptance criteria

  • Repeated preprocessing of unchanged .ino input does not rewrite generated .ino.cpp on Windows.
  • Generated #line directives use a stable normalized path format.
  • Line endings are stable and intentional.
  • Tests cover Windows-style paths, mixed separators, and repeated preprocessing.
  • The behavior continues to preserve file mtime when generated content is unchanged.

Open questions

  • Should generated #line paths be absolute, project-relative, build-relative, or compiler-native?
  • Should fbuild normalize to / separators in generated source even on Windows?

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