Parent: #34
Problem
build_unflags is more than user-flag cleanup. PlatformIO applies it against the effective SCons environment after board flags, user flags, framework scripts, and other mutations have contributed to the final flag scopes.
PlatformIO source evidence
ProcessProgramDeps() applies board extra flags, then BUILD_FLAGS, then framework scripts, then ConfigureDebugTarget(), and only after that calls ProcessUnFlags(BUILD_UNFLAGS): .cache/platformio-core/platformio/builder/tools/piobuild.py:94-128
ProcessUnFlags() removes matching entries across parsed flag scopes, including ASPPFLAGS: .cache/platformio-core/platformio/builder/tools/piobuild.py:256-266
- PlatformIO has a regression test where
build_unflags removes values injected by an extra_scripts SCons mutation, not just values typed directly in build_flags: .cache/platformio-core/tests/commands/test_run.py:143-197
Current fbuild state
PLATFORMIO_BUILD_UNFLAGS is recognized as supported and has an accessor: crates/fbuild-config/src/pio_env.rs:15-21, crates/fbuild-config/src/pio_env.rs:111-121
- I could not find any code path where those unflags are applied to the effective native flag set
- fbuild currently merges user flags by appending/replacing some flag classes, e.g. ESP32
apply_user_flags(): crates/fbuild-build/src/esp32/orchestrator.rs:1257-1276
Requested change
Implement build_unflags in native mode against the final effective flag scopes that fbuild assembles, not only against raw user-provided build_flags.
Questions to resolve
- Which scopes should be covered in fbuild (
compile, link, assembler, include paths, libs)?
- Should support be exact-match only, or also special-case macro/key semantics as fbuild already does for
-D replacement?
- How should this interact with platform-specific orchestrators that currently assemble flags differently?
Acceptance criteria
build_unflags affects the effective native build result
- Removal is applied after board/framework/profile/user contributions are combined
- Tests cover at least one removal from each supported scope
- If any PlatformIO
build_unflags behavior is intentionally out of scope, the limitation is documented and diagnosed clearly
Parent: #34
Problem
build_unflagsis more than user-flag cleanup. PlatformIO applies it against the effective SCons environment after board flags, user flags, framework scripts, and other mutations have contributed to the final flag scopes.PlatformIO source evidence
ProcessProgramDeps()applies board extra flags, thenBUILD_FLAGS, then framework scripts, thenConfigureDebugTarget(), and only after that callsProcessUnFlags(BUILD_UNFLAGS):.cache/platformio-core/platformio/builder/tools/piobuild.py:94-128ProcessUnFlags()removes matching entries across parsed flag scopes, includingASPPFLAGS:.cache/platformio-core/platformio/builder/tools/piobuild.py:256-266build_unflagsremoves values injected by anextra_scriptsSCons mutation, not just values typed directly inbuild_flags:.cache/platformio-core/tests/commands/test_run.py:143-197Current fbuild state
PLATFORMIO_BUILD_UNFLAGSis recognized as supported and has an accessor:crates/fbuild-config/src/pio_env.rs:15-21,crates/fbuild-config/src/pio_env.rs:111-121apply_user_flags():crates/fbuild-build/src/esp32/orchestrator.rs:1257-1276Requested change
Implement
build_unflagsin native mode against the final effective flag scopes that fbuild assembles, not only against raw user-providedbuild_flags.Questions to resolve
compile,link, assembler, include paths, libs)?-Dreplacement?Acceptance criteria
build_unflagsaffects the effective native build resultbuild_unflagsbehavior is intentionally out of scope, the limitation is documented and diagnosed clearly