When compiling with the lite protobuf option, pass the option to aprotoc to force the lite runtime.
With LOCAL_PROTO_OPTIMIZE_TYPE set to one of the lite variants, the build system thinks the proto should be compiled with lite, and will link in the line runtime libs. But if the .proto files don't contain the directive to compile the source as lite (option optimize_for = LITE_RUNTIME;), then the generated code will be full and the libraries will be full, and it won't link. Test: make Merged-In: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42 Change-Id: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42
This commit is contained in:
parent
577d9eddc0
commit
3de3a74659
2 changed files with 8 additions and 2 deletions
|
@ -870,6 +870,9 @@ endif
|
|||
###########################################################
|
||||
## Compile the .proto files to .cc (or .c) and then to .o
|
||||
###########################################################
|
||||
ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
|
||||
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
|
||||
endif
|
||||
proto_sources := $(filter %.proto,$(my_src_files))
|
||||
ifneq ($(proto_sources),)
|
||||
proto_gen_dir := $(generated_sources_dir)/proto
|
||||
|
@ -891,7 +894,7 @@ my_rename_cpp_ext := true
|
|||
endif
|
||||
my_proto_c_includes := external/protobuf/src
|
||||
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
|
||||
my_protoc_flags := --cpp_out=$(proto_gen_dir)
|
||||
my_protoc_flags := --cpp_out=$(if $(filter lite lite-static,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite:,)$(proto_gen_dir)
|
||||
my_protoc_deps :=
|
||||
endif
|
||||
my_proto_c_includes += $(proto_gen_dir)
|
||||
|
|
|
@ -38,6 +38,9 @@ LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_
|
|||
###########################################################
|
||||
## .proto files: Compile proto files to .java
|
||||
###########################################################
|
||||
ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
|
||||
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
|
||||
endif
|
||||
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
|
||||
# Because names of the .java files compiled from .proto files are unknown until the
|
||||
# .proto files are compiled, we use a timestamp file as depedency.
|
||||
|
@ -67,7 +70,7 @@ $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
|
|||
endif
|
||||
endif
|
||||
$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
|
||||
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
|
||||
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
|
||||
$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
|
||||
$(call transform-proto-to-java)
|
||||
|
||||
|
|
Loading…
Reference in a new issue