Unverified Commit 354464fe authored by Alessio Perugini's avatar Alessio Perugini Committed by GitHub

make `boards details` JSON output deterministic (#2419)

parent 7a146635
......@@ -18,6 +18,7 @@ package result
import (
"cmp"
"fmt"
"slices"
"github.com/arduino/arduino-cli/i18n"
f "github.com/arduino/arduino-cli/internal/algorithms"
......@@ -425,6 +426,8 @@ func NewBoardDetailsResponse(b *rpc.BoardDetailsResponse) *BoardDetailsResponse
if b == nil {
return nil
}
buildProperties := b.GetBuildProperties()
slices.Sort(buildProperties)
return &BoardDetailsResponse{
Fqbn: b.GetFqbn(),
Name: b.GetName(),
......@@ -440,7 +443,7 @@ func NewBoardDetailsResponse(b *rpc.BoardDetailsResponse) *BoardDetailsResponse
Programmers: NewProgrammers(b.GetProgrammers()),
DebuggingSupported: b.GetDebuggingSupported(),
IdentificationProperties: NewBoardIdentificationProperties(b.GetIdentificationProperties()),
BuildProperties: b.GetBuildProperties(),
BuildProperties: buildProperties,
DefaultProgrammerID: b.GetDefaultProgrammerId(),
}
}
......@@ -636,6 +639,10 @@ func NewProgrammers(c []*rpc.Programmer) []*Programmer {
for i, v := range c {
res[i] = NewProgrammer(v)
}
slices.SortFunc(res, func(a, b *Programmer) int {
return cmp.Compare(a.Id, b.Id)
})
return res
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment