Add streaming proto option to the build system.

Test: make w/ other prereq changes
Change-Id: Ie8711878e244074a9a3c128467eeb4908c2ef008
This commit is contained in:
Joe Onorato 2016-10-05 18:01:10 -07:00
parent 7261bca1cf
commit c05a8eec4b
4 changed files with 18 additions and 3 deletions

View File

@ -145,7 +145,7 @@ LOCAL_RENDERSCRIPT_TARGET_API:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
LOCAL_DEX_PREOPT_FLAGS:=
LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,stream,full,nanopb-c,nanopb-c-enable_malloc
LOCAL_PROTOC_FLAGS:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
LOCAL_VTSC_FLAGS:=

View File

@ -1150,6 +1150,7 @@ endef
###########################################################
## Commands for running protoc to compile .proto into .java
###########################################################
# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
define transform-proto-to-java
@mkdir -p $(dir $@)
@ -1157,6 +1158,7 @@ define transform-proto-to-java
@rm -rf $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
@mkdir -p $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
$(hide) for f in $(PRIVATE_PROTO_SRC_FILES); do \
PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
$(PROTOC) \
$(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
$(PRIVATE_PROTO_JAVA_OUTPUT_OPTION)="$(PRIVATE_PROTO_JAVA_OUTPUT_PARAMS):$(PRIVATE_PROTO_JAVA_OUTPUT_DIR)" \
@ -1169,10 +1171,14 @@ endef
######################################################################
## Commands for running protoc to compile .proto into .pb.cc (or.pb.c) and .pb.h
######################################################################
# PATH contains HOST_OUT_EXECUTABLES to allow protoc-gen-* plugins
define transform-proto-to-cc
@echo "Protoc: $@ <= $<"
@mkdir -p $(dir $@)
$(hide) $(PROTOC) \
$(hide) \
PATH=$$PATH:$(HOST_OUT_EXECUTABLES) \
$(PROTOC) \
$(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
$(PRIVATE_PROTOC_FLAGS) \
$<

View File

@ -67,7 +67,11 @@ else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
else
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
# No library for stream protobufs
else
LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
endif
endif
endif
endif

View File

@ -54,7 +54,12 @@ else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out
$(proto_java_sources_file_stamp): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
else
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
endif
endif
endif
$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)