Skip to content

platformio.ini advanced build configurations are not yet compatible with PlatformIO/SCons flag workflows #34

@zackees

Description

@zackees

Title: platformio.ini advanced build configurations are not yet compatible with PlatformIO/SCons flag workflows

Summary

fbuild advertises compatibility with platformio.ini, but today that compatibility is mostly limited to flat config values like build_flags / build_src_flags and environment inheritance. Standard PlatformIO patterns for advanced build configurations are not modeled yet, so a project that uses normal PlatformIO debug/custom build techniques can silently build with different semantics under fbuild.

What this means in practice

A lot of PlatformIO projects define advanced build flavors by combining:

  • build_type = debug|release|test
  • debug_build_flags
  • build_unflags
  • extra_scripts that mutate SCons construction variables such as CPPDEFINES, CCFLAGS, CXXFLAGS, LINKFLAGS, or CPPPATH

That is the standard PlatformIO/SCons workflow for �advanced build types�: the INI selects the build flavor, and either declarative keys or SCons script hooks add/remove the actual compiler/linker flags.

Right now fbuild does not appear to implement that model. It reads ordinary build_flags / build_src_flags, has its own internal BuildProfile abstraction (release vs quick), and supports one-off caller-injected flags, but it does not map the PlatformIO build-type layer onto those internal profiles.

Repo evidence

  • PlatformIOConfig::get_build_flags() only reads build_flags, and get_build_src_flags() only reads build_src_flags: crates/fbuild-config/src/ini_parser.rs:123-143
  • BuildContext::new() only collects build_flags and build_src_flags before build orchestration: crates/fbuild-build/src/pipeline.rs:106-111
  • Build orchestration has an internal profile system (release, quick) rather than a platformio.ini-driven build_type model: crates/fbuild-build/src/compiler.rs:24-29, crates/fbuild-build/src/lib.rs:138-166
  • PLATFORMIO_BUILD_UNFLAGS is listed as a supported env override and has an accessor, but I could not find any point where it is applied to the effective flag set: crates/fbuild-config/src/pio_env.rs:15-21, crates/fbuild-config/src/pio_env.rs:111-121
  • PLATFORMIO_EXTRA_SCRIPTS is explicitly recognized as warn-only / no-op today: crates/fbuild-config/src/pio_env.rs:43-59
  • I could not find any repo references to build_type or debug_build_flags

Expected behavior

At minimum, fbuild should not silently accept a platformio.ini that depends on PlatformIO advanced build-type mechanics while producing a materially different build.

Preferred direction:

  1. Parse and honor build_type, debug_build_flags, and build_unflags from platformio.ini
  2. Define a compatibility mapping from PlatformIO build types to fbuild build profiles, including a real debug-oriented path rather than only release / quick
  3. Apply build_unflags against framework/toolchain/default/user flags in the same stage where the final effective flag set is assembled
  4. Detect extra_scripts / SCons flag mutation patterns and either:
    • support a constrained compatibility subset, or
    • fail fast with a clear diagnostic that advanced scripting is not yet supported
  5. Add tests with representative fixtures for:
    • a plain build_type = debug environment
    • a build_unflags override (for example removing a default -std= or warning flag)
    • a project that depends on extra_scripts to mutate CPPDEFINES / CCFLAGS / LINKFLAGS

Why this matters

Without this, �compatible with platformio.ini� is true for basic environments but not for a common class of real-world PlatformIO projects. Those projects often rely on advanced build types specifically to control optimization/debug info, remove framework defaults, or inject profile-specific compile/link behavior. If fbuild ignores that layer, migration can succeed syntactically while diverging semantically.

PlatformIO references

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions