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}
This commit is contained in:
ehmaldonado 2016-12-08 04:10:01 -08:00 committed by Commit bot
parent b0a111108b
commit 64c4a7ecfc
3 changed files with 30 additions and 37 deletions

1
.gn
View File

@ -27,6 +27,7 @@ check_targets = [
"//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",

View File

@ -228,42 +228,6 @@ def _CheckApprovedFilesLintClean(input_api, output_api,
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 @@ def _CheckGnChanges(input_api, output_api):
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

View File

@ -161,6 +161,7 @@ rtc_static_library("audio_processing") {
deps = [
"../..:webrtc_common",
"../../audio/utility:audio_frame_operations",
"../../base:gtest_prod",
"../audio_coding:isac",
]
public_deps = [
@ -265,6 +266,7 @@ rtc_source_set("audio_processing_c") {
}
deps = [
"../..:webrtc_common",
"../../base:rtc_base_approved",
"../../common_audio",
"../../system_wrappers",
@ -283,6 +285,10 @@ if (rtc_enable_protobuf) {
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 (current_cpu == "x86" || current_cpu == "x64") {
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 @@ if (rtc_build_with_neon) {
"-ffat-lto-objects",
]
}
deps = [
":audio_processing_c",
"../../base:rtc_base_approved",
]
}
}
@ -397,6 +411,8 @@ if (rtc_include_tests) {
":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 @@ if (rtc_include_tests) {
":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 @@ if (rtc_include_tests) {
]
deps = [
":audio_processing",
"../../base:rtc_base_approved",
"../../common_audio",
"../../system_wrappers:system_wrappers",
]
}
@ -456,7 +476,10 @@ if (rtc_include_tests) {
]
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 @@ if (rtc_include_tests) {
]
deps = [
":audio_processing",
"../..:webrtc_common",
"../../system_wrappers:metrics_default",
"../../system_wrappers:system_wrappers",
]
}
@ -484,6 +509,8 @@ if (rtc_include_tests) {
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 @@ if (rtc_include_tests) {
deps = [
":audioproc_debug_proto",
"../..:webrtc_common",
"../../base:rtc_base_approved",
]
}
}