Merge "Fix Soong CMakeLists.txt generator"
am: 267e406830
Change-Id: I39e322d71930bc772be77f55ba493c8a38cd6cb0
This commit is contained in:
@@ -306,6 +306,20 @@ func categorizeParameter(parameter string) parameterType {
|
|||||||
return flag
|
return flag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flattens a list of strings potentially containing space characters into a list of string containing no
|
||||||
|
// spaces.
|
||||||
|
func normalizeParameters(params []string) []string {
|
||||||
|
var flatParams []string
|
||||||
|
for _, s := range params {
|
||||||
|
s = strings.Trim(s, " ")
|
||||||
|
if len(s) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
flatParams = append(flatParams, strings.Split(s, " ")...)
|
||||||
|
}
|
||||||
|
return flatParams
|
||||||
|
}
|
||||||
|
|
||||||
func parseCompilerParameters(params []string, ctx android.SingletonContext, f *os.File) compilerParameters {
|
func parseCompilerParameters(params []string, ctx android.SingletonContext, f *os.File) compilerParameters {
|
||||||
var compilerParameters = makeCompilerParameters()
|
var compilerParameters = makeCompilerParameters()
|
||||||
|
|
||||||
@@ -313,6 +327,15 @@ func parseCompilerParameters(params []string, ctx android.SingletonContext, f *o
|
|||||||
f.WriteString(fmt.Sprintf("# Raw param [%d] = '%s'\n", i, str))
|
f.WriteString(fmt.Sprintf("# Raw param [%d] = '%s'\n", i, str))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Soong does not guarantee that each flag will be in an individual string. e.g: The
|
||||||
|
// input received could be:
|
||||||
|
// params = {"-isystem", "path/to/system"}
|
||||||
|
// or it could be
|
||||||
|
// params = {"-isystem path/to/system"}
|
||||||
|
// To normalize the input, we split all strings with the "space" character and consolidate
|
||||||
|
// all tokens into a flattened parameters list
|
||||||
|
params = normalizeParameters(params)
|
||||||
|
|
||||||
for i := 0; i < len(params); i++ {
|
for i := 0; i < len(params); i++ {
|
||||||
param := params[i]
|
param := params[i]
|
||||||
if param == "" {
|
if param == "" {
|
||||||
|
Reference in New Issue
Block a user