Skip to content

scripts: uuid-registry: only write header when content changes - #11154

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202609-fix-incremental-builds
Open

scripts: uuid-registry: only write header when content changes#11154
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202609-fix-incremental-builds

Conversation

@kv2019i

@kv2019i kv2019i commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Every invocation of gen-uuid-reg.py rewrites uuid-registry.h with open(..., "w"), updating the file's mtime even when the generated content was byte-for-byte identical. The uuid-registry.cmake custom command that runs this script executes on every build (it is wired into zephyr_interface via the uuid_reg_h target), and the header is force-included with -imacros into nearly every SOF translation unit. As a result, incremental builds in practise rebuild all objects even if no code is changed.

Fix incremental builds by only updating uuid-registery if the content changes.

Every invocation of gen-uuid-reg.py rewrites uuid-registry.h with
open(..., "w"), updating the file's mtime even when the generated
content was byte-for-byte identical. The uuid-registry.cmake custom
command that runs this script executes on every build (it is wired
into zephyr_interface via the uuid_reg_h target), and the header is
force-included with -imacros into nearly every SOF translation unit.
As a result, incremental builds in practise rebuild all objects
even if no code is changed.

Fix incremental builds by only updating uuid-registery if the content
changes.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is localized, preserves the generated output format, and prevents unnecessary rebuilds by avoiding no-op rewrites.

Pull request overview

Updates gen-uuid-reg.py to avoid rewriting the generated uuid-registry.h when the output would be identical, preventing unnecessary timestamp changes that cascade into widespread incremental rebuilds (since the header is force-included into many translation units).

Changes:

  • Build the full generated header content as a single string (new_content).
  • Compare against the existing output file and return early when unchanged.
  • Write the header in a single f.write() when an update is needed.
File summaries
File Description
scripts/gen-uuid-reg.py Avoids unconditional rewrites of the generated UUID registry header to improve incremental build performance.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants