enabling `gn check` on the whole WebRTC repo

BUG=webrtc:6828
NOTRY=True

Review-Url: https://codereview.webrtc.org/2918803002
Cr-Commit-Position: refs/heads/master@{#18390}
diff --git a/.gn b/.gn
index 70a0c3e..4046d94 100644
--- a/.gn
+++ b/.gn
@@ -20,28 +20,7 @@
 # matching these patterns (see "gn help label_pattern" for format) will have
 # their includes checked for proper dependencies when you run either
 # "gn check" or "gn gen --check".
-# TODO(kjellander): Keep adding paths to this list as work in webrtc:5589 is done.
-check_targets = [
-  "//webrtc/api/*",
-  "//webrtc/audio/*",
-  "//webrtc/base/*",
-  "//webrtc/call/*",
-  "//webrtc/common_video/*",
-  "//webrtc/common_audio/*",
-  "//webrtc/examples/*",
-  "//webrtc/logging/*",
-  "//webrtc/media/*",
-  "//webrtc/modules/*",
-  "//webrtc/ortc/*",
-  "//webrtc/p2p/*",
-  "//webrtc/sdk/*",
-  "//webrtc/stats/*",
-  "//webrtc/system_wrappers/*",
-  "//webrtc/test/*",
-  "//webrtc/tools/*",
-  "//webrtc/video/*",
-  "//webrtc/voice_engine/*",
-]
+check_targets = [ "//webrtc/*" ]
 
 # These are the list of GN files that run exec_script. This whitelist exists
 # to force additional review for new uses of exec_script, which is strongly
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index f8e0e8d..1a79a12 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -229,6 +229,12 @@
     "video_receive_stream.h",
     "video_send_stream.h",
   ]
+  deps = [
+    ":webrtc_common",
+    "api:transport_api",
+    "base:rtc_base_approved",
+    "common_video:common_video",
+  ]
 }
 
 # Contents of video_frame.h is moved from top-level down to common_video/.
@@ -349,6 +355,13 @@
 }
 
 rtc_static_library("webrtc_common") {
+  # TODO(mbonadei): Remove (bugs.webrtc.org/7745)
+  # Enabling GN check triggers cyclic dependency error:
+  # //webrtc:webrtc_common ->
+  # //webrtc/api:video_frame_api ->
+  # //webrtc/system_wrappers:system_wrappers ->
+  # //webrtc:webrtc_common
+  check_includes = false
   sources = [
     "common_types.cc",
     "common_types.h",
@@ -361,6 +374,9 @@
     # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
     suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
   }
+  deps = [
+    "base:rtc_base_approved",
+  ]
 }
 
 if (use_libfuzzer || use_drfuzz || use_afl) {
diff --git a/webrtc/pc/BUILD.gn b/webrtc/pc/BUILD.gn
index 4834850..10256ce 100644
--- a/webrtc/pc/BUILD.gn
+++ b/webrtc/pc/BUILD.gn
@@ -54,9 +54,14 @@
   ]
 
   deps = [
+    "..:webrtc_common",
     "../api:call_api",
+    "../api:libjingle_peerconnection_api",
+    "../api:ortc_api",
     "../base:rtc_base",
+    "../common_video:common_video",
     "../media",
+    "../p2p:rtc_p2p",
   ]
 
   if (rtc_build_libsrtp) {
@@ -142,12 +147,21 @@
 
   deps = [
     ":rtc_pc",
+    "..:webrtc_common",
     "../api:call_api",
     "../api:rtc_stats_api",
+    "../api/audio_codecs:builtin_audio_decoder_factory",
+    "../api/audio_codecs:builtin_audio_encoder_factory",
     "../api/video_codecs:video_codecs_api",
+    "../base:rtc_base",
+    "../base:rtc_base_approved",
     "../call",
+    "../logging:rtc_event_log_api",
     "../media",
+    "../modules/audio_device:audio_device",
+    "../p2p:rtc_p2p",
     "../stats",
+    "../system_wrappers:system_wrappers",
   ]
 
   public_deps = [
@@ -208,9 +222,15 @@
     deps = [
       ":libjingle_peerconnection",
       ":rtc_pc",
+      "../base:rtc_base",
+      "../base:rtc_base_approved",
       "../base:rtc_base_tests_main",
       "../base:rtc_base_tests_utils",
+      "../logging:rtc_event_log_api",
+      "../media:rtc_media_base",
       "../media:rtc_media_tests_utils",
+      "../p2p:p2p_test_utils",
+      "../p2p:rtc_p2p",
       "../system_wrappers:metrics_default",
     ]
 
@@ -245,7 +265,17 @@
 
     deps = [
       ":libjingle_peerconnection",
+      "..:webrtc_common",
+      "../api:libjingle_peerconnection_test_api",
+      "../api:rtc_stats_api",
+      "../base:rtc_base",
+      "../base:rtc_base_approved",
       "../base:rtc_base_tests_utils",
+      "../media:rtc_media",
+      "../media:rtc_media_tests_utils",
+      "../modules/audio_device:audio_device",
+      "../p2p:p2p_test_utils",
+      "../test:test_support",
       "//testing/gmock",
     ]