| # 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/go/go_binary.gni") |
| import("//build/go/go_library.gni") |
| import("//build/go/go_test.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| go_binary("check-licenses") { |
| gopackage = "go.fuchsia.dev/fuchsia/tools/check-licenses/cmd" |
| deps = [ ":main" ] |
| } |
| |
| go_library("main") { |
| name = "go.fuchsia.dev/fuchsia/tools/check-licenses/cmd" |
| source_dir = "cmd" |
| deps = [ |
| ":golden", |
| ":lib", |
| "//third_party/golibs:cloud.google.com/go/storage", |
| "//third_party/golibs:github.com/google/subcommands", |
| "//tools/lib/logger", |
| ] |
| } |
| |
| go_library("templates") { |
| name = "go.fuchsia.dev/fuchsia/tools/check-licenses/templates" |
| source_dir = "templates" |
| } |
| |
| go_library("lib") { |
| name = "go.fuchsia.dev/fuchsia/tools/check-licenses" |
| deps = [ |
| ":templates", |
| "//tools/lib/logger", |
| ] |
| } |
| |
| go_library("golden") { |
| name = "go.fuchsia.dev/fuchsia/tools/check-licenses/golden" |
| source_dir = "golden" |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":check-licenses" ] |
| outputs = [ "check-licenses" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":check-licenses_golden_tests($host_toolchain)", |
| ":check-licenses_lib_tests($host_toolchain)", |
| ":check-licenses_main_tests($host_toolchain)", |
| ] |
| } |
| |
| go_test("check-licenses_main_tests") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/check-licenses/cmd" ] |
| deps = [ ":main" ] |
| } |
| |
| go_test("check-licenses_lib_tests") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/check-licenses" ] |
| deps = [ ":lib" ] |
| } |
| |
| if (is_host) { |
| _testdata_path = "$target_gen_dir/golden" |
| |
| go_test("check-licenses_golden_tests") { |
| gopackages = [ "go.fuchsia.dev/fuchsia/tools/check-licenses/golden" ] |
| args = [ |
| "--test_data_dir", |
| rebase_path(_testdata_path, root_build_dir), |
| ] |
| deps = [ ":golden" ] |
| non_go_deps = [ ":golden_test_data" ] |
| } |
| |
| host_test_data("golden_test_data") { |
| sources = [ "golden" ] |
| outputs = [ _testdata_path ] |
| } |
| } |