blob: bcce302f8a687c27c8fdeb644873bb2b81c650e8 [file] [log] [blame]
# 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/config.gni")
import("//build/go/go_library.gni")
import("//build/go/go_test.gni")
import("//build/go/toolchain.gni")
import("//build/host.gni")
import("//build/images/manifest.gni")
import("//build/package.gni")
import("//build/package/component.gni")
import("//build/testing/environments.gni")
import("//third_party/cobalt_config/metrics_registry.gni")
go_library("metrics_lib") {
name = "metrics"
source_dir = "metrics"
deps = [
"//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)",
]
}
go_library("lib") {
name = "amber"
deps = [
"//garnet/go/src/merkle",
"//garnet/go/src/sse",
"//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",
"//sdk/fidl/fuchsia.amber($go_toolchain)",
"//sdk/fidl/fuchsia.pkg($go_toolchain)",
"//sdk/fidl/fuchsia.pkg.rewrite($go_toolchain)",
"//sdk/fidl/fuchsia.sys($go_toolchain)",
"//zircon/public/fidl/fuchsia-cobalt($go_toolchain)",
"//zircon/public/fidl/fuchsia-mem($go_toolchain)",
]
}
metrics_registry("cobalt_sw_delivery_registry") {
project_id = 108
use_target_name = true
}
# Include install-disk-image in the build, which comes from Zircon
generate_manifest("install-disk-image.manifest") {
visibility = [ ":*" ]
args = []
foreach(pattern, [ "bin/install-disk-image" ]) {
args += [ "--binary=" + pattern ]
}
}
manifest_outputs = get_target_outputs(":install-disk-image.manifest")
manifest_file = manifest_outputs[0]
package("pkgfs") {
deps = [
"//garnet/go/src/grand_unified_binary",
]
binaries = [
{
name = "pkgsvr"
source = "grand_unified_binary"
},
]
meta = [
{
path = rebase_path("//garnet/go/src/pmd/meta/pkgsvr.cmx")
dest = "pkgsvr.cmx"
},
]
}
# FIXME: Until fuchsia_component exists again, ensure this and //garnet/tests/amberctl:amberctl-tests stay in sync
package("amber") {
deprecated_misc_storage = "//build"
extra = [ manifest_file ]
deps = [
":cobalt_sw_delivery_registry",
":install-disk-image.manifest",
"//garnet/go/src/grand_unified_binary",
]
binaries = [
{
name = "grand_unified_binary"
dest = "system_updater"
},
{
name = "grand_unified_binary"
dest = "amber"
},
]
meta = [
{
path = rebase_path("meta/amber.cmx")
dest = "amber.cmx"
},
{
path = rebase_path(
"//garnet/go/src/amber/system_updater/meta/system_updater.cmx")
dest = "system_updater.cmx"
},
]
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"
},
{
path = rebase_path("system_updater/images")
dest = "images"
},
]
}
# FIXME: Until fuchsia_component exists again, ensure this and //garnet/tests/amberctl:amberctl-tests stay in sync
package("amber_tools") {
deps = [
"//garnet/go/src/grand_unified_binary",
]
meta = [
{
path = rebase_path("meta/amberctl.cmx")
dest = "amberctl.cmx"
},
]
binaries = [
# TODO(raggi): remove the underscore version of the command name once all
# docs and scripts have been updated.
# See https://fuchsia-review.googlesource.com/c/fuchsia/+/255274.
{
name = "amber_ctl"
source = "grand_unified_binary"
shell = true
},
{
name = "amberctl"
source = "grand_unified_binary"
shell = true
},
]
}
test_targets = [
{
name = "amber_daemon_test"
gopkg = "amber/daemon"
},
{
name = "amber_source_test"
gopkg = "amber/source"
},
{
name = "amber_urlscope_test"
gopkg = "amber/urlscope"
},
]
foreach(test, test_targets) {
go_test(test.name) {
gopackage = test.gopkg
deps = [
":lib",
"//garnet/go/src/pm:pm_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
environments = basic_envs
},
]
}
}
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")
environments = basic_envs
},
{
dest = "amber/test_sources/test2/config.json"
path = rebase_path("etc/sources/test2/config.json")
environments = basic_envs
},
]
}
config_data("config") {
for_pkg = "sysmgr"
outputs = [
"amber.config",
]
sources = [
"startup.config",
]
}