[bazel_migration][fake-object] //sdk/lib/driver/fake-object/cpp
- Convert `cpp` (`idk_cc_source_library()`), `fake_object_test`
(`fx_cc_test()`), and `fake_object_test_package`
(`fx_unittest_package()`) to `BUILD.bazel`.
- Register `//sdk/lib/driver/fake-object/cpp:cpp_idk` in
`STABLE_CC_SOURCE_LIBRARY_ATOMS` in `sdk/atom_lists.bzl`.
- Sync targets back to `BUILD.gn` via `bazel2gn` and keep
`group("tests")` in `BUILD.gn`.
Bug: 571374004
Bazel-Migration-Target: //sdk/lib/driver/fake-object/cpp:cpp
Bazel-Migration-Target: //sdk/lib/driver/fake-object/cpp:fake_object_test
Bazel-Migration-Target: //sdk/lib/driver/fake-object/cpp:fake_object_test_package
Test: fx bazel build --config=fuchsia_platform @//sdk/lib/driver/fake-object/cpp:cpp @//sdk/lib/driver/fake-object/cpp:fake_object_test_package
Run-All-Tests: true
TAG: planter planter-20261030-2d69c1d68e8-local
Change-Id: I4dd04d10d768df7247b436e588bcc8ad8f2bd212
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1936270
Agent-Code-Review: Fuchsia CL Risk (Advisory) <groupagent-fuchsia-risk@google.com>
Commit-Queue: Angelica Rosenzweig Castillo <rosenzwa@google.com>
Fuchsia-Auto-Submit: Angelica Rosenzweig Castillo <rosenzwa@google.com>
Presubmit-Verified: fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Kevin Lindkvist <lindkvist@google.com>
Risk: Fuchsia CL Risk (Advisory) <groupagent-fuchsia-risk@google.com>
Reviewed-by: Jay Zhuang <jayzhuang@google.com>
diff --git a/sdk/atom_lists.bzl b/sdk/atom_lists.bzl
index 4cd4672..3d75f92 100644
--- a/sdk/atom_lists.bzl
+++ b/sdk/atom_lists.bzl
@@ -19,6 +19,7 @@
"//sdk/lib/component/incoming/cpp:cpp_idk",
"//sdk/lib/component/outgoing/cpp:cpp_idk",
"//sdk/lib/driver/devfs/cpp:cpp_idk",
+ "//sdk/lib/driver/fake-object/cpp:cpp_idk",
"//sdk/lib/driver/runtime:driver_runtime_cpp_idk",
"//sdk/lib/driver/runtime:driver_runtime_env_cpp_idk",
"//sdk/lib/driver/runtime:driver_runtime_env_idk",
diff --git a/sdk/lib/BUILD.bazel b/sdk/lib/BUILD.bazel
index 07c665e51..483fbb7 100644
--- a/sdk/lib/BUILD.bazel
+++ b/sdk/lib/BUILD.bazel
@@ -10,6 +10,7 @@
tests = [
"//sdk/lib/async/rust/scope_dispatcher:libasync_scope_dispatcher_tests",
"//sdk/lib/driver/debug/rust:driver_debug_tests",
+ "//sdk/lib/driver/fake-object/cpp:fake_object_test_package",
"//sdk/lib/driver/mmio/rust:unittests",
"//sdk/lib/driver/mock-mmio/rust:unittests",
"//sdk/lib/fdio/tests/getaddrinfo:getaddrinfo_tests",
diff --git a/sdk/lib/driver/fake-object/cpp/BUILD.bazel b/sdk/lib/driver/fake-object/cpp/BUILD.bazel
new file mode 100644
index 0000000..a65f1ed
--- /dev/null
+++ b/sdk/lib/driver/fake-object/cpp/BUILD.bazel
@@ -0,0 +1,52 @@
+# Copyright 2026 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("//build/bazel/rules/cc:fx_cc_test.bzl", "fx_cc_test")
+load("//build/bazel/rules/idk:idk_cc_source_library.bzl", "idk_cc_source_library")
+load("//build/bazel/rules/testing:fx_unittest_package.bzl", "fx_unittest_package")
+
+package(default_applicable_licenses = ["//:license"])
+
+idk_cc_source_library(
+ name = "cpp",
+ srcs = [
+ "fake-handle.cc",
+ "fake-object.cc",
+ "internal.h",
+ ],
+ hdrs = ["fake-object.h"],
+ api_area = "Driver SDK",
+ category = "partner",
+ idk_name = "driver_fake_object_cpp",
+ include_base = "//sdk",
+ public_configs = ["//sdk/config"],
+ stable = True,
+ visibility = [
+ "//build/sdk:__pkg__",
+ "//sdk/lib/driver/fake-bti/cpp:__pkg__",
+ "//sdk/lib/driver/fake-resource/cpp:__pkg__",
+ ],
+ deps = [
+ "//sdk/lib/fdio",
+ "//zircon/system/ulib/zx",
+ ],
+)
+
+fx_cc_test(
+ name = "fake_object_test",
+ srcs = [
+ "fake-object-test.cc",
+ "internal.h",
+ ],
+ deps = [
+ ":cpp",
+ "//zircon/system/ulib/zxtest",
+ ],
+)
+
+fx_unittest_package(
+ name = "fake_object_test_package",
+ unit_tests = [":fake_object_test"],
+ visibility = ["//sdk/lib:__pkg__"],
+)
diff --git a/sdk/lib/driver/fake-object/cpp/BUILD.gn b/sdk/lib/driver/fake-object/cpp/BUILD.gn
index c7e6ed5..fba1852 100644
--- a/sdk/lib/driver/fake-object/cpp/BUILD.gn
+++ b/sdk/lib/driver/fake-object/cpp/BUILD.gn
@@ -2,45 +2,66 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("//build/components.gni")
-import("//build/cpp/sdk_source_set.gni")
-import("//build/test.gni")
-
group("tests") {
testonly = true
deps = [ ":fake_object_test_package" ]
}
-sdk_source_set("cpp") {
- category = "partner"
- stable = true
- sdk_name = "driver_fake_object_cpp"
- include_base = "//sdk"
+## BAZEL2GN SENTINEL - DO NOT EDIT BELOW THIS LINE ##
+#
+# ________ _________ ________ ________
+# |\ ____\|\___ ___\\ __ \|\ __ \
+# \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \
+# \ \_____ \ \ \ \ \ \ \\\ \ \ ____\
+# \|____|\ \ \ \ \ \ \ \\\ \ \ \___|
+# ____\_\ \ \ \__\ \ \_______\ \__\
+# |\_________\ \|__| \|_______|\|__|
+# \|_________|
+#
+#
+# AUTO-GENERATED - DO NOT EDIT
+#
+# The targets below are auto-generated based on the targets defined in the
+# BUILD.bazel file from the same directory. If you made changes to targets in
+# Bazel, instead of editing this file manually, run:
+#
+# > fx bazel2gn
+#
+# Please do NOT edit this file directly. Instead, edit the BUILD.bazel file and
+# rerun bazel2gn.
+import("//build/tools/bazel2gn/bazel_migration.gni")
+
+sdk_source_set("cpp") {
sources = [
"fake-handle.cc",
"fake-object.cc",
"internal.h",
]
-
public = [ "fake-object.h" ]
-
+ sdk_area = "Driver SDK"
+ category = "partner"
+ sdk_name = "driver_fake_object_cpp"
+ include_base = "//sdk"
+ public_configs = [ "//sdk/config" ]
+ stable = true
+ visibility = [
+ ":*",
+ "//build/sdk:*",
+ "//sdk/lib/driver/fake-bti/cpp:*",
+ "//sdk/lib/driver/fake-resource/cpp:*",
+ ]
public_deps = [
"//sdk/lib/fdio",
"//zircon/system/ulib/zx",
]
-
- public_configs = [ "//sdk/config" ]
}
test("fake_object_test") {
- testonly = true
- output_name = "fake_object_test"
sources = [
"fake-object-test.cc",
"internal.h",
]
-
deps = [
":cpp",
"//zircon/system/ulib/zxtest",
@@ -48,5 +69,11 @@
}
fuchsia_unittest_package("fake_object_test_package") {
+ package_name = "fake_object_test_package-gn"
+ component_name = "fake_object_test_package"
deps = [ ":fake_object_test" ]
+ visibility = [
+ ":*",
+ "//sdk/lib:*",
+ ]
}