refactor of api_levels map for soong injection

Change-Id: I58449fc84617e46727f23ab3d8dd5f118d2ee0d2
Bug: 249265719
Test: go test ./bp2build and locally ran bazel tests
This commit is contained in:
Alix
2023-02-14 16:43:55 +00:00
parent 92ac65952d
commit c566ad8a4f
3 changed files with 42 additions and 54 deletions

View File

@@ -17,6 +17,7 @@ package starlark_fmt
import (
"fmt"
"sort"
"strconv"
"strings"
)
@@ -84,6 +85,16 @@ func PrintBoolDict(dict map[string]bool, indentLevel int) string {
return PrintDict(formattedValueDict, indentLevel)
}
// PrintStringIntDict returns a Starlark-compatible string formatted as dictionary with
// string keys and int values.
func PrintStringIntDict(dict map[string]int, indentLevel int) string {
valDict := make(map[string]string, len(dict))
for k, v := range dict {
valDict[k] = strconv.Itoa(v)
}
return PrintDict(valDict, indentLevel)
}
// PrintDict returns a starlark-compatible string containing a dictionary with string keys and
// values printed with no additional formatting.
func PrintDict(dict map[string]string, indentLevel int) string {