| # 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/go/toolchain.gni") |
| import("//build/host.gni") |
| import("//build/package.gni") |
| import("//third_party/cobalt_config/metrics_registry.gni") |
| |
| go_library("amber_lib") { |
| name = "amber" |
| deps = [ |
| "//garnet/go/src/merkle", |
| "//garnet/go/src/sse", |
| "//garnet/public/fidl/fuchsia.amber($go_toolchain)", |
| "//garnet/public/fidl/fuchsia.sys($go_toolchain)", |
| "//garnet/public/go/third_party:github.com/flynn/go-tuf", |
| "//garnet/public/go/third_party:github.com/rjw57/oauth2device", |
| "//garnet/public/go/third_party:golang.org/x/oauth2", |
| "//garnet/public/lib/component/go/src/app", |
| "//garnet/public/lib/syslog/go/src/syslog", |
| "//zircon/public/fidl/fuchsia-cobalt($go_toolchain)", |
| "//zircon/public/fidl/fuchsia-mem($go_toolchain)", |
| ] |
| } |
| |
| amber_target_binaries = [ |
| { |
| target = "amber_bin" |
| name = "amber" |
| gopkg = "amber/cmd/amber" |
| }, |
| { |
| name = "amber_ctl" |
| gopkg = "amber/cmd/ctl" |
| }, |
| ] |
| |
| foreach(tgt, amber_target_binaries) { |
| target_name = tgt.name |
| if (defined(tgt.target)) { |
| target_name = tgt.target |
| } |
| go_binary(target_name) { |
| output_name = tgt.name |
| |
| gopackage = tgt.gopkg |
| |
| deps = [ |
| ":amber_lib", |
| ] |
| } |
| } |
| |
| metrics_registry("cobalt_sw_delivery_registry") { |
| project_id = 108 |
| use_target_name = true |
| } |
| |
| package("amber") { |
| deps = [ |
| ":amber_bin", |
| ":cobalt_sw_delivery_registry", |
| ] |
| |
| binary = "amber" |
| |
| resources = [ |
| { |
| path = rebase_path("keys/root_sig.json") |
| dest = "keys" |
| }, |
| { |
| path = rebase_path( |
| get_label_info(":cobalt_sw_delivery_registry", "target_gen_dir") + |
| "/cobalt_sw_delivery_registry.pb") |
| dest = "cobalt_config.pb" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("cmd/amber/meta/amber.cmx") |
| dest = "amber.cmx" |
| }, |
| { |
| path = rebase_path("//garnet/bin/appmgr/legacy_flat_exported_dir") |
| dest = "legacy_flat_exported_dir" |
| }, |
| ] |
| } |
| |
| package("amber_tools") { |
| deps = [ |
| ":amber_ctl", |
| ] |
| |
| binaries = [ |
| { |
| name = "amber_ctl" |
| shell = true |
| }, |
| ] |
| } |
| |
| test_targets = [ |
| { |
| name = "amber_daemon_test" |
| gopkg = "amber/daemon" |
| }, |
| { |
| name = "amber_source_test" |
| gopkg = "amber/source" |
| }, |
| ] |
| foreach(test, test_targets) { |
| go_test(test.name) { |
| gopackage = test.gopkg |
| |
| deps = [ |
| ":amber_lib", |
| "//garnet/go/src/pmd", |
| "//garnet/public/go/third_party:github.com/google/go-cmp", |
| ] |
| } |
| } |
| |
| package("amber_tests") { |
| testonly = true |
| |
| deps = [] |
| tests = [] |
| |
| foreach(test, test_targets) { |
| deps += [ ":${test.name}" ] |
| tests += [ |
| { |
| name = test.name |
| }, |
| ] |
| } |
| } |
| |
| package("test_config") { |
| deprecated_system_image = true |
| package_name = "amber_test_config" |
| testonly = true |
| |
| resources = [ |
| { |
| dest = "amber/test_sources/test1/config.json" |
| path = rebase_path("etc/sources/test1/config.json") |
| }, |
| { |
| dest = "amber/test_sources/test2/config.json" |
| path = rebase_path("etc/sources/test2/config.json") |
| }, |
| ] |
| } |
| |
| package("config") { |
| deprecated_system_image = true |
| package_name = "amber_config" |
| resources = [ |
| { |
| dest = "sysmgr/amber.config" |
| path = rebase_path("startup.config") |
| }, |
| ] |
| } |