| # 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_test.gni") |
| import("//build/go/toolchain.gni") |
| import("//build/host.gni") |
| import("//build/package.gni") |
| |
| common_dependencies = [ |
| { |
| package = "amber" |
| source = "//garnet/go/src/amber" |
| }, |
| { |
| package = "fuchsia.googlesource.com/far" |
| source = "//garnet/go/src/far" |
| }, |
| { |
| package = "fuchsia.googlesource.com/merkle" |
| source = "//garnet/go/src/merkle" |
| }, |
| { |
| package = "github.com/flynn/go-tuf" |
| source = "//third_party/golibs/github.com/flynn/go-tuf" |
| }, |
| { |
| package = "golang.org/x/crypto" |
| source = "//third_party/golang/crypto" |
| }, |
| { |
| package = "github.com/syndtr/goleveldb/leveldb" |
| source = "//third_party/golibs/github.com/syndtr/goleveldb/leveldb" |
| }, |
| { |
| package = "github.com/tent/canonical-json-go" |
| source = "//third_party/golibs/github.com/tent/canonical-json-go" |
| }, |
| { |
| package = "github.com/golang/snappy" |
| source = "//third_party/golibs/github.com/golang/snappy" |
| }, |
| ] |
| |
| amber_target_binaries = [ |
| { |
| target = "amber_bin" |
| name = "amber" |
| gopkg = "amber/cmd/amber" |
| }, |
| { |
| name = "amber_ctl" |
| gopkg = "amber/cmd/ctl" |
| }, |
| { |
| name = "amber_init" |
| gopkg = "amber/cmd/init" |
| }, |
| ] |
| |
| common_extra_dependencies = [ |
| "//garnet/public/lib/amber/fidl($go_toolchain)", |
| "//garnet/public/lib/app/fidl($go_toolchain)", |
| "//garnet/public/lib/app/go/src/app", |
| "//garnet/public/lib/fidl/go/src/fidl/bindings", |
| ] |
| |
| 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 |
| |
| extra_dependencies = common_extra_dependencies |
| |
| go_dependencies = common_dependencies |
| } |
| } |
| |
| package("amber") { |
| deps = [ |
| ":amber_bin", |
| ] |
| |
| binary = "amber" |
| |
| resources = [ |
| { |
| path = rebase_path("keys/root_sig.json") |
| dest = "keys" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("cmd/amber/meta/sandbox") |
| dest = "sandbox" |
| }, |
| { |
| 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", |
| ":amber_init", |
| ] |
| |
| binaries = [ |
| { |
| name = "amber_ctl" |
| }, |
| { |
| name = "amber_init" |
| }, |
| ] |
| } |
| |
| 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 |
| |
| go_dependencies = common_dependencies |
| } |
| } |
| |
| 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" |
| } |
| ] |
| foreach(test, test_targets) { |
| go_test(test.name) { |
| gopackage = test.gopkg |
| |
| extra_dependencies = common_extra_dependencies |
| |
| go_dependencies = |
| common_dependencies + [ |
| { |
| package = "github.com/google/go-cmp/cmp" |
| source = "//third_party/golibs/github.com/google/go-cmp/cmp" |
| }, |
| ] |
| } |
| } |
| |
| package("amber_tests") { |
| deprecated_system_image = true |
| 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("config") { |
| deprecated_system_image = true |
| package_name = "amber_config" |
| resources = [ |
| { |
| dest = "sysmgr/amber.config" |
| path = rebase_path("startup.config") |
| }, |
| ] |
| } |