| # Copyright 2018 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| # TODO(crbug.com/983008): Unify build rule of generate_dbus_proxies and | |
| # generate_dbus_adaptors for easy to maintain. | |
| template("generate_dbus_adaptors") { | |
| forward_variables_from(invoker, | |
| [ | |
| "dbus_adaptors_out_dir", | |
| "dbus_service_config", | |
| ]) | |
| h_dir = "${root_gen_dir}/${dbus_adaptors_out_dir}" | |
| if (!defined(dbus_service_config) || dbus_service_config == "") { | |
| service_config = "" | |
| } else { | |
| service_config = rebase_path(dbus_service_config) | |
| } | |
| # TODO(crbug.com/983008): Use action to simplify the bindings by unifying | |
| # with proxy generator. | |
| action_foreach(target_name) { | |
| sources = invoker.sources | |
| inputs = [ "/usr/bin/go-generate-chromeos-dbus-bindings" ] | |
| script = "//common-mk/file_generator_wrapper.py" | |
| outputs = [ "${h_dir}/{{source_name_part}}.h" ] | |
| args = [ | |
| "go-generate-chromeos-dbus-bindings", | |
| "-adaptor=${h_dir}/{{source_name_part}}.h", | |
| "-service-config=${service_config}", | |
| ] | |
| # Note: the feature is not yet completely working yet. Investigation | |
| # is on-going. | |
| if (defined(invoker.use_adaptor_method) && invoker.use_adaptor_method) { | |
| args += [ "-use-adaptor-method" ] | |
| } | |
| args += [ "{{source}}" ] | |
| } | |
| } |