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:
@@ -231,27 +231,28 @@ func init() {
|
||||
}
|
||||
|
||||
type builderFlags struct {
|
||||
globalFlags string
|
||||
arFlags string
|
||||
asFlags string
|
||||
cFlags string
|
||||
toolingCFlags string // A separate set of Cflags for clang LibTooling tools
|
||||
conlyFlags string
|
||||
cppFlags string
|
||||
ldFlags string
|
||||
libFlags string
|
||||
yaccFlags string
|
||||
protoFlags string
|
||||
tidyFlags string
|
||||
sAbiFlags string
|
||||
yasmFlags string
|
||||
aidlFlags string
|
||||
rsFlags string
|
||||
toolchain config.Toolchain
|
||||
clang bool
|
||||
tidy bool
|
||||
coverage bool
|
||||
sAbiDump bool
|
||||
globalFlags string
|
||||
arFlags string
|
||||
asFlags string
|
||||
cFlags string
|
||||
toolingCFlags string // A separate set of Cflags for clang LibTooling tools
|
||||
conlyFlags string
|
||||
cppFlags string
|
||||
ldFlags string
|
||||
libFlags string
|
||||
yaccFlags string
|
||||
protoFlags string
|
||||
protoOutParams string
|
||||
tidyFlags string
|
||||
sAbiFlags string
|
||||
yasmFlags string
|
||||
aidlFlags string
|
||||
rsFlags string
|
||||
toolchain config.Toolchain
|
||||
clang bool
|
||||
tidy bool
|
||||
coverage bool
|
||||
sAbiDump bool
|
||||
|
||||
systemIncludeFlags string
|
||||
|
||||
|
1
cc/cc.go
1
cc/cc.go
@@ -116,6 +116,7 @@ type Flags struct {
|
||||
ToolingCppFlags []string // Flags that apply to C++ source files parsed by clang LibTooling tools
|
||||
YaccFlags []string // Flags that apply to Yacc source files
|
||||
protoFlags []string // Flags that apply to proto source files
|
||||
protoOutParams []string // Flags that modify the output of proto generated files
|
||||
aidlFlags []string // Flags that apply to aidl source files
|
||||
rsFlags []string // Flags that apply to renderscript source files
|
||||
LdFlags []string // Flags that apply to linker command lines
|
||||
|
@@ -153,7 +153,8 @@ func genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
||||
srcFiles[i] = cppFile
|
||||
genLex(ctx, srcFile, cppFile)
|
||||
case ".proto":
|
||||
ccFile, headerFile := genProto(ctx, srcFile, buildFlags.protoFlags)
|
||||
ccFile, headerFile := genProto(ctx, srcFile, buildFlags.protoFlags,
|
||||
buildFlags.protoOutParams)
|
||||
srcFiles[i] = ccFile
|
||||
deps = append(deps, headerFile)
|
||||
case ".aidl":
|
||||
|
16
cc/proto.go
16
cc/proto.go
@@ -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
|
||||
}
|
||||
|
43
cc/util.go
43
cc/util.go
@@ -97,27 +97,28 @@ func moduleToLibName(module string) (string, error) {
|
||||
|
||||
func flagsToBuilderFlags(in Flags) builderFlags {
|
||||
return builderFlags{
|
||||
globalFlags: strings.Join(in.GlobalFlags, " "),
|
||||
arFlags: strings.Join(in.ArFlags, " "),
|
||||
asFlags: strings.Join(in.AsFlags, " "),
|
||||
cFlags: strings.Join(in.CFlags, " "),
|
||||
toolingCFlags: strings.Join(in.ToolingCFlags, " "),
|
||||
conlyFlags: strings.Join(in.ConlyFlags, " "),
|
||||
cppFlags: strings.Join(in.CppFlags, " "),
|
||||
yaccFlags: strings.Join(in.YaccFlags, " "),
|
||||
protoFlags: strings.Join(in.protoFlags, " "),
|
||||
aidlFlags: strings.Join(in.aidlFlags, " "),
|
||||
rsFlags: strings.Join(in.rsFlags, " "),
|
||||
ldFlags: strings.Join(in.LdFlags, " "),
|
||||
libFlags: strings.Join(in.libFlags, " "),
|
||||
tidyFlags: strings.Join(in.TidyFlags, " "),
|
||||
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
||||
yasmFlags: strings.Join(in.YasmFlags, " "),
|
||||
toolchain: in.Toolchain,
|
||||
clang: in.Clang,
|
||||
coverage: in.Coverage,
|
||||
tidy: in.Tidy,
|
||||
sAbiDump: in.SAbiDump,
|
||||
globalFlags: strings.Join(in.GlobalFlags, " "),
|
||||
arFlags: strings.Join(in.ArFlags, " "),
|
||||
asFlags: strings.Join(in.AsFlags, " "),
|
||||
cFlags: strings.Join(in.CFlags, " "),
|
||||
toolingCFlags: strings.Join(in.ToolingCFlags, " "),
|
||||
conlyFlags: strings.Join(in.ConlyFlags, " "),
|
||||
cppFlags: strings.Join(in.CppFlags, " "),
|
||||
yaccFlags: strings.Join(in.YaccFlags, " "),
|
||||
protoFlags: strings.Join(in.protoFlags, " "),
|
||||
protoOutParams: strings.Join(in.protoOutParams, ":"),
|
||||
aidlFlags: strings.Join(in.aidlFlags, " "),
|
||||
rsFlags: strings.Join(in.rsFlags, " "),
|
||||
ldFlags: strings.Join(in.LdFlags, " "),
|
||||
libFlags: strings.Join(in.libFlags, " "),
|
||||
tidyFlags: strings.Join(in.TidyFlags, " "),
|
||||
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
||||
yasmFlags: strings.Join(in.YasmFlags, " "),
|
||||
toolchain: in.Toolchain,
|
||||
clang: in.Clang,
|
||||
coverage: in.Coverage,
|
||||
tidy: in.Tidy,
|
||||
sAbiDump: in.SAbiDump,
|
||||
|
||||
systemIncludeFlags: strings.Join(in.SystemIncludeFlags, " "),
|
||||
|
||||
|
Reference in New Issue
Block a user