Support converting LOCAL_PROTO_JAVA_OUTPUT_PARAMS

LOCAL_PROTO_JAVA_OUTPUT_PARAMS can be converted as "proto.output_params"
in androidmk. The "," will be filtered out.

Bug: 314862115
Test: m androidmk
Change-Id: If784e7fd38e2b729272414afab186be027d3b225
This commit is contained in:
Herbert Xue
2024-01-10 14:52:55 +08:00
parent 1c4cc3d40e
commit 5418340dc7
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_SANITIZE_DIAG": sanitize("diag."),
"LOCAL_STRIP_MODULE": strip(), "LOCAL_STRIP_MODULE": strip(),
"LOCAL_CFLAGS": cflags, "LOCAL_CFLAGS": cflags,
"LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"), "LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
"LOCAL_PROGUARD_ENABLED": proguardEnabled, "LOCAL_PROGUARD_ENABLED": proguardEnabled,
"LOCAL_MODULE_PATH": prebuiltModulePath, "LOCAL_MODULE_PATH": prebuiltModulePath,
@@ -760,6 +761,13 @@ func cflags(ctx variableAssignmentContext) error {
return includeVariableNow(bpVariable{"cflags", bpparser.ListType}, ctx) 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 { 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 {

View File

@@ -1725,6 +1725,26 @@ android_test {
name: "foo", name: "foo",
test_suites: ["bar"], 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",
],
},
}
`, `,
}, },
} }