| # Copyright 2023 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/python/python_binary.gni") |
| import("//build/python/python_host_test.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ ":test_fuzzy_matcher($host_toolchain)" ] |
| } |
| |
| if (is_host) { |
| shared_deps = [ |
| "//third_party/colorama", |
| "//third_party/jellyfish", |
| ] |
| |
| python_binary("fuzzy_matcher") { |
| enable_mypy = true |
| main_source = "fuzzy_matcher.py" |
| |
| sources = [ "fuzzy_matcher.py" ] |
| deps = shared_deps |
| } |
| |
| python_host_test("test_fuzzy_matcher") { |
| enable_mypy = true |
| main_source = "test_fuzzy_matcher.py" |
| sources = [ |
| "fuzzy_matcher.py", |
| "test_fuzzy_matcher.py", |
| ] |
| libraries = shared_deps |
| } |
| |
| rustc_binary("dldist") { |
| edition = "2021" |
| source_root = "dldist.rs" |
| sources = [ "dldist.rs" ] |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:strsim", |
| ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| configs += [ "//build/config:optimize_speed" ] |
| |
| # Add thinlto config if lto variants are not used. |
| if (!is_lto_variant) { |
| configs += [ "//build/config/lto:thinlto" ] |
| } |
| } |
| |
| # Rename the resulting .pyz for the host tool |
| copy("copy") { |
| deps = [ ":fuzzy_matcher" ] |
| sources = [ "${target_out_dir}/fuzzy_matcher.pyz" ] |
| outputs = [ "${root_out_dir}/search-tests" ] |
| } |
| |
| install_host_tools("install") { |
| deps = [ |
| ":copy", |
| ":dldist", |
| ] |
| outputs = [ |
| "search-tests", |
| "dldist", |
| ] |
| } |
| } |