diff --git a/tools/fuchsia/fuchsia_archive.gni b/tools/fuchsia/fuchsia_archive.gni index d18a4c9ec8043..9edc2e392dfac 100644 --- a/tools/fuchsia/fuchsia_archive.gni +++ b/tools/fuchsia/fuchsia_archive.gni @@ -5,6 +5,7 @@ import("//flutter/tools/fuchsia/fuchsia_debug_symbols.gni") import("//flutter/tools/fuchsia/fuchsia_libs.gni") import("//flutter/tools/fuchsia/gn-sdk/src/cmc.gni") +import("//flutter/tools/fuchsia/gn-sdk/src/component.gni") import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni") # Alias of cmc_compile in gn-sdk/src/cmc.gni @@ -231,16 +232,7 @@ template("fuchsia_archive") { # Files that should be placed into the `data/` directory of the archive. template("fuchsia_test_archive") { assert(defined(invoker.deps), "package must define deps") - if (!defined(invoker.binary)) { - _binary = target_name - } else { - _binary = invoker.binary - } - _deps = [] - if (defined(invoker.deps)) { - _deps += invoker.deps - } - + _deps = invoker.deps _generated_cml = defined(invoker.gen_cml_file) && invoker.gen_cml_file if (_generated_cml) { _cml_file = "$root_out_dir/${target_name}.cml" @@ -259,36 +251,32 @@ template("fuchsia_test_archive") { ] outputs = [ _cml_file ] } + _deps += [ ":$_interpolate_cml_target" ] } else { + if (defined(invoker.binary)) { + _binary = invoker.binary + } else { + _binary = target_name + } _cml_file = rebase_path("meta/${_binary}.cml") } - _far_base_dir = "$root_out_dir/${target_name}_far" - _cml_file_name = get_path_info(_cml_file, "name") - _compile_cml_target = "${target_name}_${_cml_file_name}_compile_cml" - - _compile_cml(_compile_cml_target) { + fuchsia_component(target_name) { + forward_variables_from(invoker, [ "resources" ]) testonly = true - manifest = _cml_file - output = "$_far_base_dir/meta/${_cml_file_name}.cm" - - if (_generated_cml) { - deps = [ ":$_interpolate_cml_target" ] - } - } - _deps += [ ":$_compile_cml_target" ] - - _fuchsia_archive(target_name) { - testonly = true - binary = _binary - forward_variables_from(invoker, [ "resources" ]) + deps = _deps - libraries = common_libs + data = [] + _libs = common_libs if (defined(invoker.libraries)) { - libraries += invoker.libraries + _libs += invoker.libraries + } + foreach(lib, _libs) { + data += [ "${lib.path}/${lib.name}" ] + } + if (defined(invoker.binary)) { + data += [ invoker.binary ] } - - deps = _deps } }