[unification] Move //zircon/system/dev/block/fvm to the GN build

Generated with: //scripts/unification/move_zn_element.py

scripts/unification/verify_element_move.py --reference local/initial.json:

Warning   aux     size change for test/sys/fvm-driver-unittests-test: -10% (108.0K)
Warning   aux     size change for test/sys/fvm-driver-integration-test: -4% (124.0K)
Error     aux     shared library removed from test/sys/fvm-driver-unittests-test: libdriver.so
Error     aux     shared library added to test/sys/fvm-driver-unittests-test: libasync-default.so
Error     aux     shared library removed from test/sys/fvm-driver-integration-test: libdriver.so
Warning   aux     shared library added to test/sys/fvm-driver-integration-test: libc++abi.so.1
Error     aux     shared library added to test/sys/fvm-driver-integration-test: libdriver-integration-test.so
Error     image   size change for driver/fvm.so: -14% (93.7K)
Warning   tests   size change for test/sys/fvm-driver-unittests-test: -10% (108.0K)
Warning   tests   size change for test/sys/fvm-driver-integration-test: -4% (124.0K)
Error     tests   shared library removed from test/sys/fvm-driver-unittests-test: libdriver.so
Error     tests   shared library added to test/sys/fvm-driver-unittests-test: libasync-default.so
Error     tests   shared library removed from test/sys/fvm-driver-integration-test: libdriver.so
Warning   tests   shared library added to test/sys/fvm-driver-integration-test: libc++abi.so.1
Error     tests   shared library added to test/sys/fvm-driver-integration-test: libdriver-integration-test.so

Bug: 36139
Change-Id: I9e18f40a6a292222088fcbceb9bb6f718e684973
diff --git a/build/unification/images/BUILD.gn b/build/unification/images/BUILD.gn
index 9a72575..e57c69c 100644
--- a/build/unification/images/BUILD.gn
+++ b/build/unification/images/BUILD.gn
@@ -183,7 +183,6 @@
     ":driver.ftdi",
     ":driver.ftdi-fake-usb",
     ":driver.ftl",
-    ":driver.fvm",
     ":driver.fx3",
     ":driver.gauss-pdm-input",
     ":driver.gauss-tdm",
@@ -572,8 +571,6 @@
     ":test.sys.ftl-integration-test",
     ":test.sys.ftl-lib-test",
     ":test.sys.ftl-test",
-    ":test.sys.fvm-driver-integration-test",
-    ":test.sys.fvm-driver-unittests-test",
     ":test.sys.fvm-test",
     ":test.sys.fvm-unit-test",
     ":test.sys.fzl-test",
@@ -1022,8 +1019,6 @@
     ":test.sys.ftl-integration-test",
     ":test.sys.ftl-lib-test",
     ":test.sys.ftl-test",
-    ":test.sys.fvm-driver-integration-test",
-    ":test.sys.fvm-driver-unittests-test",
     ":test.sys.fvm-test",
     ":test.sys.fvm-unit-test",
     ":test.sys.fzl-test",
@@ -1377,7 +1372,7 @@
     #":driver.ftdi",
     #":driver.ftdi-fake-usb",
     #":driver.ftl",
-    #":driver.fvm",
+    "//zircon/system/dev/block/fvm:fvm-manifest",
     #":driver.fx3",
     #":driver.gauss-pdm-input",
     #":driver.gauss-tdm",
@@ -2042,8 +2037,8 @@
     #":test.sys.ftl-lib-test",
     #":test.sys.ftl-test",
     "//zircon/system/utest/futex-ownership:futex-ownership-manifest",
-    #":test.sys.fvm-driver-integration-test",
-    #":test.sys.fvm-driver-unittests-test",
+    "//zircon/system/dev/block/fvm/test/integration:fvm-driver-integration-manifest",
+    "//zircon/system/dev/block/fvm/test:fvm-driver-unittests-manifest",
     #":test.sys.fvm-test",
     #":test.sys.fvm-unit-test",
     #":test.sys.fzl-test",
