| # 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. |
| |
| load( |
| "@rules_fuchsia//fuchsia:defs.bzl", |
| "fuchsia_cc_binary", |
| "fuchsia_cc_test", |
| "fuchsia_component", |
| "fuchsia_component_manifest", |
| "fuchsia_package", |
| "fuchsia_unittest_package", |
| ) |
| |
| fuchsia_cc_binary( |
| name = "hello_world", |
| srcs = [ |
| "hello_world.cc", |
| ], |
| deps = [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| # the fidl libraries below are not effectively used in the hello world sample, they are here just to validate that |
| # the Bazel build can include FIDL dependencies from both internal and partner SDK correctly: |
| "@fuchsia_sdk//fidl/fuchsia.component.decl:fuchsia.component.decl_cpp", |
| ], |
| ) |
| |
| fuchsia_component_manifest( |
| name = "manifest", |
| src = "meta/hello_world.cml", |
| ) |
| |
| fuchsia_component( |
| name = "component", |
| manifest = ":manifest", |
| deps = [":hello_world"], |
| ) |
| |
| fuchsia_package( |
| name = "pkg", |
| package_name = "hello_cpp", |
| components = [ |
| ":component", |
| ], |
| fuchsia_api_level = "HEAD", |
| package_repository_name = "fuchsia.com", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_cc_test( |
| name = "hello_test", |
| srcs = ["hello_test.cc"], |
| deps = [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| ], |
| ) |
| |
| fuchsia_cc_test( |
| name = "hello_gtest", |
| srcs = ["hello_gtest.cc"], |
| death_unittest = True, |
| deps = [ |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/syslog", |
| ], |
| ) |
| |
| fuchsia_unittest_package( |
| name = "test_pkg", |
| package_name = "hello_cpp_test", |
| fuchsia_api_level = "HEAD", |
| unit_tests = [ |
| ":hello_test", |
| ":hello_gtest", |
| ], |
| visibility = ["//visibility:public"], |
| ) |
| |
| filegroup( |
| name = "hello_cpp", |
| testonly = True, |
| srcs = [ |
| ":pkg", |
| ":test_pkg", |
| ], |
| visibility = ["//visibility:public"], |
| ) |