blob: 69668e93ffba453ce8974c032d2573e517568f38 [file] [log] [blame]
# 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") {
source_dir = "cmd"
deps = [
":lib",
"golden",
"//third_party/golibs:cloud.google.com/go/storage",
"//third_party/golibs:github.com/google/subcommands",
"//tools/lib/logger",
]
sources = [
"main.go",
"main_test.go",
"skipLists.go",
]
}
go_library("templates") {
source_dir = "templates"
sources = [
"html.tmpl.go",
"json.tmpl.go",
"txt.tmpl.go",
]
}
go_library("lib") {
sources = [
"config.go",
"config_test.go",
"file.go",
"file_test.go",
"file_tree.go",
"file_tree_test.go",
"flutter.go",
"license.go",
"license_test.go",
"licenses.go",
"licenses_test.go",
"match.go",
"metrics.go",
"metrics_test.go",
"project.go",
"template.go",
"template_test.go",
"traverse.go",
"traverse_test.go",
"util.go",
]
deps = [
":noticetxt",
":templates",
"//third_party/golibs:golang.org/x/sync",
"//tools/lib/logger",
]
}
go_library("noticetxt") {
source_dir = "noticetxt"
sources = [
"noticetxt.go",
"noticetxt_test.go",
]
deps = [ "//third_party/golibs:github.com/google/go-cmp" ]
}
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)",
":check-licenses_noticetxt_tests($host_toolchain)",
]
}
if (is_host) {
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" ]
args = [
"--test_data_dir",
rebase_path("$target_gen_dir/testdata", root_build_dir),
]
deps = [ ":lib" ]
non_go_deps = [ "testdata" ]
}
go_test("check-licenses_noticetxt_tests") {
gopackages = [ "go.fuchsia.dev/fuchsia/tools/check-licenses/noticetxt" ]
deps = [ ":noticetxt" ]
}
go_test("check-licenses_golden_tests") {
gopackages = [ "go.fuchsia.dev/fuchsia/tools/check-licenses/golden" ]
args = [
"--test_data_dir",
rebase_path("$target_gen_dir/golden", root_build_dir),
]
deps = [ "golden" ]
non_go_deps = [ "golden:licenses" ]
}
}