Merge "Support converting LOCAL_PROTO_JAVA_OUTPUT_PARAMS" into main

This commit is contained in:
Treehugger Robot 2024-01-16 02:34:12 +00:00 committed by Gerrit Code Review
commit e317b15cea
2 changed files with 28 additions and 0 deletions

View file

@ -64,6 +64,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
"LOCAL_STRIP_MODULE": strip(),
"LOCAL_CFLAGS": cflags,
"LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
"LOCAL_MODULE_PATH": prebuiltModulePath,
@ -760,6 +761,13 @@ func cflags(ctx variableAssignmentContext) error {
return includeVariableNow(bpVariable{"cflags", bpparser.ListType}, ctx)
}
func protoOutputParams(ctx variableAssignmentContext) error {
// The Soong replacement for LOCAL_PROTO_JAVA_OUTPUT_PARAMS doesn't need ","
ctx.mkvalue = ctx.mkvalue.Clone()
ctx.mkvalue.ReplaceLiteral(`, `, ` `)
return includeVariableNow(bpVariable{"proto.output_params", bpparser.ListType}, ctx)
}
func proguardEnabled(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {

View file

@ -1725,6 +1725,26 @@ android_test {
name: "foo",
test_suites: ["bar"],
}
`,
},
{
desc: "LOCAL_PROTO_JAVA_OUTPUT_PARAMS",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java, parcelable_messages=true
include $(BUILD_PACKAGE)
`,
expected: `
android_app {
name: "foo",
proto: {
output_params: [
"enum_style=java",
"parcelable_messages=true",
],
},
}
`,
},
}