Merge "Support output params in java proto"

This commit is contained in:
Treehugger Robot 2017-12-16 01:32:32 +00:00 committed by Gerrit Code Review
commit 04bd5080bf
2 changed files with 16 additions and 2 deletions

View File

@ -142,6 +142,11 @@ type CompilerProperties struct {
Exclude_filter []string
}
Proto struct {
// List of extra options that will be passed to the proto generator.
Output_params []string
}
Instrument bool `blueprint:"mutated"`
}
@ -620,7 +625,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
}
srcFiles := ctx.ExpandSources(j.properties.Srcs, j.properties.Exclude_srcs)
if hasSrcExt(srcFiles.Strings(), ".proto") {
flags = protoFlags(ctx, &j.protoProperties, flags)
flags = protoFlags(ctx, &j.properties, &j.protoProperties, flags)
}
srcFiles = j.genSources(ctx, srcFiles, flags)

View File

@ -77,7 +77,9 @@ func protoDeps(ctx android.BottomUpMutatorContext, p *android.ProtoProperties) {
}
}
func protoFlags(ctx android.ModuleContext, p *android.ProtoProperties, flags javaBuilderFlags) javaBuilderFlags {
func protoFlags(ctx android.ModuleContext, j *CompilerProperties, p *android.ProtoProperties,
flags javaBuilderFlags) javaBuilderFlags {
switch proptools.String(p.Proto.Type) {
case "micro":
flags.protoOutTypeFlag = "--javamicro_out"
@ -93,6 +95,13 @@ func protoFlags(ctx android.ModuleContext, p *android.ProtoProperties, flags jav
proptools.String(p.Proto.Type))
}
if len(j.Proto.Output_params) > 0 {
if flags.protoOutParams != "" {
flags.protoOutParams += ","
}
flags.protoOutParams += strings.Join(j.Proto.Output_params, ",")
}
flags.protoFlags = android.ProtoFlags(ctx, p)
return flags