OSDN Git Service

Fix race in C++ AIDL file generation
authorChristopher Wiley <wiley@google.com>
Thu, 19 Nov 2015 21:52:15 +0000 (13:52 -0800)
committerChristopher Wiley <wiley@google.com>
Thu, 19 Nov 2015 21:52:15 +0000 (13:52 -0800)
The export_includes file for a library needs to express a dependency on
all generated exported headers.  For aidl generated headers, express a
dependency on the .cpp file instead, since the generator promises to
generate this file last.  Unfortunately, the C++ headers generated from
a .aidl file depend on the contents of the file.

Change-Id: I9402b364e4538b502c0958ac8c7bd72cb0add724

core/binary.mk

index 4e52e35..028950a 100644 (file)
@@ -1302,7 +1302,10 @@ $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
 export_includes := $(intermediates)/export_includes
 $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs)
 # Make sure .pb.h are already generated before any dependent source files get compiled.
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(proto_generated_headers) $(dbus_generated_headers)
+# Similarly, the generated DBus headers need to exist before we export their location.
+# People are not going to consume the aidl generated cpp file, but the cpp file is
+# generated after the headers, so this is a convenient way to ensure the headers exist.
+$(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) $(proto_generated_headers) $(dbus_generated_headers) $(aidl_gen_cpp)
        @echo Export includes file: $< -- $@
        $(hide) mkdir -p $(dir $@) && rm -f $@
 ifdef my_export_c_include_dirs