androidmk: TOP is always "." am: 22abd40ed0

am: f3e12048de

* commit 'f3e12048de8877d7e2a36c85aa2917a4f89f50e6':
  androidmk: TOP is always "."

Change-Id: I52328d8d9674384f81d41cdce0b7c182ae3bd35f
This commit is contained in:
Dan Willemsen
2016-06-06 19:28:23 +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,11 +65,19 @@ func makeToStringExpression(ms *mkparser.MakeString, scope mkparser.Scope) (*bpp
Variable: name.Value(nil), Variable: name.Value(nil),
} }
if tmp.Variable == "TOP" {
if s[0] == '/' {
s = s[1:]
} else {
s = "." + s
}
} else {
val, err = addValues(val, tmp) val, err = addValues(val, tmp)
if err != nil { if err != nil {
return nil, err return nil, err
} }
} }
}
if s != "" { if s != "" {
tmp := stringToStringValue(s) tmp := stringToStringValue(s)
@@ -120,6 +128,12 @@ 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 f.Variables[0].Name.Value(nil) == "TOP" {
listValue.ListValue = append(listValue.ListValue, bpparser.Value{
Type: bpparser.String,
StringValue: ".",
})
} else {
if len(listValue.ListValue) > 0 { if len(listValue.ListValue) > 0 {
listOfListValues = append(listOfListValues, listValue) listOfListValues = append(listOfListValues, listValue)
} }
@@ -131,6 +145,7 @@ func makeToListExpression(ms *mkparser.MakeString, scope mkparser.Scope) (*bppar
Type: bpparser.List, Type: bpparser.List,
} }
} }
}
} else { } else {
s, err := makeToStringExpression(f, scope) s, err := makeToStringExpression(f, scope)
if err != nil { if err != nil {