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
This commit is contained in:
Colin Cross
2017-11-14 13:11:23 -08:00
parent f18e11074d
commit d5dbfb78a0
2 changed files with 8 additions and 3 deletions

View File

@@ -186,7 +186,7 @@ type javaBuilderFlags struct {
kotlincFlags string kotlincFlags string
kotlincClasspath classpath kotlincClasspath classpath
protoFlags string protoFlags []string
protoOutFlag string protoOutFlag string
} }

View File

@@ -15,6 +15,8 @@
package java package java
import ( import (
"strings"
"github.com/google/blueprint" "github.com/google/blueprint"
"github.com/google/blueprint/proptools" "github.com/google/blueprint/proptools"
@@ -39,7 +41,7 @@ var (
) )
func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath, 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{ ctx.Build(pctx, android.BuildParams{
Rule: proto, Rule: proto,
@@ -50,7 +52,7 @@ func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
"outDir": android.ProtoDir(ctx).String(), "outDir": android.ProtoDir(ctx).String(),
"protoOut": protoOut, "protoOut": protoOut,
"protoOutFlags": protoOutFlags, "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", ctx.PropertyErrorf("proto.type", "unknown proto type %q",
proptools.String(p.Proto.Type)) proptools.String(p.Proto.Type))
} }
flags.protoFlags = android.ProtoFlags(ctx, p)
return flags return flags
} }