| # 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/components.gni") |
| import("//build/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/host.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| _version_history_dep = "//sdk:version_history($default_toolchain)" |
| |
| _version_history_json_dir = |
| get_label_info(_version_history_dep, "target_out_dir") |
| |
| copy("copy-files") { |
| sources = [ |
| "${_version_history_json_dir}/version_history.json", |
| "version_history.go", |
| "version_history_test.go", |
| ] |
| deps = [ _version_history_dep ] |
| outputs = [ "$target_gen_dir/{{source_file_part}}" ] |
| } |
| |
| go_library("version-history") { |
| name = "go.fuchsia.dev/fuchsia/src/lib/versioning/version-history/go" |
| |
| source_dir = target_gen_dir |
| |
| sources = [ |
| "version_history.go", |
| "version_history.json", |
| "version_history_test.go", |
| ] |
| |
| non_go_deps = [ ":copy-files" ] |
| } |
| |
| if (is_host) { |
| host_test_data("version-history-test-data") { |
| sources = [ "${_version_history_json_dir}/version_history.json" ] |
| deps = [ _version_history_dep ] |
| outputs = |
| [ "$root_out_dir/test_data/version-history/go/{{source_file_part}}" ] |
| } |
| |
| go_test("version-history-test") { |
| library = ":version-history" |
| non_go_deps = [ ":version-history-test-data" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ ":version-history-test($host_toolchain)" ] |
| } |