Use checkdeps to ensure API headers don't include internal headers.
This CL updates the checkdeps configuration for the api/ folder in
order to explicitly avoid to #include non API headers from API headers.
In order to force a careful review of potential exceptions to this
rule, the CL also adds mbonadei@ and kwiberg@ as OWNERS of api/DEPS.
Bug: webrtc:9887
Change-Id: I0ada6f1020186b2782c7d060af36079c452ba1aa
Reviewed-on: https://webrtc-review.googlesource.com/c/106800
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25338}
diff --git a/api/DEPS b/api/DEPS
index cf10f55..1ed09d2 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -1,14 +1,51 @@
include_rules = [
- "+third_party/libyuv",
- "+media",
- "+p2p",
- "+pc",
- "+logging/rtc_event_log/rtc_event_log_factory_interface.h",
- "+modules/audio_processing/include",
- "+system_wrappers/include",
+ "-audio",
+ "-base",
+ "-build",
+ "-buildtools",
+ "-build_overrides",
+ "-call",
+ "-common_audio",
+ "-common_video",
+ "-data",
+ "-examples",
+ "-infra",
+ "-logging",
+ "-media",
+ "-modules",
+ "-out",
+ "-p2p",
+ "-pc",
+ "-resources",
+ "-rtc_base",
+ "-rtc_tools",
+ "-sdk",
+ "-stats",
+ "-style-guide",
+ "-system_wrappers",
+ "-test",
+ "-testing",
+ "-third_party",
+ "-tools",
+ "-tools_webrtc",
+ "-video",
+ "-external/webrtc/webrtc", # Android platform build.
+ "-libyuv",
+ "-common_types.h",
+ "-WebRTC",
]
specific_include_rules = {
+ # Some internal headers are allowed even in API headers:
+ ".*\.h": [
+ "+rtc_base/checks.h",
+ "+rtc_base/system/rtc_export.h",
+ ],
+
+ "array_view\.h": [
+ "+rtc_base/type_traits.h",
+ ],
+
# Needed because AudioEncoderOpus is in the wrong place for
# backwards compatibilty reasons. See
# https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
@@ -16,14 +53,259 @@
"+modules/audio_coding/codecs/opus/audio_encoder_opus.h",
],
+ "asyncresolverfactory\.h": [
+ "+rtc_base/asyncresolverinterface.h",
+ ],
+
+ "candidate\.h": [
+ "+rtc_base/network_constants.h",
+ "+rtc_base/socketaddress.h",
+ ],
+
+ "datachannelinterface\.h": [
+ "+rtc_base/copyonwritebuffer.h",
+ "+rtc_base/refcount.h",
+ ],
+
+ "dtmfsenderinterface\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "fec_controller\.h": [
+ "+modules/include/module_fec_types.h",
+ ],
+
+ "jsep\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "jsepicecandidate\.h": [
+ "+rtc_base/constructormagic.h",
+ ],
+
+ "jsepsessiondescription\.h": [
+ "+rtc_base/constructormagic.h",
+ ],
+
+ "mediastreaminterface\.h": [
+ "+modules/audio_processing/include/audio_processing_statistics.h",
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "peerconnectionfactoryproxy\.h": [
+ "+rtc_base/bind.h",
+ ],
+
+ "refcountedbase\.h": [
+ "+rtc_base/constructormagic.h",
+ "+rtc_base/refcount.h",
+ "+rtc_base/refcounter.h",
+ ],
+
+ "rtcerror\.h": [
+ "+rtc_base/logging.h",
+ ],
+
+ "rtpreceiverinterface\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "rtpsenderinterface\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "rtptransceiverinterface\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "setremotedescriptionobserverinterface\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "statstypes\.h": [
+ "+rtc_base/constructormagic.h",
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ "+rtc_base/stringencode.h",
+ "+rtc_base/thread_checker.h",
+ ],
+
+ "umametrics\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "audio_frame\.h": [
+ "+rtc_base/constructormagic.h",
+ ],
+
+ "audio_mixer\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "audio_decoder\.h": [
+ "+rtc_base/buffer.h",
+ "+rtc_base/constructormagic.h",
+ ],
+
+ "audio_decoder_factory\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "audio_decoder_factory_template\.h": [
+ "+rtc_base/refcountedobject.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "audio_encoder\.h": [
+ "+rtc_base/buffer.h",
+ "+rtc_base/deprecation.h",
+ ],
+
+ "audio_encoder_factory\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "audio_encoder_factory_template\.h": [
+ "+rtc_base/refcountedobject.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "builtin_audio_decoder_factory\.h": [
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "builtin_audio_encoder_factory\.h": [
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "framedecryptorinterface\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "frameencryptorinterface\.h": [
+ "+rtc_base/refcount.h",
+ ],
+
+ "ortcfactoryinterface\.h": [
+ "+rtc_base/network.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ "+rtc_base/thread.h",
+ ],
+
+ "udptransportinterface\.h": [
+ "+rtc_base/socketaddress.h",
+ ],
+
+ "rtcstatscollectorcallback\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "rtcstatsreport\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/refcountedobject.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "audioproc_float\.h": [
+ "+modules/audio_processing/include/audio_processing.h",
+ ],
+
+ "fake_frame_decryptor\.h": [
+ "+rtc_base/refcountedobject.h",
+ ],
+
+ "fake_frame_encryptor\.h": [
+ "+rtc_base/refcountedobject.h",
+ ],
+
+ "fakeconstraints\.h": [
+ "+rtc_base/stringencode.h",
+ ],
+
+ "mock.*\.h": [
+ "+test/gmock.h",
+ ],
+
+ "simulated_network\.h": [
+ "+rtc_base/criticalsection.h",
+ "+rtc_base/random.h",
+ "+rtc_base/thread_annotations.h",
+ ],
+
+ "test_dependency_factory\.h": [
+ "+rtc_base/thread_checker.h",
+ ],
+
+ "videocodec_test_fixture\.h": [
+ "+modules/video_coding/include/video_codec_interface.h"
+ ],
+
+ "data_rate\.h": [
+ "+rtc_base/numerics/safe_conversions.h",
+ ],
+
+ "data_size\.h": [
+ "+rtc_base/numerics/safe_conversions.h",
+ ],
+
+ "time_delta\.h": [
+ "+rtc_base/numerics/safe_conversions.h",
+ ],
+
+ "timestamp\.h": [
+ "+rtc_base/numerics/safe_conversions.h",
+ ],
+
+ "i010_buffer\.h": [
+ "+rtc_base/memory/aligned_malloc.h"
+ ],
+
+ "i420_buffer\.h": [
+ "+rtc_base/memory/aligned_malloc.h",
+ ],
+
+ "video_frame_buffer\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
+ "video_timing\.h": [
+ "+rtc_base/numerics/safe_conversions.h",
+ ],
+
+ "video_encoder_config\.h": [
+ "+rtc_base/refcount.h",
+ "+rtc_base/scoped_ref_ptr.h",
+ ],
+
# We allow .cc files in webrtc/api/ to #include a bunch of stuff
# that's off-limits for the .h files. That's because .h files leak
# their #includes to whoever's #including them, but .cc files do not
# since no one #includes them.
".*\.cc": [
- "+modules/audio_coding",
- "+modules/audio_processing",
- "+modules/video_coding",
- "+modules/congestion_controller",
+ "+audio",
+ "+call",
+ "+common_audio",
+ "+common_video",
+ "+examples",
+ "+logging",
+ "+media",
+ "+modules",
+ "+p2p",
+ "+pc",
+ "+rtc_base",
+ "+rtc_tools",
+ "+sdk",
+ "+stats",
+ "+system_wrappers",
+ "+test",
+ "+tools",
+ "+tools_webrtc",
+ "+video",
+ "+third_party",
],
}