| # Copyright 2018 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("//tools/cmc/build/cmc.gni") |
| import("//tools/cmc/build/expect_includes.gni") |
| |
| # Prepares a cmx file for packaging |
| # |
| # Parameters |
| # |
| # manifest (required) |
| # [file] The cmx file |
| # |
| # output_name (optional) |
| # [path] Name for the output. |
| # If not specified, the target name is used. |
| template("cmx") { |
| assert(defined(invoker.manifest), "`manifest` is required") |
| |
| if (!defined(invoker.output_name)) { |
| invoker.output_name = target_name |
| } |
| |
| if (!defined(invoker.deps)) { |
| invoker.deps = [] |
| } |
| if (string_replace(target_out_dir, "vendor/google", "") != target_out_dir) { |
| invoker.deps += [ "//vendor/google/build/components/cmx:cmx_allowlist" ] |
| } else { |
| invoker.deps += [ "//build/components/cmx:cmx_allowlist" ] |
| } |
| |
| copy(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "metadata", |
| "testonly", |
| "visibility", |
| ]) |
| sources = [ invoker.manifest ] |
| outputs = [ "$target_out_dir/${invoker.output_name}" ] |
| } |
| } |