androidmk: TOP is always "."

am: 22abd40ed0

* commit '22abd40ed05090927ce7b0ac2c387c353253e7e2':
  androidmk: TOP is always "."

Change-Id: I18188553120b1d5db8993a7702e2a224f3687536
This commit is contained in:
Dan Willemsen
2016-06-06 19:22:47 +00:00
committed by android-build-merger
2 changed files with 41 additions and 13 deletions

View File

@@ -108,7 +108,7 @@ input = ["testing/include"]
cc_library_shared { cc_library_shared {
// Comment 1 // Comment 1
include_dirs: ["system/core/include"] + // Comment 2 include_dirs: ["system/core/include"] + // Comment 2
input + [TOP + "/system/core/include"], input + ["system/core/include"],
local_include_dirs: ["."] + ["include"] + ["test/include"], local_include_dirs: ["."] + ["include"] + ["test/include"],
// Comment 3 // Comment 3
}`, }`,
@@ -343,6 +343,19 @@ cc_library_shared {
ldflags: ["-Wl,--link-opt"], ldflags: ["-Wl,--link-opt"],
version_script: "exported32.map", version_script: "exported32.map",
} }
`,
},
{
desc: "Handle TOP",
in: `
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(TOP)/system/core/include $(TOP)
include $(BUILD_SHARED_LIBRARY)
`,
expected: `
cc_library_shared {
include_dirs: ["system/core/include", "."],
}
`, `,
}, },
} }

View File

@@ -65,9 +65,17 @@ func makeToStringExpression(ms *mkparser.MakeString, scope mkparser.Scope) (*bpp
Variable: name.Value(nil), Variable: name.Value(nil),
} }
val, err = addValues(val, tmp) if tmp.Variable == "TOP" {
if err != nil { if s[0] == '/' {
return nil, err s = s[1:]
} else {
s = "." + s
}
} else {
val, err = addValues(val, tmp)
if err != nil {
return nil, err
}
} }
} }
@@ -120,15 +128,22 @@ func makeToListExpression(ms *mkparser.MakeString, scope mkparser.Scope) (*bppar
if !f.Variables[0].Name.Const() { if !f.Variables[0].Name.Const() {
return nil, fmt.Errorf("unsupported non-const variable name") return nil, fmt.Errorf("unsupported non-const variable name")
} }
if len(listValue.ListValue) > 0 { if f.Variables[0].Name.Value(nil) == "TOP" {
listOfListValues = append(listOfListValues, listValue) listValue.ListValue = append(listValue.ListValue, bpparser.Value{
} Type: bpparser.String,
listOfListValues = append(listOfListValues, &bpparser.Value{ StringValue: ".",
Type: bpparser.List, })
Variable: f.Variables[0].Name.Value(nil), } else {
}) if len(listValue.ListValue) > 0 {
listValue = &bpparser.Value{ listOfListValues = append(listOfListValues, listValue)
Type: bpparser.List, }
listOfListValues = append(listOfListValues, &bpparser.Value{
Type: bpparser.List,
Variable: f.Variables[0].Name.Value(nil),
})
listValue = &bpparser.Value{
Type: bpparser.List,
}
} }
} }
} else { } else {