am 688b4a3d: am 4d2b79f9: Merge "Generate DBus proxies and adaptors separately"

* commit '688b4a3db72b58e8908ecdb24e6c4d64a44fdbc6':
  Generate DBus proxies and adaptors separately
This commit is contained in:
Christopher Wiley 2015-08-19 22:20:23 +00:00 committed by Android Git Automerger
commit 3b27c3743e
3 changed files with 55 additions and 39 deletions

View file

@ -623,46 +623,51 @@ endif # $(proto_sources) non-empty
########################################################### ###########################################################
## Compile the .dbus.xml files to c++ headers ## Compile the .dbus.xml files to c++ headers
########################################################### ###########################################################
dbus_if_sources := $(filter %.dbus.xml,$(my_src_files)) dbus_definitions := $(filter %.dbus.xml,$(my_src_files))
ifneq ($(dbus_if_sources),) dbus_generated_headers :=
ifneq ($(dbus_definitions),)
dbus_if_sources_full_path := $(addprefix $(LOCAL_PATH)/,$(dbus_if_sources)) dbus_definition_paths := $(addprefix $(LOCAL_PATH)/,$(dbus_definitions))
dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files)) dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files))
dbus_service_config_full_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config)) dbus_service_config_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config))
dbus_header_prefix := $(generated_sources_dir)/dbus_bindings dbus_gen_dir := $(generated_sources_dir)/dbus_bindings
dbus_adaptors_header := $(dbus_header_prefix)/adaptors.h
dbus_proxies_header := $(dbus_header_prefix)/proxies.h
dbus_method_names_header := $(dbus_header_prefix)/method_names.h
dbus_generated_source_dependencies := \ ifdef LOCAL_DBUS_PROXY_PREFIX
$(dbus_if_sources_full_path) \ dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX)
$(dbus_service_config_full_path) \ dbus_headers := dbus-proxies.h
$(DBUS_GENERATOR) else
dbus_header_dir := $(dbus_gen_dir)
dbus_headers := $(patsubst %.dbus.xml,%.h,$(dbus_definitions))
endif
dbus_generated_headers := $(addprefix $(dbus_header_dir)/,$(dbus_headers))
# Ensure that we only define build rules once in multilib builds. # Ensure that we only define build rules once in multilib builds.
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true
$(dbus_adaptors_header) : PRIVATE_DBUS_MODULE := $(LOCAL_MODULE)
$(dbus_adaptors_header) : PRIVATE_DBUS_HEADER_DIRECTORY := $(dbus_header_prefix) $(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE)
$(dbus_adaptors_header) : PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_full_path) $(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path)
$(dbus_adaptors_header) : PRIVATE_DBUS_ADAPTORS_HEADER := $(dbus_adaptors_header) $(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR)
$(dbus_adaptors_header) : PRIVATE_DBUS_PROXIES_HEADER := $(dbus_proxies_header) ifdef LOCAL_DBUS_PROXY_PREFIX
$(dbus_adaptors_header) : PRIVATE_DBUS_METHOD_NAMES_HEADER := $(dbus_method_names_header) $(dbus_generated_headers) : $(dbus_definition_paths)
$(dbus_adaptors_header) : PRIVATE_DBUS_INTERFACE_DEFINITIONS := $(dbus_if_sources_full_path) $(generate-dbus-proxies)
$(dbus_adaptors_header) : $(dbus_generated_source_dependencies)
$(generate-dbus-bindings) # Auto-export the generated dbus proxy directory.
# These are actually generated by the above recipe, but we'd like to make the my_export_c_include_dirs += $(dbus_gen_dir)/include
# dependency chain complete. my_c_includes += $(dbus_gen_dir)/include
$(dbus_proxies_header) : $(dbus_adaptors_header) else
$(dbus_method_names_header) : $(dbus_adaptors_header) $(dbus_generated_headers) : $(dbus_header_dir)/%.h : $(LOCAL_PATH)/%.dbus.xml
$(generate-dbus-adaptors)
my_export_c_include_dirs += $(dbus_header_dir)
my_c_includes += $(dbus_header_dir)
endif # $(LOCAL_DBUS_PROXY_PREFIX)
endif # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined endif # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
my_generated_sources += \ my_generated_sources += $(dbus_generated_headers)
$(dbus_adaptors_header) \
$(dbus_proxies_header) \ endif # $(dbus_definitions) non-empty
$(dbus_method_names_header)
endif # $(dbus_if_sources) non-empty
########################################################### ###########################################################
@ -1210,7 +1215,7 @@ $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
export_includes := $(intermediates)/export_includes export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs) $(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. # Make sure .pb.h are already generated before any dependent source files get compiled.
$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers)
@echo Export includes file: $< -- $@ @echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@ $(hide) mkdir -p $(dir $@) && rm -f $@
ifdef my_export_c_include_dirs ifdef my_export_c_include_dirs

View file

@ -179,6 +179,7 @@ LOCAL_DPI_VARIANTS:=
LOCAL_DPI_FILE_STEM:= LOCAL_DPI_FILE_STEM:=
LOCAL_SANITIZE:= LOCAL_SANITIZE:=
LOCAL_SANITIZE_RECOVER:= LOCAL_SANITIZE_RECOVER:=
LOCAL_DBUS_PROXY_PREFIX:=
# arch specific variables # arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):= LOCAL_SRC_FILES_$(TARGET_ARCH):=

View file

@ -970,17 +970,27 @@ endef
###################################################################### ######################################################################
## Commands for running protoc to compile .proto into .pb.cc and .pb.h ## Commands for generating DBus adaptors from .dbus.xml files.
###################################################################### ######################################################################
define generate-dbus-bindings define generate-dbus-adaptors
@echo "Generating DBus bindings for $(PRIVATE_DBUS_MODULE)" @echo "Generating DBus adaptors for $(PRIVATE_MODULE)"
@mkdir -p $(PRIVATE_DBUS_HEADER_DIRECTORY) @mkdir -p $(dir $@)
$(hide) $(DBUS_GENERATOR) \ $(hide) $(DBUS_GENERATOR) \
--service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \ --service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \
--adaptor=$(PRIVATE_DBUS_ADAPTORS_HEADER) \ --adaptor=$@ \
--proxy=$(PRIVATE_DBUS_PROXIES_HEADER) \ $<
--method-names=$(PRIVATE_DBUS_METHOD_NAMES_HEADER) \ endef
$(PRIVATE_DBUS_INTERFACE_DEFINITIONS)
######################################################################
## Commands for generating DBus proxies from .dbus.xml files.
######################################################################
define generate-dbus-proxies
@echo "Generating DBus proxies for $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) $(DBUS_GENERATOR) \
--service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \
--proxy=$@ \
$<
endef endef