[go: nahoru, domu]

Refactor //ios:all target in preparation of upstreaming.

Add temporary empty targets for each of the targets that will exists
upstream one the upstreaming process is complete.

Add "all_tests" targets for each directory that will contains test
targets, and change //ios:all to depend on them instead of depending
on the individual test targets.

Move ios_chrome_unittests target definition from ios/chrome/BUILD.gn
to ios/chrome/test/BUILD.gn.

BUG=None

Review-Url: https://codereview.chromium.org/2570523002
Cr-Commit-Position: refs/heads/master@{#438789}
diff --git a/ios/BUILD.gn b/ios/BUILD.gn
index 3284952..737f82c 100644
--- a/ios/BUILD.gn
+++ b/ios/BUILD.gn
@@ -26,21 +26,25 @@
     ]
   } else {
     deps = [
-      "//ios/chrome:ios_chrome_unittests",
-      "//ios/chrome/app",
-      "//ios/chrome/common",
-      "//ios/chrome/common/physical_web",
+      # List all the targets that need to be build on iOS by default.
+      "//ios/chrome/app:chrome",
+      "//ios/chrome/app:chrome_clean_skeleton",
+      "//ios/showcase",
+      "//ios/web/shell:ios_web_shell",
+
+      # List all the test targets that need to be build on iOS by default.
+      "//ios/chrome/test:all_tests",
+      "//ios/chrome/test/earl_grey:all_tests",
+      "//ios/net:all_tests",
+      "//ios/showcase/test:all_tests",
+      "//ios/testing:all_tests",
+      "//ios/web:all_tests",
+      "//ios/web/shell/test:all_tests",
+
+      # Those dependencies are currently only used from downstream code
+      # and will be removed once the dependent code has been upstreamed.
       "//ios/chrome/share_extension:packed_resources",
       "//ios/chrome/today_extension:packed_resources",
-      "//ios/net:ios_net_unittests",
-      "//ios/public/provider/chrome/browser",
-      "//ios/testing:ocmock_support_unittest",
-      "//ios/third_party/earl_grey",
-      "//ios/web:earl_grey_test_support",
-      "//ios/web:ios_web_inttests",
-      "//ios/web:ios_web_unittests",
-      "//ios/web/shell:ios_web_shell",
-      "//ios/web/shell/test:ios_web_shell_egtests",
     ]
   }
 }
