Merge "Make platform_mappings file deterministic" into main
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -28,6 +29,22 @@ type bazelLabel struct {
|
|||||||
target string
|
target string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *bazelLabel) Less(other *bazelLabel) bool {
|
||||||
|
if l.repo < other.repo {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if l.repo > other.repo {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if l.pkg < other.pkg {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if l.pkg > other.pkg {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return l.target < other.target
|
||||||
|
}
|
||||||
|
|
||||||
func (l *bazelLabel) String() string {
|
func (l *bazelLabel) String() string {
|
||||||
return fmt.Sprintf("@%s//%s:%s", l.repo, l.pkg, l.target)
|
return fmt.Sprintf("@%s//%s:%s", l.repo, l.pkg, l.target)
|
||||||
}
|
}
|
||||||
@@ -229,9 +246,16 @@ func platformMappingContent(
|
|||||||
mergedConvertedModulePathMap[k] = v
|
mergedConvertedModulePathMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
productLabels := make([]bazelLabel, 0, len(productLabelToVariables))
|
||||||
|
for k := range productLabelToVariables {
|
||||||
|
productLabels = append(productLabels, k)
|
||||||
|
}
|
||||||
|
sort.Slice(productLabels, func(i, j int) bool {
|
||||||
|
return productLabels[i].Less(&productLabels[j])
|
||||||
|
})
|
||||||
result.WriteString("platforms:\n")
|
result.WriteString("platforms:\n")
|
||||||
for productLabel, productVariables := range productLabelToVariables {
|
for _, productLabel := range productLabels {
|
||||||
platformMappingSingleProduct(productLabel, productVariables, soongConfigDefinitions, mergedConvertedModulePathMap, &result)
|
platformMappingSingleProduct(productLabel, productLabelToVariables[productLabel], soongConfigDefinitions, mergedConvertedModulePathMap, &result)
|
||||||
}
|
}
|
||||||
return result.String(), nil
|
return result.String(), nil
|
||||||
}
|
}
|
||||||
@@ -339,8 +363,9 @@ func platformMappingSingleProduct(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for namespace, namespaceContents := range productVariables.VendorVars {
|
for _, namespace := range android.SortedKeys(productVariables.VendorVars) {
|
||||||
for variable, value := range namespaceContents {
|
for _, variable := range android.SortedKeys(productVariables.VendorVars[namespace]) {
|
||||||
|
value := productVariables.VendorVars[namespace][variable]
|
||||||
key := namespace + "__" + variable
|
key := namespace + "__" + variable
|
||||||
_, hasBool := soongConfigDefinitions.BoolVars[key]
|
_, hasBool := soongConfigDefinitions.BoolVars[key]
|
||||||
_, hasString := soongConfigDefinitions.StringVars[key]
|
_, hasString := soongConfigDefinitions.StringVars[key]
|
||||||
|
Reference in New Issue
Block a user