When compiling with the lite protobuf option, pass the option to aprotoc to force the lite runtime.
Test: make Merged-In: I450f89d144d496a6ddfccc6a6a5a679a05809595 Change-Id: I450f89d144d496a6ddfccc6a6a5a679a05809595
This commit is contained in:
@@ -31,17 +31,17 @@ var (
|
||||
proto = pctx.AndroidStaticRule("protoc",
|
||||
blueprint.RuleParams{
|
||||
Command: `rm -rf $outDir && mkdir -p $outDir && ` +
|
||||
`$protocCmd $protoOut=$protoOutFlags:$outDir $protoFlags $in && ` +
|
||||
`$protocCmd $protoOut=$protoOutParams:$outDir $protoFlags $in && ` +
|
||||
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
||||
CommandDeps: []string{
|
||||
"$protocCmd",
|
||||
"${config.SoongZipCmd}",
|
||||
},
|
||||
}, "protoFlags", "protoOut", "protoOutFlags", "outDir")
|
||||
}, "protoFlags", "protoOut", "protoOutParams", "outDir")
|
||||
)
|
||||
|
||||
func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
|
||||
protoFiles android.Paths, protoFlags []string, protoOut, protoOutFlags string) {
|
||||
protoFiles android.Paths, protoFlags []string, protoOut, protoOutParams string) {
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: proto,
|
||||
@@ -49,10 +49,10 @@ func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
|
||||
Output: outputSrcJar,
|
||||
Inputs: protoFiles,
|
||||
Args: map[string]string{
|
||||
"outDir": android.ProtoDir(ctx).String(),
|
||||
"protoOut": protoOut,
|
||||
"protoOutFlags": protoOutFlags,
|
||||
"protoFlags": strings.Join(protoFlags, " "),
|
||||
"outDir": android.ProtoDir(ctx).String(),
|
||||
"protoOut": protoOut,
|
||||
"protoOutParams": protoOutParams,
|
||||
"protoFlags": strings.Join(protoFlags, " "),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -80,11 +80,14 @@ func protoDeps(ctx android.BottomUpMutatorContext, p *android.ProtoProperties) {
|
||||
func protoFlags(ctx android.ModuleContext, p *android.ProtoProperties, flags javaBuilderFlags) javaBuilderFlags {
|
||||
switch proptools.String(p.Proto.Type) {
|
||||
case "micro":
|
||||
flags.protoOutFlag = "--javamicro_out"
|
||||
flags.protoOutTypeFlag = "--javamicro_out"
|
||||
case "nano":
|
||||
flags.protoOutFlag = "--javanano_out"
|
||||
case "lite", "full", "":
|
||||
flags.protoOutFlag = "--java_out"
|
||||
flags.protoOutTypeFlag = "--javanano_out"
|
||||
case "lite":
|
||||
flags.protoOutTypeFlag = "--java_out"
|
||||
flags.protoOutParams = "lite"
|
||||
case "full", "":
|
||||
flags.protoOutTypeFlag = "--java_out"
|
||||
default:
|
||||
ctx.PropertyErrorf("proto.type", "unknown proto type %q",
|
||||
proptools.String(p.Proto.Type))
|
||||
|
Reference in New Issue
Block a user