From d5dbfb78a0f30f0b3ee43a514e4f59206c203458 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 14 Nov 2017 13:11:23 -0800 Subject: [PATCH] Fix proto flags in java Compute the common proto flags and pass them to the protoc invocation when generating java files. Test: m checkbuild Change-Id: I0d4c23ad001d01eab03b404545383f009214106d --- java/builder.go | 2 +- java/proto.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java/builder.go b/java/builder.go index 45e59a426..d2e02fde1 100644 --- a/java/builder.go +++ b/java/builder.go @@ -186,7 +186,7 @@ type javaBuilderFlags struct { kotlincFlags string kotlincClasspath classpath - protoFlags string + protoFlags []string protoOutFlag string } diff --git a/java/proto.go b/java/proto.go index 1077fd69b..eeb5124d9 100644 --- a/java/proto.go +++ b/java/proto.go @@ -15,6 +15,8 @@ package java import ( + "strings" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" @@ -39,7 +41,7 @@ var ( ) func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath, - protoFiles android.Paths, protoFlags string, protoOut, protoOutFlags string) { + protoFiles android.Paths, protoFlags []string, protoOut, protoOutFlags string) { ctx.Build(pctx, android.BuildParams{ Rule: proto, @@ -50,7 +52,7 @@ func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath, "outDir": android.ProtoDir(ctx).String(), "protoOut": protoOut, "protoOutFlags": protoOutFlags, - "protoFlags": protoFlags, + "protoFlags": strings.Join(protoFlags, " "), }, }) } @@ -93,5 +95,8 @@ func protoFlags(ctx android.ModuleContext, p *android.ProtoProperties, flags jav ctx.PropertyErrorf("proto.type", "unknown proto type %q", proptools.String(p.Proto.Type)) } + + flags.protoFlags = android.ProtoFlags(ctx, p) + return flags }