Refactor webrtc/modules/audio_processing for GN check

This moves some GN check configurations out of .gn to individual targets.
The now checked target is:
"//webrtc/modules/audio_processing/*",

BUG=webrtc:6828
NOTRY=True
R=kjellander@webrtc.org

Review-Url: https://codereview.webrtc.org/2558813003
Cr-Commit-Position: refs/heads/master@{#15475}
diff --git a/.gn b/.gn
index c44ccc8..cdb8794 100644
--- a/.gn
+++ b/.gn
@@ -27,6 +27,7 @@
   "//webrtc/modules/audio_coding/*",
   "//webrtc/modules/audio_device/*",
   "//webrtc/modules/audio_mixer/*",
+  "//webrtc/modules/audio_processing/*",
   "//webrtc/stats:rtc_stats",
   "//webrtc/voice_engine",
   "//webrtc/voice_engine:level_indicator",
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 86d5c21..7a64845 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -228,42 +228,6 @@
 
   return result
 
-def _CheckNoRtcBaseDeps(input_api, gn_files, output_api):
-  pattern = input_api.re.compile(r'base:rtc_base\s*"')
-  violating_files = []
-  for f in gn_files:
-    gn_exceptions = (
-        os.path.join('audio_device', 'BUILD.gn'),
-        os.path.join('base_tests', 'BUILD.gn'),
-        os.path.join('desktop_capture', 'BUILD.gn'),
-        os.path.join('p2p', 'BUILD.gn'),
-        os.path.join('sdk', 'BUILD.gn'),
-        os.path.join('webrtc_test_common', 'BUILD.gn'),
-        os.path.join('webrtc_tests', 'BUILD.gn'),
-
-        # TODO(ehmaldonado): Clean up references to rtc_base in these files.
-        # See https://bugs.chromium.org/p/webrtc/issues/detail?id=3806
-        os.path.join('webrtc', 'BUILD.gn'),
-        os.path.join('xmllite', 'BUILD.gn'),
-        os.path.join('xmpp', 'BUILD.gn'),
-        os.path.join('modules', 'BUILD.gn'),
-        os.path.join('audio_device', 'BUILD.gn'),
-        os.path.join('pc', 'BUILD.gn'),
-    )
-    if f.LocalPath().endswith(gn_exceptions):
-      continue
-    contents = input_api.ReadFile(f)
-    if pattern.search(contents):
-      violating_files.append(f)
-  if violating_files:
-    return [output_api.PresubmitError(
-        'Depending on rtc_base is not allowed. Change your dependency to '
-        'rtc_base_approved and possibly sanitize and move the desired source '
-        'file(s) to rtc_base_approved.\nChanged GN files:',
-        items=violating_files)]
-  return []
-
-
 def _CheckNoSourcesAbove(input_api, gn_files, output_api):
   # Disallow referencing source files with paths above the GN file location.
   source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]',
@@ -332,7 +296,6 @@
 
   result = []
   if gn_files:
-    result.extend(_CheckNoRtcBaseDeps(input_api, gn_files, output_api))
     result.extend(_CheckNoSourcesAbove(input_api, gn_files, output_api))
     result.extend(_CheckNoMixingCAndCCSources(input_api, gn_files, output_api))
   return result
diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn
index 5ba9f3e..6ad7775 100644
--- a/webrtc/modules/audio_processing/BUILD.gn
+++ b/webrtc/modules/audio_processing/BUILD.gn
@@ -161,6 +161,7 @@
   deps = [
     "../..:webrtc_common",
     "../../audio/utility:audio_frame_operations",
+    "../../base:gtest_prod",
     "../audio_coding:isac",
   ]
   public_deps = [
@@ -265,6 +266,7 @@
   }
 
   deps = [
+    "../..:webrtc_common",
     "../../base:rtc_base_approved",
     "../../common_audio",
     "../../system_wrappers",
@@ -283,6 +285,10 @@
 
 if (current_cpu == "x86" || current_cpu == "x64") {
   rtc_static_library("audio_processing_sse2") {
+    # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
+    # Errors on cyclic dependency with :audio_processing if enabled.
+    check_includes = false
+
     sources = [
       "aec/aec_core_sse2.cc",
       "utility/ooura_fft_sse2.cc",
@@ -303,6 +309,10 @@
 
 if (rtc_build_with_neon) {
   rtc_static_library("audio_processing_neon") {
+    # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
+    # Errors on cyclic dependency with :audio_processing if enabled.
+    check_includes = false
+
     sources = [
       "aec/aec_core_neon.cc",
       "aecm/aecm_core_neon.cc",
@@ -362,6 +372,10 @@
         "-ffat-lto-objects",
       ]
     }
+    deps = [
+      ":audio_processing_c",
+      "../../base:rtc_base_approved",
+    ]
   }
 }
 
@@ -397,6 +411,8 @@
       ":audioproc_debug_proto",
       ":audioproc_protobuf_utils",
       ":audioproc_test_utils",
+      "../..:webrtc_common",
+      "../../base:rtc_base_approved",
       "../../common_audio",
       "../../system_wrappers:system_wrappers_default",
       "//third_party/gflags:gflags",
@@ -420,6 +436,8 @@
       ":audioproc_debug_proto",
       ":audioproc_protobuf_utils",
       ":audioproc_test_utils",
+      "../../base:rtc_base_approved",
+      "../../common_audio:common_audio",
       "../../system_wrappers",
       "../../system_wrappers:system_wrappers_default",
       "../../test:test_support",
@@ -442,8 +460,10 @@
     ]
 
     deps = [
+      ":audio_processing",
       "../../base:rtc_base_approved",
       "../../common_audio",
+      "../../system_wrappers:system_wrappers",
     ]
   }
 
@@ -456,7 +476,10 @@
     ]
     deps = [
       ":audio_processing",
+      "../..:webrtc_common",
+      "../../common_audio:common_audio",
       "../../system_wrappers:metrics_default",
+      "../../system_wrappers:system_wrappers",
       "../../test:test_support",
       "//testing/gtest",
       "//third_party/gflags",
@@ -472,7 +495,9 @@
     ]
     deps = [
       ":audio_processing",
+      "../..:webrtc_common",
       "../../system_wrappers:metrics_default",
+      "../../system_wrappers:system_wrappers",
     ]
   }
 
@@ -484,6 +509,8 @@
     deps = [
       ":audio_processing",
       ":audioproc_test_utils",
+      "../../base:rtc_base_approved",
+      "../../common_audio:common_audio",
       "../../system_wrappers:metrics_default",
       "//third_party/gflags",
     ]
@@ -522,6 +549,8 @@
 
       deps = [
         ":audioproc_debug_proto",
+        "../..:webrtc_common",
+        "../../base:rtc_base_approved",
       ]
     }
   }