virtual-usb-printer: migarte the package to use GN

TEST=See the change this CL depends on.
BUG=chromium:953642

Cq-Depend: chromium:1621232
Change-Id: I4d224d24448fc86c558d30e24489ccac83e8fc1a
Reviewed-on: https://chromium-review.googlesource.com/1621584
Commit-Ready: Keigo Oka <oka@chromium.org>
Tested-by: Keigo Oka <oka@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Reviewed-by: Keigo Oka <oka@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..80a589f
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,100 @@
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//common-mk/pkg_config.gni")
+
+group("all") {
+  deps = [
+    ":virtual-usb-printer",
+  ]
+  if (use.test) {
+    deps += [
+      ":ipp-util-testrunner",
+      ":load-config-testrunner",
+      ":smart-buffer-testrunner",
+    ]
+  }
+}
+
+pkg_config("target_defaults") {
+  pkg_deps = [
+    "libbrillo-${libbase_ver}",
+    "libchrome-${libbase_ver}",
+  ]
+}
+
+executable("virtual-usb-printer") {
+  configs += [ ":target_defaults" ]
+  sources = [
+    "cups_constants.cc",
+    "device_descriptors.cc",
+    "ipp_util.cc",
+    "load_config.cc",
+    "op_commands.cc",
+    "server.cc",
+    "smart_buffer.cc",
+    "usb_printer.cc",
+    "usbip.cc",
+    "value_util.cc",
+    "virtual_usb_printer.cc",
+  ]
+}
+
+if (use.test) {
+  pkg_config("test_config") {
+    pkg_deps = [ "libchrome-test-${libbase_ver}" ]
+  }
+
+  executable("ipp-util-testrunner") {
+    # TODO(oka); Remove //common-mk:test by making testrunner to public_config //common-mk:test
+    configs += [
+      "//common-mk:test",
+      ":target_defaults",
+      ":test_config",
+    ]
+    sources = [
+      "cups_constants.cc",
+      "ipp_test.cc",
+      "ipp_util.cc",
+      "smart_buffer.cc",
+      "value_util.cc",
+    ]
+    deps = [
+      "//common-mk/testrunner",
+    ]
+  }
+
+  executable("smart-buffer-testrunner") {
+    configs += [
+      "//common-mk:test",
+      ":target_defaults",
+      ":test_config",
+    ]
+    sources = [
+      "smart_buffer.cc",
+      "smart_buffer_test.cc",
+      "value_util.cc",
+    ]
+    deps = [
+      "//common-mk/testrunner",
+    ]
+  }
+
+  executable("load-config-testrunner") {
+    configs += [
+      "//common-mk:test",
+      ":target_defaults",
+      ":test_config",
+    ]
+    sources = [
+      "device_descriptors.cc",
+      "load_config.cc",
+      "load_config_test.cc",
+      "value_util.cc",
+    ]
+    deps = [
+      "//common-mk/testrunner",
+    ]
+  }
+}
diff --git a/virtual_usb_printer.gyp b/virtual_usb_printer.gyp
deleted file mode 100644
index 4eb5d40..0000000
--- a/virtual_usb_printer.gyp
+++ /dev/null
@@ -1,89 +0,0 @@
-{
-  'target_defaults': {
-    'variables': {
-      'deps': [
-        'libbrillo-<(libbase_ver)',
-        'libchrome-<(libbase_ver)',
-      ],
-    },
-  },
-  'targets': [
-    {
-      'target_name': 'virtual-usb-printer',
-      'type': 'executable',
-      'sources': [
-        'cups_constants.cc',
-        'device_descriptors.cc',
-        'ipp_util.cc',
-        'load_config.cc',
-        'op_commands.cc',
-        'server.cc',
-        'smart_buffer.cc',
-        'usbip.cc',
-        'usb_printer.cc',
-        'value_util.cc',
-        'virtual_usb_printer.cc',
-      ],
-    },
-  ],
-  'conditions': [
-    ['USE_test == 1', {
-      'targets': [
-        {
-          'target_name': 'ipp-util-testrunner',
-          'type': 'executable',
-          'dependencies': [
-            '../../platform2/common-mk/testrunner.gyp:testrunner',
-          ],
-          'variables': {
-            'deps': [
-              'libchrome-test-<(libbase_ver)',
-            ],
-          },
-          'sources': [
-            'cups_constants.cc',
-            'ipp_util.cc',
-            'ipp_test.cc',
-            'smart_buffer.cc',
-            'value_util.cc',
-          ],
-        },
-        {
-          'target_name': 'smart-buffer-testrunner',
-          'type': 'executable',
-          'dependencies': [
-            '../../platform2/common-mk/testrunner.gyp:testrunner',
-          ],
-          'variables': {
-            'deps': [
-              'libchrome-test-<(libbase_ver)',
-            ],
-          },
-          'sources': [
-            'smart_buffer.cc',
-            'smart_buffer_test.cc',
-            'value_util.cc',
-          ],
-        },
-        {
-          'target_name': 'load-config-testrunner',
-          'type': 'executable',
-          'dependencies': [
-            '../../platform2/common-mk/testrunner.gyp:testrunner',
-          ],
-          'variables': {
-            'deps': [
-              'libchrome-test-<(libbase_ver)',
-            ],
-          },
-          'sources': [
-            'load_config.cc',
-            'load_config_test.cc',
-            'device_descriptors.cc',
-            'value_util.cc',
-          ],
-        },
-      ],
-    }],
-  ],
-}