| # Copyright 2021 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/rust/rustc_binary.gni") |
| |
| assert(is_host, "gn_desc is only supported on the host") |
| |
| group("bin") { |
| testonly = true |
| deps = [ ":gn_desc" ] |
| } |
| |
| # This is the binary tool itself |
| rustc_binary("gn_desc") { |
| edition = "2021" |
| testonly = true |
| with_unit_tests = true |
| |
| # This is compiled with optimizations enabled so that operations are as |
| # performant as possible. The JSON parsing itself is optimized in the |
| # `gn_json` rlib, but this ensures that follow-on operations like graph |
| # traversals are also optimized. |
| configs += [ "//build/config:optimize_speed" ] |
| |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:humansize", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde_json", |
| "//tools/gn_desc/gn_graph", |
| "//tools/gn_desc/gn_json", |
| ] |
| |
| test_deps = [ "//third_party/rust_crates:pretty_assertions" ] |
| |
| sources = [ |
| "src/args.rs", |
| "src/commands.rs", |
| "src/commands/all_deps.rs", |
| "src/commands/list.rs", |
| "src/commands/selectors.rs", |
| "src/commands/summarize.rs", |
| "src/display.rs", |
| "src/display/list.rs", |
| "src/display/optional_line.rs", |
| "src/main.rs", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":gn_desc_test" ] |
| } |