* commit '688b4a3db72b58e8908ecdb24e6c4d64a44fdbc6': Generate DBus proxies and adaptors separately
This commit is contained in:
commit
3b27c3743e
3 changed files with 55 additions and 39 deletions
|
@ -623,46 +623,51 @@ endif # $(proto_sources) non-empty
|
|||
###########################################################
|
||||
## Compile the .dbus.xml files to c++ headers
|
||||
###########################################################
|
||||
dbus_if_sources := $(filter %.dbus.xml,$(my_src_files))
|
||||
ifneq ($(dbus_if_sources),)
|
||||
dbus_definitions := $(filter %.dbus.xml,$(my_src_files))
|
||||
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_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_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_gen_dir := $(generated_sources_dir)/dbus_bindings
|
||||
|
||||
dbus_generated_source_dependencies := \
|
||||
$(dbus_if_sources_full_path) \
|
||||
$(dbus_service_config_full_path) \
|
||||
$(DBUS_GENERATOR)
|
||||
ifdef LOCAL_DBUS_PROXY_PREFIX
|
||||
dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX)
|
||||
dbus_headers := dbus-proxies.h
|
||||
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.
|
||||
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
|
||||
$(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_adaptors_header) : PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_full_path)
|
||||
$(dbus_adaptors_header) : PRIVATE_DBUS_ADAPTORS_HEADER := $(dbus_adaptors_header)
|
||||
$(dbus_adaptors_header) : PRIVATE_DBUS_PROXIES_HEADER := $(dbus_proxies_header)
|
||||
$(dbus_adaptors_header) : PRIVATE_DBUS_METHOD_NAMES_HEADER := $(dbus_method_names_header)
|
||||
$(dbus_adaptors_header) : PRIVATE_DBUS_INTERFACE_DEFINITIONS := $(dbus_if_sources_full_path)
|
||||
$(dbus_adaptors_header) : $(dbus_generated_source_dependencies)
|
||||
$(generate-dbus-bindings)
|
||||
# These are actually generated by the above recipe, but we'd like to make the
|
||||
# dependency chain complete.
|
||||
$(dbus_proxies_header) : $(dbus_adaptors_header)
|
||||
$(dbus_method_names_header) : $(dbus_adaptors_header)
|
||||
|
||||
$(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE)
|
||||
$(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path)
|
||||
$(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR)
|
||||
ifdef LOCAL_DBUS_PROXY_PREFIX
|
||||
$(dbus_generated_headers) : $(dbus_definition_paths)
|
||||
$(generate-dbus-proxies)
|
||||
|
||||
# Auto-export the generated dbus proxy directory.
|
||||
my_export_c_include_dirs += $(dbus_gen_dir)/include
|
||||
my_c_includes += $(dbus_gen_dir)/include
|
||||
else
|
||||
$(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
|
||||
|
||||
my_generated_sources += \
|
||||
$(dbus_adaptors_header) \
|
||||
$(dbus_proxies_header) \
|
||||
$(dbus_method_names_header)
|
||||
endif # $(dbus_if_sources) non-empty
|
||||
my_generated_sources += $(dbus_generated_headers)
|
||||
|
||||
endif # $(dbus_definitions) non-empty
|
||||
|
||||
|
||||
###########################################################
|
||||
|
@ -1210,7 +1215,7 @@ $(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) $(proto_generated_headers)
|
||||
$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers)
|
||||
@echo Export includes file: $< -- $@
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
ifdef my_export_c_include_dirs
|
||||
|
|
|
@ -179,6 +179,7 @@ LOCAL_DPI_VARIANTS:=
|
|||
LOCAL_DPI_FILE_STEM:=
|
||||
LOCAL_SANITIZE:=
|
||||
LOCAL_SANITIZE_RECOVER:=
|
||||
LOCAL_DBUS_PROXY_PREFIX:=
|
||||
|
||||
# arch specific variables
|
||||
LOCAL_SRC_FILES_$(TARGET_ARCH):=
|
||||
|
|
|
@ -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
|
||||
@echo "Generating DBus bindings for $(PRIVATE_DBUS_MODULE)"
|
||||
@mkdir -p $(PRIVATE_DBUS_HEADER_DIRECTORY)
|
||||
define generate-dbus-adaptors
|
||||
@echo "Generating DBus adaptors for $(PRIVATE_MODULE)"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(DBUS_GENERATOR) \
|
||||
--service-config=$(PRIVATE_DBUS_SERVICE_CONFIG) \
|
||||
--adaptor=$(PRIVATE_DBUS_ADAPTORS_HEADER) \
|
||||
--proxy=$(PRIVATE_DBUS_PROXIES_HEADER) \
|
||||
--method-names=$(PRIVATE_DBUS_METHOD_NAMES_HEADER) \
|
||||
$(PRIVATE_DBUS_INTERFACE_DEFINITIONS)
|
||||
--adaptor=$@ \
|
||||
$<
|
||||
endef
|
||||
|
||||
######################################################################
|
||||
## 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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue