| # 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("//src/sys/cmc/cmc.gni") |
| |
| # Compiles a cml file into a cm file. |
| # If is_debug is true, pretty-prints the generated cm file. |
| # |
| # Parameters |
| # |
| # data (required) |
| # [file] The path to the cml file that is to be compiled. |
| # |
| # deps (optional) |
| # public_deps (optional) |
| # testonly (optional) |
| # visibility (optional) |
| # Standard GN meaning. |
| # |
| # Example of usage: |
| # |
| # cm(format) { |
| # data = rebase_path(meta.path) |
| # } |
| template("cm") { |
| cmc(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "public_deps", |
| "testonly", |
| "visibility", |
| ]) |
| |
| compiled_output = "$target_out_dir/$target_name" |
| inputs = [ invoker.data ] |
| outputs = [ compiled_output ] |
| |
| args = [ |
| "compile", |
| "--output", |
| rebase_path(compiled_output, root_build_dir), |
| invoker.data, |
| ] |
| |
| if (is_debug) { |
| args += [ "--pretty" ] |
| } |
| } |
| } |