diff --git a/ios/chrome/BUILD.gn b/ios/chrome/BUILD.gn
deleted file mode 100644
index 89c1953..0000000
--- a/ios/chrome/BUILD.gn
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2015 The Chromium 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("//ios/build/config.gni")
-import("//ios/public/provider/chrome/browser/build_config.gni")
-import("//testing/test.gni")
-
-test("ios_chrome_unittests") {
-  deps = [
-    # Ensure that all unit tests are run and packed resources available.
-    "//ios/chrome/test:run_all_unittests",
-    ios_packed_resources_target,
-
-    # Add unit_tests target here.
-    "//ios/chrome/app:unit_tests",
-    "//ios/chrome/app/application_delegate:unit_tests",
-    "//ios/chrome/browser:unit_tests",
-    "//ios/chrome/browser/browsing_data:unit_tests",
-    "//ios/chrome/browser/device_sharing:unit_tests",
-    "//ios/chrome/browser/favicon:unit_tests",
-    "//ios/chrome/browser/geolocation:unit_tests",
-    "//ios/chrome/browser/itunes_links:unit_tests",
-    "//ios/chrome/browser/metrics:unit_tests",
-    "//ios/chrome/browser/native_app_launcher:unit_tests",
-    "//ios/chrome/browser/net:unit_tests",
-    "//ios/chrome/browser/omaha:unit_tests",
-    "//ios/chrome/browser/passwords:unit_tests",
-    "//ios/chrome/browser/reading_list:unit_tests",
-    "//ios/chrome/browser/signin:unit_tests",
-    "//ios/chrome/browser/snapshots:unit_tests",
-    "//ios/chrome/browser/ssl:unit_tests",
-    "//ios/chrome/browser/suggestions:unit_tests",
-    "//ios/chrome/browser/sync:unit_tests",
-    "//ios/chrome/browser/translate:unit_tests",
-    "//ios/chrome/browser/u2f:unit_tests",
-    "//ios/chrome/browser/ui:unit_tests",
-    "//ios/chrome/browser/ui/alert_coordinator:unit_tests",
-    "//ios/chrome/browser/ui/commands:unit_tests",
-    "//ios/chrome/browser/ui/context_menu:unit_tests",
-    "//ios/chrome/browser/ui/dialogs:unit_tests",
-    "//ios/chrome/browser/ui/elements:unit_tests",
-    "//ios/chrome/browser/ui/keyboard:unit_tests",
-    "//ios/chrome/browser/ui/voice:unit_tests",
-    "//ios/chrome/browser/update_client:unit_tests",
-    "//ios/chrome/browser/upgrade:unit_tests",
-    "//ios/chrome/browser/voice:unit_tests",
-    "//ios/chrome/browser/web:unit_tests",
-    "//ios/chrome/browser/web_resource:unit_tests",
-    "//ios/chrome/common:unit_tests",
-    "//ios/chrome/test:unit_tests",
-    "//ios/chrome/test/base:unit_tests",
-    "//ios/web/public/image_fetcher:unit_tests",
-  ]
-
-  assert_no_deps = ios_assert_no_deps
-}
diff --git a/ios/chrome/app/BUILD.gn b/ios/chrome/app/BUILD.gn
index 8f522fc..aba8cac 100644
--- a/ios/chrome/app/BUILD.gn
+++ b/ios/chrome/app/BUILD.gn
@@ -7,6 +7,18 @@
 import("//ios/build/chrome_build.gni")
 import("//ios/public/provider/chrome/browser/build_config.gni")
 
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("chrome") {
+}
+
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("chrome_clean_skeleton") {
+}
+
 source_set("app") {
   sources = [
     "deferred_initialization_runner.h",
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn
index 3281242..127dd9b 100644
--- a/ios/chrome/test/BUILD.gn
+++ b/ios/chrome/test/BUILD.gn
@@ -2,6 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//ios/build/config.gni")
+import("//ios/public/provider/chrome/browser/build_config.gni")
+import("//testing/test.gni")
+
+group("all_tests") {
+  testonly = true
+  deps = [
+    ":ios_chrome_unittests",
+  ]
+}
+
 source_set("test_support") {
   testonly = true
   sources = [
@@ -62,3 +73,51 @@
     "//third_party/google_toolbox_for_mac",
   ]
 }
+
+test("ios_chrome_unittests") {
+  deps = [
+    # Ensure that all unit tests are run and packed resources available.
+    ":run_all_unittests",
+    ios_packed_resources_target,
+
+    # Add unit_tests target here.
+    ":unit_tests",
+    "//ios/chrome/app:unit_tests",
+    "//ios/chrome/app/application_delegate:unit_tests",
+    "//ios/chrome/browser:unit_tests",
+    "//ios/chrome/browser/browsing_data:unit_tests",
+    "//ios/chrome/browser/device_sharing:unit_tests",
+    "//ios/chrome/browser/favicon:unit_tests",
+    "//ios/chrome/browser/geolocation:unit_tests",
+    "//ios/chrome/browser/itunes_links:unit_tests",
+    "//ios/chrome/browser/metrics:unit_tests",
+    "//ios/chrome/browser/native_app_launcher:unit_tests",
+    "//ios/chrome/browser/net:unit_tests",
+    "//ios/chrome/browser/passwords:unit_tests",
+    "//ios/chrome/browser/reading_list:unit_tests",
+    "//ios/chrome/browser/signin:unit_tests",
+    "//ios/chrome/browser/snapshots:unit_tests",
+    "//ios/chrome/browser/ssl:unit_tests",
+    "//ios/chrome/browser/suggestions:unit_tests",
+    "//ios/chrome/browser/sync:unit_tests",
+    "//ios/chrome/browser/translate:unit_tests",
+    "//ios/chrome/browser/u2f:unit_tests",
+    "//ios/chrome/browser/ui:unit_tests",
+    "//ios/chrome/browser/ui/alert_coordinator:unit_tests",
+    "//ios/chrome/browser/ui/commands:unit_tests",
+    "//ios/chrome/browser/ui/context_menu:unit_tests",
+    "//ios/chrome/browser/ui/dialogs:unit_tests",
+    "//ios/chrome/browser/ui/elements:unit_tests",
+    "//ios/chrome/browser/ui/keyboard:unit_tests",
+    "//ios/chrome/browser/ui/voice:unit_tests",
+    "//ios/chrome/browser/update_client:unit_tests",
+    "//ios/chrome/browser/voice:unit_tests",
+    "//ios/chrome/browser/web:unit_tests",
+    "//ios/chrome/browser/web_resource:unit_tests",
+    "//ios/chrome/common:unit_tests",
+    "//ios/chrome/test/base:unit_tests",
+    "//ios/web/public/image_fetcher:unit_tests",
+  ]
+
+  assert_no_deps = ios_assert_no_deps
+}
diff --git a/ios/chrome/test/earl_grey/BUILD.gn b/ios/chrome/test/earl_grey/BUILD.gn
new file mode 100644
index 0000000..f05c0ec
--- /dev/null
+++ b/ios/chrome/test/earl_grey/BUILD.gn
@@ -0,0 +1,10 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("all_tests") {
+  testonly = true
+}
diff --git a/ios/net/BUILD.gn b/ios/net/BUILD.gn
index be401ba..eef3248 100644
--- a/ios/net/BUILD.gn
+++ b/ios/net/BUILD.gn
@@ -6,6 +6,13 @@
 import("//testing/test.gni")
 import("//url/features.gni")
 
+group("all_tests") {
+  testonly = true
+  deps = [
+    ":ios_net_unittests",
+  ]
+}
+
 source_set("net") {
   deps = [
     "//base",
diff --git a/ios/showcase/BUILD.gn b/ios/showcase/BUILD.gn
new file mode 100644
index 0000000..65bb326
--- /dev/null
+++ b/ios/showcase/BUILD.gn
@@ -0,0 +1,9 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("showcase") {
+}
diff --git a/ios/showcase/test/BUILD.gn b/ios/showcase/test/BUILD.gn
new file mode 100644
index 0000000..f05c0ec
--- /dev/null
+++ b/ios/showcase/test/BUILD.gn
@@ -0,0 +1,10 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("all_tests") {
+  testonly = true
+}
diff --git a/ios/test/BUILD.gn b/ios/test/BUILD.gn
new file mode 100644
index 0000000..f05c0ec
--- /dev/null
+++ b/ios/test/BUILD.gn
@@ -0,0 +1,10 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This empty target is there to help with upstreaming by removing a manual
+# step from the process (updating the //ios:all target). It will be changed
+# to a real target as part of upstreaming.
+group("all_tests") {
+  testonly = true
+}
diff --git a/ios/testing/BUILD.gn b/ios/testing/BUILD.gn
index 3ad58c9..4a526f0 100644
--- a/ios/testing/BUILD.gn
+++ b/ios/testing/BUILD.gn
@@ -5,6 +5,13 @@
 import("//ios/build/config.gni")
 import("//testing/test.gni")
 
+group("all_tests") {
+  testonly = true
+  deps = [
+    ":ocmock_support_unittest",
+  ]
+}
+
 source_set("ios_test_support") {
   configs += [ "//build/config/compiler:enable_arc" ]
   testonly = true
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn
index 85ad7ce..dc98486 100644
--- a/ios/web/BUILD.gn
+++ b/ios/web/BUILD.gn
@@ -7,6 +7,14 @@
 import("//testing/test.gni")
 import("//tools/grit/grit_rule.gni")
 
+group("all_tests") {
+  testonly = true
+  deps = [
+    ":ios_web_inttests",
+    ":ios_web_unittests",
+  ]
+}
+
 source_set("web_arc") {
   deps = [
     ":core",
diff --git a/ios/web/shell/test/BUILD.gn b/ios/web/shell/test/BUILD.gn
index 150b03a..93534ca 100644
--- a/ios/web/shell/test/BUILD.gn
+++ b/ios/web/shell/test/BUILD.gn
@@ -5,6 +5,13 @@
 import("//ios/build/config.gni")
 import("//ios/third_party/earl_grey/ios_eg_test.gni")
 
+group("all_tests") {
+  testonly = true
+  deps = [
+    ":ios_web_shell_egtests",
+  ]
+}
+
 ios_eg_test("ios_web_shell_egtests") {
   sources = [
     "context_menu_egtest.mm",
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index a28333f..1904a63 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -518,7 +518,7 @@
     "type": "windowed_test_launcher",
   },
   "ios_chrome_unittests": {
-    "label": "//ios/chrome:ios_chrome_unittests",
+    "label": "//ios/chrome/test:ios_chrome_unittests",
     "type": "raw",
     "args": [],
   },