blob: 8bc18646bf964370109d57669a6e96a5e5298ec7 [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/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")
go_library("amber_lib") {
name = "amber"
deps = [
"//garnet/go/src/merkle",
"//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",
]
}
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" ]
}
}
package("amber") {
deps = [
":amber_bin",
]
binary = "amber"
resources = [
{
path = rebase_path("keys/root_sig.json")
dest = "keys"
},
]
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") {
deprecated_system_image = true
deps = [
":amber_ctl",
]
binaries = [
{
name = "amber_ctl"
},
]
}
amber_host_binaries = [
{
name = "amber-srv"
gopkg = "amber/cmd/amber-serve"
},
{
name = "amber-publish"
gopkg = "amber/cmd/publish"
},
]
foreach(tgt, amber_host_binaries) {
go_binary(tgt.name) {
output_name = tgt.name
gopackage = tgt.gopkg
deps = [ ":amber_lib" ]
}
}
install_host_tools("amber_host_tools") {
deps = []
outputs = []
foreach(tgt, amber_host_binaries) {
deps += [ ":${tgt.name}" ]
outputs += [ tgt.name ]
}
}
test_targets = [
{
name = "amber_daemon_test"
gopkg = "amber/daemon"
},
{
name = "amber_publish_test"
gopkg = "amber/publish"
},
{
name = "amber_cmd_publish_test"
gopkg = "amber/cmd/publish"
},
{
name = "amber_fidl_test"
gopkg = "amber/ipcserver"
},
{
name = "amber_source_test"
gopkg = "amber/source"
}
]
foreach(test, test_targets) {
go_test(test.name) {
gopackage = test.gopkg
deps = [
":amber_lib",
"//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
},
]
}
}
copy("amber-srv-keys") {
sources = [
"keys/root.json",
"keys/root_manifest.json",
"keys/snapshot.json",
"keys/targets.json",
"keys/timestamp.json",
]
outputs = [
"$root_out_dir/{{source_file_part}}",
]
}
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")
},
{
dest = "amber/sources/localhost/config.json"
path = rebase_path("etc/sources/localhost/config.json")
},
]
}