Skip to content

Commit

Permalink
go
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiehe-google-com committed Sep 25, 2024
1 parent 2088c23 commit afdb4b7
Showing 1 changed file with 20 additions and 32 deletions.
52 changes: 20 additions & 32 deletions tools/fuchsia/fuchsia_archive.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
}
}

0 comments on commit afdb4b7

Please sign in to comment.