androidbp: Handle local_include_dirs and fix export_include_dirs

The androidmk->androidbp translation strips $(LOCAL_PATH), add it back
in the reverse path.

Change-Id: I64ff213511c7dd6da0259746ea97677140ee5bf5
diff --git a/androidbp/cmd/androidbp.go b/androidbp/cmd/androidbp.go
index 58afe77..5a924b1 100644
--- a/androidbp/cmd/androidbp.go
+++ b/androidbp/cmd/androidbp.go
@@ -113,6 +113,8 @@
 			if mkProp, ok := standardProperties[targetScopedProp.Name.Name]; ok {
 				scopedProps = append(scopedProps, fmt.Sprintf("%s += %s",
 					mkProp.string, valueToString(targetScopedProp.Value)))
+			} else if rwProp, ok := rewriteProperties[targetScopedProp.Name.Name]; ok {
+				scopedProps = append(scopedProps, rwProp.f(rwProp.string, targetScopedProp, nil)...)
 			} else if "disabled" == targetScopedProp.Name.Name {
 				if targetScopedProp.Value.BoolValue {
 					disabledBuilds[target.Name.Name] = true
@@ -139,6 +141,8 @@
 			for _, stdProp := range suffixProp.Value.MapValue {
 				if mkProp, ok := standardProperties[stdProp.Name.Name]; ok {
 					computedProps = append(computedProps, fmt.Sprintf("%s_%s := %s", mkProp.string, suffix, valueToString(stdProp.Value)))
+				} else if rwProp, ok := rewriteProperties[stdProp.Name.Name]; ok {
+					computedProps = append(computedProps, rwProp.f(rwProp.string, stdProp, &suffix)...)
 				} else {
 					computedProps = append(computedProps, fmt.Sprintf("# ERROR: unsupported property %s", stdProp.Name.Name))
 				}
@@ -148,6 +152,22 @@
 	return
 }
 
+func prependLocalPath(name string, prop *bpparser.Property, suffix *string) (computedProps []string) {
+	includes := make([]string, 0, len(prop.Value.ListValue))
+	for _, tok := range prop.Value.ListValue {
+		if tok.Type == bpparser.String {
+			includes = append(includes, fmt.Sprintf("    $(LOCAL_PATH)/%s", tok.StringValue))
+		} else {
+			includes = append(includes, fmt.Sprintf("# ERROR: unsupported type %s in list",
+				tok.Type.String()))
+		}
+	}
+	if suffix != nil {
+		name += "_" + *suffix
+	}
+	return append(computedProps, fmt.Sprintf("%s := \\\n%s\n", name, strings.Join(includes, " \\\n")))
+}
+
 func (w *androidMkWriter) lookupMap(parent bpparser.Value) (mapValue []*bpparser.Property) {
 	if parent.Variable != "" {
 		mapValue = w.mapScope[parent.Variable]
@@ -194,6 +214,8 @@
 	for _, prop := range module.Properties {
 		if mkProp, ok := standardProperties[prop.Name.Name]; ok {
 			standardProps = append(standardProps, fmt.Sprintf("%s := %s", mkProp.string, valueToString(prop.Value)))
+		} else if rwProp, ok := rewriteProperties[prop.Name.Name]; ok {
+			standardProps = append(standardProps, rwProp.f(rwProp.string, prop, nil)...)
 		} else if suffixMap, ok := suffixProperties[prop.Name.Name]; ok {
 			suffixProps := w.lookupMap(prop.Value)
 			standardProps = append(standardProps, translateSuffixProperties(suffixProps, suffixMap)...)