| # 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("config.gni") |
| |
| # An ICU-aware group. |
| # |
| # All args are forwarded verbatim from "group". |
| template("icu_group") { |
| foreach(icu_flavor, icu_flavors) { |
| group("${target_name}.icu_${icu_flavor.name}_${icu_flavor.commit_id}") { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "visibility", |
| "testonly", |
| "icu_deps", |
| "icu_public_deps", |
| ]) |
| forward_variables_from(invoker, |
| [ |
| "visibility", |
| "testonly", |
| ]) |
| |
| # Ensure that we preserve the toolchain when adding dependencies. |
| not_needed([ "icu_flavor" ]) |
| |
| if (defined(invoker.icu_deps)) { |
| if (!defined(deps)) { |
| deps = [] |
| } |
| |
| foreach(icu_dep, invoker.icu_deps) { |
| # Fully resolve labels like "//foo/bar" to "//foo/bar:bar", so that |
| # ICU fixup doesn't change the leaf directory name. |
| _relabel = get_label_info(icu_dep, "label_no_toolchain") |
| deps += [ "${_relabel}.icu_${icu_flavor.name}_${icu_flavor.commit_id}(${current_toolchain})" ] |
| } |
| } |
| |
| # Similar to above, but for public_deps. |
| if (defined(invoker.icu_public_deps)) { |
| if (!defined(public_deps)) { |
| public_deps = [] |
| } |
| |
| foreach(icu_public_dep, invoker.icu_public_deps) { |
| _relabel = get_label_info(icu_public_dep, "label_no_toolchain") |
| public_deps += [ "${_relabel}.icu_${icu_flavor.name}_${icu_flavor.commit_id}(${current_toolchain})" ] |
| } |
| } |
| } |
| } |
| |
| # The original source set, with the original target name. |
| group(target_name) { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "visibility", |
| "testonly", |
| "icu_deps", |
| "icu_public_deps", |
| ]) |
| forward_variables_from(invoker, |
| [ |
| "visibility", |
| "testonly", |
| ]) |
| |
| if (defined(invoker.icu_deps)) { |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += invoker.icu_deps |
| } |
| if (defined(invoker.icu_public_deps)) { |
| if (!defined(public_deps)) { |
| public_deps = [] |
| } |
| public_deps += invoker.icu_public_deps |
| } |
| } |
| } |