| # Copyright 2024 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( |
| "@fuchsia_sdk//fuchsia:defs.bzl", |
| "fuchsia_cc_driver", |
| "fuchsia_cc_test", |
| "fuchsia_component_manifest", |
| "fuchsia_driver_bind_bytecode", |
| "fuchsia_driver_component", |
| "fuchsia_package", |
| "fuchsia_unittest_package", |
| ) |
| load( |
| "@fuchsia_sdk//fuchsia:licenses.bzl", |
| "fuchsia_licenses_collection", |
| "fuchsia_licenses_spdx", |
| ) |
| |
| package( |
| #default_applicable_licenses = ["//:license_fuchsia"], |
| default_visibility = ["//visibility:public"], |
| ) |
| |
| exports_files(["README.fuchsia"]) |
| |
| fuchsia_driver_bind_bytecode( |
| name = "template-bind-bytecode", |
| output = "template_driver.bindbc", |
| rules = "template_driver.bind", |
| deps = [ |
| "//examples/drivers/bind/bindlib:gizmo.example", |
| "@fuchsia_sdk//bind/fuchsia.platform", |
| ], |
| ) |
| |
| cc_library( |
| name = "common", |
| srcs = [ |
| "template_driver.cc", |
| ], |
| hdrs = [ |
| "template_driver.h", |
| ], |
| deps = [ |
| "//sdk/lib/driver/compat/cpp", |
| "@fuchsia_sdk//bind/fuchsia.test:fuchsia.test_cc", |
| "@fuchsia_sdk//fidl/fuchsia.hardware.platform.device:fuchsia.hardware.platform.device_cpp", |
| "@fuchsia_sdk//pkg/driver_component_cpp", |
| "@fuchsia_sdk//pkg/driver_logging_cpp", |
| "@fuchsia_sdk//pkg/zx", |
| ], |
| ) |
| |
| fuchsia_cc_driver( |
| name = "template-driver", |
| srcs = ["template_driver.cc"], # Satisfy FUCHSIA_DRIVER_EXPORT check. |
| linkshared = True, |
| deps = [":common"], |
| ) |
| |
| fuchsia_component_manifest( |
| name = "manifest", |
| src = "meta/template.cml", |
| ) |
| |
| fuchsia_driver_component( |
| name = "component", |
| bind_bytecode = ":template-bind-bytecode", |
| driver_lib = ":template-driver", |
| manifest = ":manifest", |
| ) |
| |
| fuchsia_package( |
| name = "pkg", |
| package_name = "template", |
| components = [":component"], |
| fuchsia_api_level = "HEAD", |
| package_repository_name = "fuchsia.com", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_cc_test( |
| name = "template-test-bin", |
| size = "small", |
| srcs = ["tests/test.cc"], |
| deps = [ |
| ":common", |
| "//sdk/lib/driver/testing/cpp:driver_testing_cpp_gtest_fixture", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//pkg/driver_runtime_cpp", |
| "@fuchsia_sdk//pkg/driver_testing_cpp", |
| ], |
| ) |
| |
| fuchsia_unittest_package( |
| name = "template-test", |
| package_name = "template-test", |
| fuchsia_api_level = "HEAD", |
| unit_tests = [":template-test-bin"], |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_licenses_collection( |
| name = "template-pkg-licenses-collection", |
| root_target = ":pkg", |
| ) |
| |
| fuchsia_licenses_spdx( |
| name = "template-licenses.spdx.json", |
| document_namespace = "https://fuchsia.googlesource.com/examples/drivers/template/", |
| licenses = ":template-pkg-licenses-collection", |
| licenses_cross_refs_base_url = "https://fuchsia.googlesource.com/examples/drivers/template/+/refs/heads/main/", |
| root_package_homepage = "https://fuchsia.googlesource.com/drivers/examples/template", |
| root_package_name = "pkg", |
| ) |