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:
Joe Onorato
2017-11-18 18:23:14 -08:00
parent bf606c198b
commit 09e94ab074
8 changed files with 76 additions and 62 deletions

View File

@@ -16,6 +16,7 @@ package cc
import (
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
@@ -27,15 +28,15 @@ func init() {
var (
proto = pctx.AndroidStaticRule("protoc",
blueprint.RuleParams{
Command: "$protocCmd --cpp_out=$outDir $protoFlags $in",
Command: "$protocCmd --cpp_out=$protoOutParams:$outDir $protoFlags $in",
CommandDeps: []string{"$protocCmd"},
}, "protoFlags", "outDir")
}, "protoFlags", "protoOutParams", "outDir")
)
// genProto creates a rule to convert a .proto file to generated .pb.cc and .pb.h files and returns
// the paths to the generated files.
func genProto(ctx android.ModuleContext, protoFile android.Path,
protoFlags string) (ccFile, headerFile android.WritablePath) {
protoFlags string, protoOutParams string) (ccFile, headerFile android.WritablePath) {
ccFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.cc")
headerFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.h")
@@ -46,8 +47,9 @@ func genProto(ctx android.ModuleContext, protoFile android.Path,
Outputs: android.WritablePaths{ccFile, headerFile},
Input: protoFile,
Args: map[string]string{
"outDir": android.ProtoDir(ctx).String(),
"protoFlags": protoFlags,
"outDir": android.ProtoDir(ctx).String(),
"protoFlags": protoFlags,
"protoOutParams": protoOutParams,
},
})
@@ -97,5 +99,9 @@ func protoFlags(ctx ModuleContext, flags Flags, p *android.ProtoProperties) Flag
flags.protoFlags = android.ProtoFlags(ctx, p)
if proptools.String(p.Proto.Type) == "lite" {
flags.protoOutParams = []string{"lite"}
}
return flags
}