@@ -2493,8 +2488,8 @@
     #":test.sys.ftl-lib-test",
     #":test.sys.ftl-test",
     "//zircon/system/utest/futex-ownership:futex-ownership-manifest",
-    #":test.sys.fvm-driver-integration-test",
-    #":test.sys.fvm-driver-unittests-test",
+    "//zircon/system/dev/block/fvm/test/integration:fvm-driver-integration-manifest",
+    "//zircon/system/dev/block/fvm/test:fvm-driver-unittests-manifest",
     #":test.sys.fvm-test",
     #":test.sys.fvm-unit-test",
     #":test.sys.fzl-test",
diff --git a/zircon/system/dev/block/BUILD.gn b/zircon/system/dev/block/BUILD.gn
index d245ab0..95f9acc 100644
--- a/zircon/system/dev/block/BUILD.gn
+++ b/zircon/system/dev/block/BUILD.gn
@@ -9,7 +9,6 @@
     "as370-sdhci",
     "bootpart",
     "ftl",
-    "fvm",
     "gpt",
     "hisi-ufs",
     "mbr",
diff --git a/zircon/system/dev/block/fvm/BUILD.gn b/zircon/system/dev/block/fvm/BUILD.gn
index df34c99..89c82de 100644
--- a/zircon/system/dev/block/fvm/BUILD.gn
+++ b/zircon/system/dev/block/fvm/BUILD.gn
@@ -2,16 +2,35 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-zx_driver("fvm") {
-  deps = [ ":shared" ]
+##########################################
+# Though under //zircon, this build file #
+# is meant to be used in the Fuchsia GN  #
+# build.                                 #
+# See fxb/36139.                         #
+##########################################
 
-  # TODO(ZX-2863): This driver violates the allowed shlib deps policy.
-  deprecated_inhibit_driver_shlib_allowlist = true
+assert(!defined(zx) || zx != "/",
+       "This file can only be used in the Fuchsia GN build.")
+
+import("//build/config/fuchsia/rules.gni")
+import("//build/unification/images/migrated_manifest.gni")
+
+driver_module("fvm") {
+  defines = [ "_ALL_SOURCE" ]
+  configs += [ "//build/config/fuchsia:enable_zircon_asserts" ]
+  configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ]
+  configs += [ "//build/config/fuchsia:static_cpp_standard_library" ]
+  configs += [ "//build/unification/config:zircon-migrated" ]
+  deps = [
+    ":shared",
+    "//src/devices:driver",
+  ]
 }
 
 # Also used by test/.
 source_set("shared") {
   visibility = [ "./*" ]
+  defines = [ "_ALL_SOURCE" ]
   sources = [
     "fvm.c",
     "fvm.cc",
@@ -19,25 +38,28 @@
     "vpartition.cc",
   ]
   public_deps = [
-    "$zx/system/banjo/ddk.protocol.block",
-    "$zx/system/banjo/ddk.protocol.block.partition",
-    "$zx/system/banjo/ddk.protocol.block.volume",
-    "$zx/system/fidl/fuchsia-hardware-block:c",
-    "$zx/system/fidl/fuchsia-hardware-block-partition:c",
-    "$zx/system/fidl/fuchsia-hardware-block-volume:c",
-    "$zx/system/ulib/ddk",
-    "$zx/system/ulib/ddktl",
-    "$zx/system/ulib/digest",
-    "$zx/system/ulib/fbl",
-    "$zx/system/ulib/fidl-utils",
-    "$zx/system/ulib/fs",
-    "$zx/system/ulib/fvm",
-    "$zx/system/ulib/fzl",
-    "$zx/system/ulib/gpt",
-    "$zx/system/ulib/sync",
-    "$zx/system/ulib/zircon",
-    "$zx/system/ulib/zircon-internal",
-    "$zx/system/ulib/zx",
-    "$zx/third_party/ulib/uboringssl",
+    "//zircon/public/lib/ddk",
+    "//zircon/public/lib/ddktl",
+    "//zircon/public/lib/digest",
+    "//zircon/public/lib/fbl",
+    "//zircon/public/lib/fidl-utils",
+    "//zircon/public/lib/fs",
+    "//zircon/public/lib/fvm",
+    "//zircon/public/lib/fzl",
+    "//zircon/public/lib/gpt",
+    "//zircon/public/lib/sync",
+    "//zircon/public/lib/boringssl",
+    "//zircon/public/lib/zircon-internal",
+    "//zircon/public/lib/zx",
+    "//zircon/system/banjo/ddk.protocol.block",
+    "//zircon/system/banjo/ddk.protocol.block.partition",
+    "//zircon/system/banjo/ddk.protocol.block.volume",
+    "//zircon/system/fidl/fuchsia-hardware-block:c",
+    "//zircon/system/fidl/fuchsia-hardware-block-partition:c",
+    "//zircon/system/fidl/fuchsia-hardware-block-volume:c",
   ]
 }
