The androidmk supports converting "LOCAL_PROTOC_FLAGS"
LOCAL_PROTOC_FLAGS can be converted as "proto.local_include_dirs" with value "--proto_path". Bug: 314862115 Test: 1. m androidmk 2. go test Change-Id: Id4e589623ffef50c2549720b1ef828cd38a940a0
This commit is contained in:
@@ -64,6 +64,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
|
|||||||
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
||||||
"LOCAL_STRIP_MODULE": strip(),
|
"LOCAL_STRIP_MODULE": strip(),
|
||||||
"LOCAL_CFLAGS": cflags,
|
"LOCAL_CFLAGS": cflags,
|
||||||
|
"LOCAL_PROTOC_FLAGS": protoLocalIncludeDirs,
|
||||||
"LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
|
"LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
|
||||||
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
|
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
|
||||||
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
|
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
|
||||||
@@ -768,6 +769,20 @@ func protoOutputParams(ctx variableAssignmentContext) error {
|
|||||||
return includeVariableNow(bpVariable{"proto.output_params", bpparser.ListType}, ctx)
|
return includeVariableNow(bpVariable{"proto.output_params", bpparser.ListType}, ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func protoLocalIncludeDirs(ctx variableAssignmentContext) error {
|
||||||
|
// The Soong replacement for LOCAL_PROTOC_FLAGS includes "--proto_path=$(LOCAL_PATH)/..."
|
||||||
|
ctx.mkvalue = ctx.mkvalue.Clone()
|
||||||
|
if len(ctx.mkvalue.Strings) >= 1 && strings.Contains(ctx.mkvalue.Strings[0], "--proto_path=") {
|
||||||
|
ctx.mkvalue.Strings[0] = strings.Replace(ctx.mkvalue.Strings[0], "--proto_path=", "", 1)
|
||||||
|
paths, err := localizePaths(ctx)
|
||||||
|
if err == nil {
|
||||||
|
err = setVariable(ctx.file, ctx.append, ctx.prefix, "proto.local_include_dirs", paths, true)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return fmt.Errorf("Currently LOCAL_PROTOC_FLAGS only support with value '--proto_path=$(LOCAL_PATH)/...'")
|
||||||
|
}
|
||||||
|
|
||||||
func proguardEnabled(ctx variableAssignmentContext) error {
|
func proguardEnabled(ctx variableAssignmentContext) error {
|
||||||
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -1733,6 +1733,7 @@ android_test {
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := foo
|
LOCAL_MODULE := foo
|
||||||
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java, parcelable_messages=true
|
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java, parcelable_messages=true
|
||||||
|
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos
|
||||||
include $(BUILD_PACKAGE)
|
include $(BUILD_PACKAGE)
|
||||||
`,
|
`,
|
||||||
expected: `
|
expected: `
|
||||||
@@ -1743,6 +1744,7 @@ android_app {
|
|||||||
"enum_style=java",
|
"enum_style=java",
|
||||||
"parcelable_messages=true",
|
"parcelable_messages=true",
|
||||||
],
|
],
|
||||||
|
local_include_dirs: ["protos"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
Reference in New Issue
Block a user