[core] Move build_info_data.h out of application.h to fix incremental rebuilds

build_info_data.h contains ESPHOME_BUILD_TIME which changes every build.
Since application.h included it, changing any source file caused
build_info_data.h to be rewritten (via sources_changed), which then
triggered a rebuild of every file that includes application.h.

Move all build_info_data.h dependent code from application.h inline
methods to application.cpp, so only application.cpp recompiles when
build info changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Jonathan Swoboda
2026-02-23 13:43:10 -05:00
parent 8780ec29d9
commit 111340bda4

View File

@@ -26,9 +26,7 @@ void VersionTextSensor::setup() {
if (!this->hide_timestamp_) {
size_t len = strlen(version_str);
ESPHOME_strncat_P(version_str, BUILT_STR, sizeof(version_str) - len - 1);
char time_buf[esphome::Application::BUILD_TIME_STR_SIZE];
App.get_build_time_string(time_buf);
strncat(version_str, time_buf, sizeof(version_str) - strlen(version_str) - 1);
ESPHOME_strncat_P(version_str, ESPHOME_BUILD_TIME_STR, sizeof(version_str) - strlen(version_str) - 1);
}
strncat(version_str, ")", sizeof(version_str) - strlen(version_str) - 1);