From: Bjorn Bringert Date: Tue, 18 Oct 2011 15:08:27 +0000 (+0100) Subject: Compile each proto file separately X-Git-Tag: android-x86-4.4-r1~1517^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=20f5efd82caf038697c03daa230345cdda9ae31d;p=android-x86%2Fbuild.git Compile each proto file separately Before, if a module had several proto source files, they would all be compiled in a single invocation of aprotoc. If any of the files imported one of the other files, you got an aprotoc error about duplicates. And if you removed the files that were imported from the list of source files, no Java code would be generated for the imported files, causing a Java compile time error. This changes compiles each proto file separately, which avoids both of the problems above. It's slightly more inefficient, but aprotoc is really fast. Change-Id: I7bd8092ec2953c20269367a1c68ff84acceea3be --- diff --git a/core/definitions.mk b/core/definitions.mk index 1afc0f468..f385b745a 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -843,11 +843,13 @@ define transform-proto-to-java @echo "Protoc: $@ <= $(PRIVATE_PROTO_SRC_FILES)" @rm -rf $(PRIVATE_PROTO_JAVA_OUTPUT_DIR) @mkdir -p $(PRIVATE_PROTO_JAVA_OUTPUT_DIR) -$(hide) $(PROTOC) \ - $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \ - $(PRIVATE_PROTO_JAVA_OUTPUT_OPTION)=$(PRIVATE_PROTO_JAVA_OUTPUT_DIR) \ - $(PRIVATE_PROTOC_FLAGS) \ - $(PRIVATE_PROTO_SRC_FILES) +$(hide) for f in $(PRIVATE_PROTO_SRC_FILES); do \ + $(PROTOC) \ + $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \ + $(PRIVATE_PROTO_JAVA_OUTPUT_OPTION)=$(PRIVATE_PROTO_JAVA_OUTPUT_DIR) \ + $(PRIVATE_PROTOC_FLAGS) \ + $$f; \ + done $(hide) touch $@ endef