This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit ef65856541bd06d360875a3bc34693904548d6ad Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 21 02:07:34 2026 +0200 newt/builder: Sort entries in compile_commands.json Compile commands are recorded as parallel compile jobs complete, so order of entries in compile_commands.json changed between builds. Sort entries by source file name. Assisted-by: Claude:claude-opus-5-5 --- newt/builder/build.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/newt/builder/build.go b/newt/builder/build.go index 2c868961..c0bf2b3f 100644 --- a/newt/builder/build.go +++ b/newt/builder/build.go @@ -26,6 +26,7 @@ import ( "os" "path/filepath" "runtime" + "sort" "strings" log "github.com/sirupsen/logrus" @@ -769,6 +770,12 @@ func (b *Builder) Build() error { } } + // Commands are collected as parallel compile jobs complete; sort them so + // that file contents do not depend on job completion order. + sort.SliceStable(compileCommands, func(i, j int) bool { + return compileCommands[i].File < compileCommands[j].File + }) + projectPath := interfaces.GetProject().Path() + "/" for i := range compileCommands { compileCommands[i].Directory = projectPath
