Make buildroot.cquery determinisitc

Test: determinism_test.sh
Change-Id: Ia80dc425a781247f518ace8a5d11b49cd1ae60ce
This commit is contained in:
Chris Parsons
2023-03-15 00:19:32 -04:00
parent 0897df1466
commit 38851d86aa

View File

@@ -946,9 +946,13 @@ func indent(original string) string {
// request type.
func (context *mixedBuildBazelContext) cqueryStarlarkFileContents() []byte {
requestTypeToCqueryIdEntries := map[cqueryRequest][]string{}
requestTypes := []cqueryRequest{}
for _, val := range context.requests {
cqueryId := getCqueryId(val)
mapEntryString := fmt.Sprintf("%q : True", cqueryId)
if _, seenKey := requestTypeToCqueryIdEntries[val.requestType]; !seenKey {
requestTypes = append(requestTypes, val.requestType)
}
requestTypeToCqueryIdEntries[val.requestType] =
append(requestTypeToCqueryIdEntries[val.requestType], mapEntryString)
}
@@ -970,7 +974,7 @@ def %s(target, id_string):
return id_string + ">>" + %s(target, id_string)
`
for requestType := range requestTypeToCqueryIdEntries {
for _, requestType := range requestTypes {
labelMapName := requestType.Name() + "_Labels"
functionName := requestType.Name() + "_Fn"
labelRegistrationMapSection += fmt.Sprintf(mapDeclarationFormatString,