Merge "The androidmk supports converting "LOCAL_PROTOC_FLAGS"" into main
This commit is contained in:
commit
3b21c9cadd
2 changed files with 17 additions and 0 deletions
|
@ -64,6 +64,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
|
|||
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
||||
"LOCAL_STRIP_MODULE": strip(),
|
||||
"LOCAL_CFLAGS": cflags,
|
||||
"LOCAL_PROTOC_FLAGS": protoLocalIncludeDirs,
|
||||
"LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
|
||||
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
|
||||
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
|
||||
|
@ -768,6 +769,20 @@ func protoOutputParams(ctx variableAssignmentContext) error {
|
|||
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 {
|
||||
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
|
||||
if err != nil {
|
||||
|
|
|
@ -1733,6 +1733,7 @@ android_test {
|
|||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := foo
|
||||
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java, parcelable_messages=true
|
||||
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos
|
||||
include $(BUILD_PACKAGE)
|
||||
`,
|
||||
expected: `
|
||||
|
@ -1743,6 +1744,7 @@ android_app {
|
|||
"enum_style=java",
|
||||
"parcelable_messages=true",
|
||||
],
|
||||
local_include_dirs: ["protos"],
|
||||
},
|
||||
}
|
||||
`,
|
||||
|
|
Loading…
Reference in a new issue