[unification] Move //zircon/system/core/pwrbtn-monitor to the GN build

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

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

Warning   image       size change for bin/pwrbtn-monitor: -6% (65.1K)

Bug: 36139
Change-Id: I346763d582fb9b49616790737c3941b473c51db9
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/377386
Commit-Queue: P.Y. Laligand <pylaligand@google.com>
Reviewed-by: Shai Barack <shayba@google.com>
diff --git a/build/unification/images/BUILD.gn b/build/unification/images/BUILD.gn
index 4e6afac..ffc65a0 100644
--- a/build/unification/images/BUILD.gn
+++ b/build/unification/images/BUILD.gn
@@ -85,7 +85,6 @@
 #------------------
 #------------------
 #------------------
-    ":bin.pwrbtn-monitor",
 #------------------
 #------------------
     ":bin.sh",
@@ -1258,7 +1257,7 @@
     "//zircon/system/core/ptysvc:ptysvc-manifest",
 #------------------
 #------------------
-    #":bin.pwrbtn-monitor",
+    "//zircon/system/core/pwrbtn-monitor:pwrbtn-monitor-manifest",
 #------------------
     "//zircon/system/uapp/run-vc:run-vc-manifest",
     "//zircon/system/uapp/runtests:runtests-manifest",
diff --git a/build/unification/zbi/BUILD.gn b/build/unification/zbi/BUILD.gn
index bb46016..577c057 100644
--- a/build/unification/zbi/BUILD.gn
+++ b/build/unification/zbi/BUILD.gn
@@ -78,7 +78,6 @@
 # Artifacts imported from the ZN build which may be added to ZBI tests.
 
 zbiables = [
-  "bin.pwrbtn-monitor",
   "bin.svchost",
   "driver.fragment",
   "driver.fragment.proxy",
diff --git a/zircon/system/core/BUILD.gn b/zircon/system/core/BUILD.gn
index 18859dd..6c9d730 100644
--- a/zircon/system/core/BUILD.gn
+++ b/zircon/system/core/BUILD.gn
@@ -7,7 +7,6 @@
     # TODO(bwb): depend on these from GN when build systems are unified. These are
     # data dependencies of devcoordinator
     "$zx/system/core/devmgr/fragment",
-    "$zx/system/core/pwrbtn-monitor",
     "$zx/system/core/svchost",
   ]
 }
diff --git a/zircon/system/core/bootsvc/test/BUILD.gn b/zircon/system/core/bootsvc/test/BUILD.gn
index dac1a0c..815887a 100644
--- a/zircon/system/core/bootsvc/test/BUILD.gn
+++ b/zircon/system/core/bootsvc/test/BUILD.gn
@@ -100,7 +100,7 @@
     "//zircon/system/core/netsvc:device-name-provider",
     "//zircon/system/core/miscsvc",
     "//zircon/system/core/netsvc",
-    "//build/unification/zbi:bin.pwrbtn-monitor-zbi",
+    "//zircon/system/core/pwrbtn-monitor",
     "//build/unification/zbi:bin.svchost-zbi",
     "//build/unification/zbi:driver.fragment-zbi",
     "//build/unification/zbi:driver.fragment.proxy-zbi",
diff --git a/zircon/system/core/pwrbtn-monitor/BUILD.gn b/zircon/system/core/pwrbtn-monitor/BUILD.gn
index 69df077..b4cf20b 100644
--- a/zircon/system/core/pwrbtn-monitor/BUILD.gn
+++ b/zircon/system/core/pwrbtn-monitor/BUILD.gn
@@ -2,17 +2,41 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-zx_executable("pwrbtn-monitor") {
+##########################################
+# Though under //zircon, this build file #
+# is meant to be used in the Fuchsia GN  #
+# build.                                 #
+# See fxb/36139.                         #
+##########################################
+
+assert(!defined(zx) || zx != "/",
+       "This file can only be used in the Fuchsia GN build.")
+
+import("//build/unification/images/migrated_manifest.gni")
+
+executable("pwrbtn-monitor") {
+  if (is_fuchsia) {
+    configs += [ "//build/unification/config:zircon-migrated" ]
+  }
+  if (is_fuchsia) {
+    fdio_config = [ "//build/config/fuchsia:fdio_config" ]
+    if (configs + fdio_config - fdio_config != configs) {
+      configs -= fdio_config
+    }
+  }
   sources = [ "pwrbtn-monitor.cc" ]
   deps = [
-    "$zx/system/fidl/fuchsia-device-manager:c",
-    "$zx/system/fidl/fuchsia-hardware-input:llcpp",
-    "$zx/system/ulib/ddk",
-    "$zx/system/ulib/fbl",
-    "$zx/system/ulib/fdio",
-    "$zx/system/ulib/fdio-caller",
-    "$zx/system/ulib/fzl",
-    "$zx/system/ulib/hid-parser",
-    "$zx/system/ulib/zircon",
+    "//zircon/public/lib/ddk",
+    "//zircon/public/lib/fbl",
+    "//zircon/public/lib/fdio",
+    "//zircon/public/lib/fdio-caller",
+    "//zircon/public/lib/fzl",
+    "//zircon/public/lib/hid-parser",
+    "//zircon/system/fidl/fuchsia-device-manager:c",
+    "//zircon/system/fidl/fuchsia-hardware-input:llcpp",
   ]
 }
+
+migrated_manifest("pwrbtn-monitor-manifest") {
+  deps = [ ":pwrbtn-monitor" ]
+}