[build] Migrate to new package templates

Previously I thought we were going to delete //third_party/re2, but
there was a request to delay that change. In order to respect this
request without delaying the package() deprecation (almost done!) I'm
sending this migration change.

Change-Id: I8ba512630d630b634abb5ca7ff33f52987bcf7c6
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/re2/+/523620
Reviewed-by: Tom Bergan <tombergan@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 0e4ecc1..b65fde4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.
 
-import("//build/package.gni")
+import("//build/components.gni")
 
 config("re2_config") {
   include_dirs = [ "." ]
@@ -131,6 +131,10 @@
   configs += [ ":re2_warnings" ]
 }
 
+fuchsia_unittest_component("re2_tests_bin_component") {
+  deps = [ ":re2_tests_bin" ]
+}
+
 executable("re2_slow_tests") {
   testonly = true
   sources = [
@@ -149,6 +153,10 @@
   configs += [ ":re2_warnings" ]
 }
 
+fuchsia_unittest_component("re2_slow_tests_component") {
+  deps = [ ":re2_slow_tests" ]
+}
+
 source_set("benchmark") {
   testonly = true
   sources = [
@@ -172,25 +180,14 @@
   ]
 }
 
-package("re2_tests") {
-  testonly = true
+fuchsia_unittest_component("regexp_benchmark_component") {
+  deps = [ ":regexp_benchmark" ]
+}
+
+fuchsia_test_package("re2_tests") {
   deps = [
-    ":re2_slow_tests",
-    ":re2_tests_bin",
-    ":regexp_benchmark",
-  ]
-
-  binaries = [
-    {
-      name = "re2_tests"
-    },
-
-    {
-      name = "re2_slow_tests"
-    },
-
-    {
-      name = "regexp_benchmark"
-    },
+    ":re2_slow_tests_component",
+    ":re2_tests_bin_component",
+    ":regexp_benchmark_component",
   ]
 }