Context
ESP32 clean-build profiling shows the dominant costs are independent of LTO:
- framework built-in library handling: ~5.5 s
- framework core/variant compilation: ~15–16 s
- link/convert/size: ~5.5 s
The current --clean implementation removes the project build directory and deliberately disables FrameworkCoreCache, so it recompiles framework core artifacts. Built-in library archives are also project-local under <build_dir>/fw_libs, so they are discarded as part of every clean build.
Proposal
Define two cache-cleanliness scopes consistently for fbuild build and fbuild deploy:
--clean removes only project/sketch outputs and is equivalent to fbuild clean sketch. It must still hydrate verified reusable framework core and built-in-library artifacts.
--clean-all removes project/sketch outputs plus the reusable framework cache entries applicable to the selected environment. It is equivalent to fbuild clean all.
Add the fbuild clean <sketch|all> command and make cache ownership explicit: project outputs live under the project build directory; reusable framework artifacts live under the global fbuild cache.
Reusable cache keys must continue to incorporate the framework/toolchain identity, target board/environment, build profile, compiler flags/signature, source contents, and relevant user overlays. A cache validation miss must safely rebuild and repopulate the cache.
Acceptance criteria
fbuild build --clean and fbuild deploy --clean remove project build outputs without bypassing valid core or built-in-library caches.
fbuild build --clean-all and fbuild deploy --clean-all remove the selected environment's reusable framework caches before rebuilding.
fbuild clean sketch has the same project-output effect as --clean; fbuild clean all has the same effect as --clean-all.
- Core and built-in-library cache hits are content-addressed and cannot cross incompatible framework/toolchain/flag/profile configurations.
- Tests exercise clean sketch vs clean all and prove cache hydrate/store behavior.
- ESP32 clean-build profiling demonstrates the cache-hit path avoids recompiling core and built-in libraries.
Notes
The existing FrameworkCoreCache already stores reusable core artifacts globally, but ESP32 disables it when params.clean is set. ESP32 built-in library archives are currently stored only in the project build directory.
Context
ESP32 clean-build profiling shows the dominant costs are independent of LTO:
The current
--cleanimplementation removes the project build directory and deliberately disablesFrameworkCoreCache, so it recompiles framework core artifacts. Built-in library archives are also project-local under<build_dir>/fw_libs, so they are discarded as part of every clean build.Proposal
Define two cache-cleanliness scopes consistently for
fbuild buildandfbuild deploy:--cleanremoves only project/sketch outputs and is equivalent tofbuild clean sketch. It must still hydrate verified reusable framework core and built-in-library artifacts.--clean-allremoves project/sketch outputs plus the reusable framework cache entries applicable to the selected environment. It is equivalent tofbuild clean all.Add the
fbuild clean <sketch|all>command and make cache ownership explicit: project outputs live under the project build directory; reusable framework artifacts live under the global fbuild cache.Reusable cache keys must continue to incorporate the framework/toolchain identity, target board/environment, build profile, compiler flags/signature, source contents, and relevant user overlays. A cache validation miss must safely rebuild and repopulate the cache.
Acceptance criteria
fbuild build --cleanandfbuild deploy --cleanremove project build outputs without bypassing valid core or built-in-library caches.fbuild build --clean-allandfbuild deploy --clean-allremove the selected environment's reusable framework caches before rebuilding.fbuild clean sketchhas the same project-output effect as--clean;fbuild clean allhas the same effect as--clean-all.Notes
The existing
FrameworkCoreCachealready stores reusable core artifacts globally, but ESP32 disables it whenparams.cleanis set. ESP32 built-in library archives are currently stored only in the project build directory.