| # Copyright 2017 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/host.gni") |
| import("//build/package.gni") |
| |
| go_library("pm_lib") { |
| name = "fuchsia.googlesource.com/pm" |
| |
| deps = [ |
| "//garnet/go/src/far", |
| "//garnet/go/src/merkle", |
| "//garnet/go/src/sse", |
| "//src/sys/pkg/lib/repo", |
| "//third_party/golibs:github.com/flynn/go-tuf", |
| "//third_party/golibs:github.com/fsnotify/fsnotify", |
| "//third_party/golibs:golang.org/x/crypto", |
| ] |
| } |
| |
| test_packages = [ |
| "build", |
| "cmd/pm/genkey", |
| "cmd/pm/publish", |
| "cmd/pm/serve", |
| "repo", |
| ] |
| |
| test_labels = [] |
| foreach(pkg, test_packages) { |
| pkg_ = string_replace(pkg, "/", "_") |
| name = "pm_${pkg_}_test" |
| go_test(name) { |
| gopackages = [ "fuchsia.googlesource.com/pm/${pkg}" ] |
| deps = [ ":pm_lib" ] |
| } |
| |
| test_labels += [ ":$name" ] |
| } |
| |
| group("host_tests") { |
| testonly = true |
| public_deps = [] |
| foreach(label, test_labels) { |
| public_deps += [ label + "($host_toolchain)" ] |
| } |
| } |
| |
| go_binary("pm_bin") { |
| output_name = "pm" |
| gopackage = "fuchsia.googlesource.com/pm/cmd/pm" |
| sdk_category = "partner" |
| deps = [ ":pm_lib" ] |
| } |
| |
| package("pm") { |
| deps = [ ":pm_bin" ] |
| |
| binaries = [ |
| { |
| name = "pm" |
| shell = true |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/pm.cmx") |
| dest = "pm.cmx" |
| }, |
| ] |
| } |
| |
| install_host_tools("host") { |
| deps = [ ":pm_bin" ] |
| outputs = [ "pm" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ ":host_tests" ] |
| } |