| # Copyright 2022 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. |
| |
| #[START imports] |
| load( |
| "@rules_fuchsia//fuchsia:defs.bzl", |
| "fuchsia_cc_binary", |
| "fuchsia_cc_test", |
| "fuchsia_component", |
| "fuchsia_component_manifest", |
| "fuchsia_package", |
| "fuchsia_select", |
| "fuchsia_unittest_package", |
| ) |
| #[END imports] |
| |
| #[START echo] |
| fuchsia_cc_binary( |
| name = "echo_example", |
| srcs = [ |
| "echo_component.cc", |
| "echo_component.h", |
| "main.cc", |
| ], |
| deps = [] + fuchsia_select({ |
| "@platforms//os:fuchsia": [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| ], |
| }), |
| ) |
| |
| fuchsia_component_manifest( |
| name = "manifest", |
| src = "meta/echo.cml", |
| component_name = "echo", |
| includes = [ |
| "@fuchsia_sdk//pkg/syslog:client", |
| ], |
| ) |
| |
| fuchsia_component( |
| name = "component", |
| component_name = "echo", |
| manifest = ":manifest", |
| visibility = ["//visibility:public"], |
| deps = [":echo_example"], |
| ) |
| |
| fuchsia_package( |
| name = "pkg", |
| package_name = "echo-example", |
| components = [ |
| ":component", |
| ], |
| visibility = ["//visibility:public"], |
| ) |
| #[END echo] |
| |
| #[START unittest] |
| fuchsia_cc_test( |
| name = "echo_unittests", |
| size = "small", |
| srcs = [ |
| "echo_component.cc", |
| "echo_component.h", |
| "echo_unittest.cc", |
| ], |
| visibility = ["//visibility:public"], |
| deps = ["@com_google_googletest//:gtest_main"] + fuchsia_select({ |
| "@platforms//os:fuchsia": [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| ], |
| }), |
| ) |
| |
| fuchsia_unittest_package( |
| name = "test_pkg", |
| package_name = "echo_unittests", |
| unit_tests = [ |
| ":echo_unittests", |
| ], |
| visibility = ["//visibility:public"], |
| ) |
| #[END unittest] |