| # Copyright 2023 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/dist/renamed_binary.gni") |
| import("config.gni") |
| |
| # An ICU-aware renamed_binary. |
| # |
| # All renamed_binary args are forwarded. |
| template("icu_renamed_binary") { |
| assert(defined(invoker.source)) |
| assert(defined(invoker.dest)) |
| |
| # Generate one renamed binary per each flavor. |
| foreach(icu_flavor, icu_flavors) { |
| renamed_binary( |
| "${target_name}.icu_${icu_flavor.name}_${icu_flavor.commit_id}") { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "visibility", |
| "testonly", |
| "icu_source_deps", |
| ]) |
| forward_variables_from(invoker, |
| [ |
| "visibility", |
| "testonly", |
| ]) |
| |
| source = |
| "${invoker.source}.icu_${icu_flavor.name}_${icu_flavor.commit_id}" |
| dest = invoker.dest |
| |
| # Generate fixed-up deps labels. |
| source_deps = [] |
| if (defined(invoker.icu_source_deps)) { |
| foreach(icu_source_dep, invoker.icu_source_deps) { |
| _relabel = get_label_info(icu_source_dep, "label_no_toolchain") |
| source_deps += [ "${_relabel}.icu_${icu_flavor.name}_${icu_flavor.commit_id}(${current_toolchain})" ] |
| } |
| } |
| } |
| } |
| |
| # Generate an unmodofied target. |
| renamed_binary("${target_name}") { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "visibility", |
| "testonly", |
| "icu_source_deps", |
| ]) |
| forward_variables_from(invoker, |
| [ |
| "visibility", |
| "testonly", |
| ]) |
| source = invoker.source |
| dest = invoker.dest |
| source_deps = [] |
| if (defined(invoker.icu_source_deps)) { |
| source_deps += invoker.icu_source_deps |
| } |
| } |
| } |