| # Copyright 2020 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/host.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| if (host_toolchain == current_toolchain) { |
| rustc_binary("create_bin") { |
| name = "create" |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:handlebars", |
| "//third_party/rust_crates:heck", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:structopt", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:termion", |
| ] |
| with_unit_tests = true |
| } |
| |
| copy("copy_templates") { |
| sources = [ |
| "templates/component-v2/BUILD.gn.tmpl-cpp", |
| "templates/component-v2/BUILD.gn.tmpl-rust", |
| "templates/component-v2/\$.cc.tmpl-cpp", |
| "templates/component-v2/\$.h.tmpl-cpp", |
| "templates/component-v2/\$_test.cc.tmpl-cpp", |
| "templates/component-v2/main.cc.tmpl-cpp", |
| "templates/component-v2/meta/\$.cml.tmpl", |
| "templates/component-v2/meta/\$_test.cml.tmpl-rust", |
| "templates/component-v2/meta/\$_unittests.cml.tmpl-cpp", |
| "templates/component-v2/src/main.rs.tmpl-rust", |
| ] |
| outputs = |
| [ "${host_tools_dir}/create_templates/{{source_target_relative}}" ] |
| } |
| } |
| |
| install_host_tools("create") { |
| deps = [ |
| ":copy_templates($host_toolchain)", |
| ":create_bin($host_toolchain)", |
| ] |
| |
| outputs = [ "create" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ ":create_bin_test($host_toolchain)" ] |
| } |