| # 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") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| if (is_host) { |
| rustc_binary("cargo-gnaw-bin") { |
| edition = "2021" |
| output_name = "gnaw" |
| |
| deps = [ |
| ":cargo-gnaw-lib", |
| "//third_party/rust_crates:anyhow", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| rustc_library("cargo-gnaw-lib") { |
| edition = "2021" |
| name = "gnaw_lib" |
| |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:camino", |
| "//third_party/rust_crates:cargo_metadata", |
| "//third_party/rust_crates:semver", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:toml", |
| "//third_party/rust_crates:walkdir", |
| ] |
| |
| sources = [ |
| "src/build.rs", |
| "src/cfg.rs", |
| "src/gn.rs", |
| "src/graph.rs", |
| "src/lib.rs", |
| "src/target.rs", |
| "src/types.rs", |
| ] |
| |
| inputs = [ |
| "templates/gn_header.template", |
| "templates/gn_import.template", |
| "templates/gn_license.template", |
| "templates/gn_rule.template", |
| "templates/gn_sdk_metadata_header.template", |
| "templates/top_level_binary_gn_rule.template", |
| "templates/top_level_gn_rule.template", |
| ] |
| } |
| |
| rustc_test("cargo-gnaw-tests") { |
| edition = "2021" |
| source_root = "src/lib.rs" |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:camino", |
| "//third_party/rust_crates:cargo_metadata", |
| "//third_party/rust_crates:semver", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:toml", |
| "//third_party/rust_crates:walkdir", |
| ] |
| |
| sources = [ |
| "src/build.rs", |
| "src/cfg.rs", |
| "src/gn.rs", |
| "src/graph.rs", |
| "src/lib.rs", |
| "src/target.rs", |
| "src/types.rs", |
| ] |
| |
| inputs = [ |
| "templates/gn_header.template", |
| "templates/gn_import.template", |
| "templates/gn_license.template", |
| "templates/gn_rule.template", |
| "templates/gn_sdk_metadata_header.template", |
| "templates/top_level_binary_gn_rule.template", |
| "templates/top_level_gn_rule.template", |
| ] |
| } |
| } |
| |
| install_host_tools("install-cargo-gnaw") { |
| deps = [ ":cargo-gnaw-bin" ] |
| outputs = [ "gnaw" ] |
| } |
| |
| group("cargo-gnaw") { |
| testonly = true |
| deps = [ |
| ":cargo-gnaw-bin($host_toolchain)", |
| ":install-cargo-gnaw", |
| ":tests", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":cargo-gnaw-tests($host_toolchain)", |
| "tests", |
| ] |
| } |