+
+migrated_manifest("fvm-manifest") {
+  deps = [ ":fvm" ]
+}
diff --git a/zircon/system/dev/block/fvm/test/BUILD.gn b/zircon/system/dev/block/fvm/test/BUILD.gn
index 5d5aa28..3baf4c1 100644
--- a/zircon/system/dev/block/fvm/test/BUILD.gn
+++ b/zircon/system/dev/block/fvm/test/BUILD.gn
@@ -2,23 +2,36 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-group("test") {
-  testonly = true
-  deps = [
-    ":fvm-driver-unittests",
-    "integration:test",
-  ]
-}
+##########################################
+# Though under //zircon, this build file #
+# is meant to be used in the Fuchsia GN  #
+# build.                                 #
+# See fxb/36139.                         #
+##########################################
 
-zx_test("fvm-driver-unittests") {
+assert(!defined(zx) || zx != "/",
+       "This file can only be used in the Fuchsia GN build.")
+
+import("//build/test.gni")
+import("//build/unification/images/migrated_manifest.gni")
+
+test("fvm-driver-unittests") {
+  # Dependent manifests unfortunately cannot be marked as `testonly`.
+  # Remove when converting this file to proper GN build idioms.
+  testonly = false
+  configs += [ "//build/unification/config:zircon-migrated" ]
   sources = [
     "block-device-test.cc",
     "slice-extent-test.cc",
   ]
   include_dirs = [ ".." ]
   deps = [
-    "$zx/system/dev/block/fvm:shared",
-    "$zx/system/ulib/driver",
-    "$zx/system/ulib/zxtest",
+    "//zircon/public/lib/fake_ddk",
+    "//zircon/public/lib/zxtest",
+    "//zircon/system/dev/block/fvm:shared",
   ]
 }
+
+migrated_manifest("fvm-driver-unittests-manifest") {
+  deps = [ ":fvm-driver-unittests" ]
+}
diff --git a/zircon/system/dev/block/fvm/test/integration/BUILD.gn b/zircon/system/dev/block/fvm/test/integration/BUILD.gn
index d9912f3..459cdbf 100644
--- a/zircon/system/dev/block/fvm/test/integration/BUILD.gn
+++ b/zircon/system/dev/block/fvm/test/integration/BUILD.gn
@@ -2,22 +2,38 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-group("test") {
-  testonly = true
-  deps = [ ":fvm-driver-integration" ]
-}
+##########################################
+# Though under //zircon, this build file #
+# is meant to be used in the Fuchsia GN  #
+# build.                                 #
+# See fxb/36139.                         #
+##########################################
 
-zx_test("fvm-driver-integration") {
+assert(!defined(zx) || zx != "/",
+       "This file can only be used in the Fuchsia GN build.")
+
+import("//build/test.gni")
+import("//build/unification/images/migrated_manifest.gni")
+
+test("fvm-driver-integration") {
+  # Dependent manifests unfortunately cannot be marked as `testonly`.
+  # Remove when converting this file to proper GN build idioms.
+  testonly = false
+  configs += [ "//build/unification/config:zircon-migrated" ]
   sources = [ "volume_manager_api_test.cc" ]
   include_dirs = [ ".." ]
   deps = [
-    "$zx/system/dev/block/fvm:shared",
-    "$zx/system/fidl/fuchsia-hardware-block-volume:llcpp",
-    "$zx/system/ulib/devmgr-integration-test",
-    "$zx/system/ulib/devmgr-launcher",
-    "$zx/system/ulib/driver",
-    "$zx/system/ulib/fvm",
-    "$zx/system/ulib/fvm/test:devices",
-    "$zx/system/ulib/zxtest",
+    "//zircon/public/lib/devmgr-integration-test",
+    "//zircon/public/lib/devmgr-launcher",
+    "//zircon/public/lib/fake_ddk",
+    "//zircon/public/lib/fvm",
+    "//zircon/public/lib/fvm-devices",
+    "//zircon/public/lib/zxtest",
+    "//zircon/system/dev/block/fvm:shared",
+    "//zircon/system/fidl/fuchsia-hardware-block-volume:llcpp",
   ]
 }
+
+migrated_manifest("fvm-driver-integration-manifest") {
+  deps = [ ":fvm-driver-integration" ]
+}
diff --git a/zircon/system/ulib/BUILD.gn b/zircon/system/ulib/BUILD.gn
index 944c814..bbf3166 100644
--- a/zircon/system/ulib/BUILD.gn
+++ b/zircon/system/ulib/BUILD.gn
@@ -79,6 +79,7 @@
     "fs/transaction",
     "ftl",
     "fvm",
+    "fvm/test:fvm-devices",
     "fzl",
     "gfx",
     "gfx-font-data",
diff --git a/zircon/system/ulib/digest/BUILD.gn b/zircon/system/ulib/digest/BUILD.gn
index 5cd683a..4e9b86f 100644
--- a/zircon/system/ulib/digest/BUILD.gn
+++ b/zircon/system/ulib/digest/BUILD.gn
@@ -5,9 +5,9 @@
 zx_library("digest") {
   sdk = "source"
   sdk_headers = [
+    "digest/digest.h",
     "digest/hash-list.h",
     "digest/merkle-tree.h",
-    "digest/digest.h",
     "digest/node-digest.h",
   ]
   host = true
@@ -21,6 +21,6 @@
 
   deps = [
     "$zx/system/ulib/fbl",
-    "$zx/third_party/ulib/uboringssl",
+    "$zx/third_party/ulib/boringssl",
   ]
 }
diff --git a/zircon/system/ulib/fs-management/BUILD.gn b/zircon/system/ulib/fs-management/BUILD.gn
index 1071ce6..4e1f437 100644
--- a/zircon/system/ulib/fs-management/BUILD.gn
+++ b/zircon/system/ulib/fs-management/BUILD.gn
@@ -37,7 +37,7 @@
     "$zx/system/ulib/gpt",
     "$zx/system/ulib/pretty",
     "$zx/system/ulib/zx",
-    "$zx/third_party/ulib/uboringssl",
+    "$zx/third_party/ulib/boringssl",
   ]
   configs += [ "$zx_build/public/gn/config:static-libc++" ]
 
diff --git a/zircon/system/ulib/fvm-host/BUILD.gn b/zircon/system/ulib/fvm-host/BUILD.gn
index 73e1bd6..b224bb0 100644
--- a/zircon/system/ulib/fvm-host/BUILD.gn
+++ b/zircon/system/ulib/fvm-host/BUILD.gn
@@ -51,6 +51,6 @@
     "$zx/third_party/ulib/cksum",
     "$zx/third_party/ulib/lz4",
     "$zx/third_party/ulib/safemath",
-    "$zx/third_party/ulib/uboringssl",
+    "$zx/third_party/ulib/boringssl",
   ]
 }
