Fix more androidbp bugs

Don't insert a space when concatentating strings.  Lists will already have
a separator, and strings may need to be a single word.
Use valueToString to print individual elements in a list to pick up the
same expression fix from a previous patch.
"static_executable" converts to LOCAL_FORCE_STATIC_EXECUTABLE, not "static".
Add "no_default_compiler_flags" to LOCAL_NO_DEFAULT_COMPILER_FLAGS.

Change-Id: I45c7eb8355ee1b40d7949e1560cc11cc959764b3
This commit is contained in:
Colin Cross 2015-06-22 17:26:12 -07:00
parent 499c094c09
commit eb05083e27
2 changed files with 7 additions and 12 deletions

View file

@ -33,7 +33,7 @@ func valueToString(value bpparser.Value) string {
if value.Expression.Operator != '+' {
panic(fmt.Errorf("unexpected operator '%c'", value.Expression.Operator))
}
return fmt.Sprintf("%s %s",
return fmt.Sprintf("%s%s",
valueToString(value.Expression.Args[0]),
valueToString(value.Expression.Args[1]))
} else {
@ -88,12 +88,7 @@ func processWildcards(s string) string {
func listToMkString(list []bpparser.Value) string {
lines := make([]string, 0, len(list))
for _, tok := range list {
if tok.Type == bpparser.String {
lines = append(lines, fmt.Sprintf(" %s", processWildcards(tok.StringValue)))
} else {
lines = append(lines, fmt.Sprintf("# ERROR: unsupported type %s in list",
tok.Type.String()))
}
lines = append(lines, fmt.Sprintf(" %s", valueToString(tok)))
}
return strings.Join(lines, " \\\n")

View file

@ -51,15 +51,15 @@ var standardProperties = map[string]struct {
// ==== BOOL PROPERTIES ====
"host": {"LOCAL_IS_HOST_MODULE", bpparser.Bool},
"clang": {"LOCAL_CLANG", bpparser.Bool},
"static": {"LOCAL_FORCE_STATIC_EXECUTABLE", bpparser.Bool},
"static_executable": {"LOCAL_FORCE_STATIC_EXECUTABLE", bpparser.Bool},
"asan": {"LOCAL_ADDRESS_SANITIZER", bpparser.Bool},
"native_coverage": {"LOCAL_NATIVE_COVERAGE", bpparser.Bool},
"nocrt": {"LOCAL_NO_CRT", bpparser.Bool},
"allow_undefined_symbols": {"LOCAL_ALLOW_UNDEFINED_SYMBOLS", bpparser.Bool},
"rtti": {"LOCAL_RTTI_FLAG", bpparser.Bool},
"no_standard_libraries": {"LOCAL_NO_STANDARD_LIBRARIES", bpparser.Bool},
"export_package_resources": {"LOCAL_EXPORT_PACKAGE_RESOURCES", bpparser.Bool},
"static_executable": {"LOCAL_FORCE_STATIC_EXECUTABLE", bpparser.Bool},
"rtti": {"LOCAL_RTTI_FLAG", bpparser.Bool},
"no_standard_libraries": {"LOCAL_NO_STANDARD_LIBRARIES", bpparser.Bool},
"export_package_resources": {"LOCAL_EXPORT_PACKAGE_RESOURCES", bpparser.Bool},
"no_default_compiler_flags": {"LOCAL_NO_DEFAULT_COMPILER_FLAGS", bpparser.Bool},
}
var rewriteProperties = map[string]struct {