| # 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/host.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/sdk/sdk_host_tool.gni") |
| |
| rustc_binary("jq5") { |
| edition = "2021" |
| deps = [ |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:json5format", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:serde_json5", |
| "//third_party/rust_crates:structopt", |
| ] |
| |
| sources = [ |
| "src/main.rs", |
| "src/reader.rs", |
| "src/traverser.rs", |
| ] |
| } |
| |
| rustc_test("jq5_bin_test") { |
| edition = "2018" |
| deps = [ |
| ":jq_for_test", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:json5format", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:serde_json5", |
| "//third_party/rust_crates:structopt", |
| ] |
| source_root = "src/main.rs" |
| sources = [ |
| "src/main.rs", |
| "src/reader.rs", |
| "src/traverser.rs", |
| ] |
| |
| jq_path_init = "${target_out_dir}/jq5_tests/jq" |
| jq_path = rebase_path(jq_path_init, root_build_dir) |
| |
| rustenv = [ "JQ_PATH=${jq_path}" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":jq5_bin_test($host_toolchain)" ] |
| } |
| |
| install_host_tools("install") { |
| deps = [ ":jq5" ] |
| outputs = [ "jq5" ] |
| } |
| |
| if (is_host) { |
| host_test_data("jq_for_test") { |
| sources = [ "//prebuilt/third_party/jq/${host_platform}/bin/jq" ] |
| outputs = [ "${target_out_dir}/jq5_tests/jq" ] |
| |
| visibility = [ ":*" ] |
| } |
| } |