diff --git a/zircon/system/ulib/fvm/BUILD.gn b/zircon/system/ulib/fvm/BUILD.gn
index aecfdb2..a3c4423 100644
--- a/zircon/system/ulib/fvm/BUILD.gn
+++ b/zircon/system/ulib/fvm/BUILD.gn
@@ -23,7 +23,7 @@
     "$zx/system/ulib/fbl",
     "$zx/system/ulib/fit",
     "$zx/third_party/ulib/lz4",
-    "$zx/third_party/ulib/uboringssl",
+    "$zx/third_party/ulib/boringssl",
   ]
   public_deps = [
     # <fvm/fvm.h> has #include <digest/digest.h>.
diff --git a/zircon/system/ulib/fvm/test/BUILD.gn b/zircon/system/ulib/fvm/test/BUILD.gn
index cef7b3c..2cda749 100644
--- a/zircon/system/ulib/fvm/test/BUILD.gn
+++ b/zircon/system/ulib/fvm/test/BUILD.gn
@@ -29,9 +29,9 @@
   }
 }
 
-zx_library("devices") {
-  sdk = "source"
-  sdk_headers = [ "fvm/test/device-ref.h" ]
+zx_library("fvm-devices") {
+   sdk = "source"
+   sdk_headers = [ "fvm/test/device-ref.h" ]
   testonly = true
   sources = [ "device-ref.cc" ]
   public_deps = [
diff --git a/zircon/system/ulib/fvm/test/device-ref.cc b/zircon/system/ulib/fvm/test/device-ref.cc
index e9dde6f..ffce924 100644
--- a/zircon/system/ulib/fvm/test/device-ref.cc
+++ b/zircon/system/ulib/fvm/test/device-ref.cc
@@ -62,10 +62,6 @@
   return status;
 }
 
-fidl::BytePart ToBytePart(fbl::Array<uint8_t>* message) {
-  return fidl::BytePart(message->data(), static_cast<uint32_t>(message->size()));
-}
-
 fidl::VectorView<uint8_t> ToFidlVector(const fbl::Array<uint8_t>& data) {
   return fidl::VectorView<uint8_t>(const_cast<uint8_t*>(data.data()), data.size());
 }
diff --git a/zircon/system/utest/BUILD.gn b/zircon/system/utest/BUILD.gn
index bbc4f28..05f3c0c 100644
--- a/zircon/system/utest/BUILD.gn
+++ b/zircon/system/utest/BUILD.gn
@@ -35,7 +35,6 @@
       "$zx/system/dev/block/ahci:ahci-unittest",
       "$zx/system/dev/block/aml-sd-emmc:aml-sd-emmc-test",
       "$zx/system/dev/block/ftl/test",
-      "$zx/system/dev/block/fvm/test",
       "$zx/system/dev/block/gpt:gpt-device-test",
       "$zx/system/dev/block/mbr:mbr-test",
       "$zx/system/dev/block/mtk-sdmmc:mtk-sdmmc-test",
diff --git a/zircon/system/utest/fvm/BUILD.gn b/zircon/system/utest/fvm/BUILD.gn
index 59c6a88..d5c3d44 100644
--- a/zircon/system/utest/fvm/BUILD.gn
+++ b/zircon/system/utest/fvm/BUILD.gn
@@ -29,7 +29,7 @@
     "$zx/system/ulib/fs",
     "$zx/system/ulib/fs-management",
     "$zx/system/ulib/fvm",
-    "$zx/system/ulib/fvm/test:devices",
+    "$zx/system/ulib/fvm/test:fvm-devices",
     "$zx/system/ulib/fzl",
     "$zx/system/ulib/gpt",
     "$zx/system/ulib/memfs",
@@ -43,7 +43,7 @@
     "$zx/system/ulib/zx",
     "$zx/system/ulib/zxtest",
     "$zx/third_party/ulib/cksum",
-    "$zx/third_party/ulib/uboringssl",
+    "$zx/third_party/ulib/boringssl",
   ]
 }
 
@@ -53,7 +53,7 @@
   deps = [
     "$zx/system/ulib/devmgr-integration-test",
     "$zx/system/ulib/devmgr-launcher",
-    "$zx/system/ulib/fvm/test:devices",
+    "$zx/system/ulib/fvm/test:fvm-devices",
     "$zx/system/ulib/zxtest",
   ]
 }