Enable GN check for webrtc/{p2p,system_wrappers}

Introduce new small header-only targets in system_wrappers:
:cpu_features_api
:field_trial_api
:metrics_api
to untangle and optimize dependencies but still satisfy GN check.

In webrtc/p2p, previously uncovered header "base/fakecandidatepair.h"
is added to :p2p_test_utils target.

Refactor system_wrappers so 'rtc_p2p' can depend on only
system_wrappers:field_trial_api instead of all of system_wrappers
(which led to a breakage in Chromium that called for the revert of
https://codereview.webrtc.org/2735583002).

BUG=webrtc:6828
NOTRY=True

Review-Url: https://codereview.webrtc.org/2739863002
Cr-Commit-Position: refs/heads/master@{#17812}
This commit is contained in:
kjellander 2017-04-21 05:17:08 -07:00 committed by Commit bot
parent 9a660ce9dc
commit 8a11663219
5 changed files with 86 additions and 10 deletions

2
.gn
View File

@ -33,8 +33,10 @@ check_targets = [
"//webrtc/media/*",
"//webrtc/modules/*",
"//webrtc/ortc/*",
"//webrtc/p2p/*",
"//webrtc/sdk/*",
"//webrtc/stats/*",
"//webrtc/system_wrappers/*",
"//webrtc/tools/*",
"//webrtc/test/*",
"//webrtc/voice_engine/*",

View File

@ -35,7 +35,9 @@ rtc_source_set("call_api") {
}
rtc_static_library("libjingle_peerconnection_api") {
check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
# Cannot have GN check enabled since that would introduce dependency cycles
# TODO(kjellander): Remove (bugs.webrtc.org/7504)
check_includes = false
cflags = []
sources = [
"datachannel.h",
@ -82,7 +84,18 @@ rtc_static_library("libjingle_peerconnection_api") {
deps = [
":rtc_stats_api",
"..:webrtc_common",
"../base:rtc_base",
"../base:rtc_base_approved",
"audio_codecs:audio_codecs_api",
]
# This is needed until bugs.webrtc.org/7504 is removed so this target can
# properly depend on ../media:rtc_media_base
# TODO(kjellander): Remove this dependency.
if (is_nacl) {
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
}
}
rtc_source_set("ortc_api") {

View File

@ -107,6 +107,10 @@ rtc_static_library("rtc_media_base") {
"../common_video:common_video",
"../p2p",
]
if (is_nacl) {
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
}
}
rtc_static_library("rtc_media") {

View File

@ -85,7 +85,10 @@ rtc_static_library("rtc_p2p") {
defines = []
deps = [
"../api:libjingle_peerconnection_api",
"../api:ortc_api",
"../base:rtc_base",
"../system_wrappers:field_trial_api",
]
if (rtc_build_expat) {
@ -145,6 +148,7 @@ if (rtc_include_tests) {
rtc_source_set("p2p_test_utils") {
testonly = true
sources = [
"base/fakecandidatepair.h",
"base/fakedtlstransport.h",
"base/fakeicetransport.h",
"base/fakepackettransport.h",
@ -155,16 +159,15 @@ if (rtc_include_tests) {
"base/teststunserver.h",
"base/testturnserver.h",
]
deps = [
":rtc_p2p",
"../api:ortc_api",
"../base:rtc_base",
"../base:rtc_base_approved",
"../base:rtc_base_tests_utils",
"../test:test_support",
"//testing/gmock",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("rtc_p2p_unittests") {
@ -205,6 +208,11 @@ if (rtc_include_tests) {
":p2p_test_utils",
":rtc_p2p",
"../api:fakemetricsobserver",
"../api:ortc_api",
"../base:rtc_base",
"../base:rtc_base_approved",
"../base:rtc_base_tests_utils",
"../test:test_support",
"//testing/gmock",
"//testing/gtest",
]
@ -228,6 +236,7 @@ rtc_static_library("libstunprober") {
}
deps = [
":rtc_p2p",
"..:webrtc_common",
"../base:rtc_base",
]
@ -241,6 +250,10 @@ if (rtc_include_tests) {
]
deps = [
":libstunprober",
":p2p_test_utils",
":rtc_p2p",
"../base:rtc_base",
"../base:rtc_base_tests_utils",
"//testing/gmock",
"//testing/gtest",
]

View File

@ -18,13 +18,10 @@ rtc_static_library("system_wrappers") {
"include/aligned_malloc.h",
"include/atomic32.h",
"include/clock.h",
"include/cpu_features_wrapper.h",
"include/cpu_info.h",
"include/event_wrapper.h",
"include/field_trial.h",
"include/file_wrapper.h",
"include/fix_interlocked_exchange_pointer_win.h",
"include/metrics.h",
"include/ntp_time.h",
"include/rtp_to_ntp_estimator.h",
"include/rw_lock_wrapper.h",
@ -64,6 +61,11 @@ rtc_static_library("system_wrappers") {
deps = [
"..:webrtc_common",
]
public_deps = [
":cpu_features_api",
":field_trial_api",
":metrics_api",
]
if (is_android) {
sources += [
@ -104,6 +106,11 @@ rtc_static_library("system_wrappers") {
libs += [ "winmm.lib" ]
cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
# Windows needs //webrtc/base:rtc_base due to include of webrtc/base/win32.h
# in source/clock.cc.
# TODO(kjellander): Remove (bugs.webrtc.org/6828)
deps += [ "../base:rtc_base" ]
}
if (is_win && is_clang) {
@ -114,11 +121,39 @@ rtc_static_library("system_wrappers") {
deps += [ "../base:rtc_base_approved" ]
}
rtc_source_set("cpu_features_api") {
sources = [
"include/cpu_features_wrapper.h",
]
deps = [
"..:webrtc_common",
]
}
rtc_source_set("field_trial_api") {
sources = [
"include/field_trial.h",
]
}
rtc_source_set("metrics_api") {
sources = [
"include/metrics.h",
]
deps = [
"..:webrtc_common",
"../base:rtc_base_approved",
]
}
rtc_static_library("field_trial_default") {
sources = [
"include/field_trial_default.h",
"source/field_trial_default.cc",
]
deps = [
":field_trial_api",
]
}
rtc_static_library("metrics_default") {
@ -126,6 +161,10 @@ rtc_static_library("metrics_default") {
"include/metrics_default.h",
"source/metrics_default.cc",
]
deps = [
":metrics_api",
"../base:rtc_base_approved",
]
}
group("system_wrappers_default") {
@ -153,6 +192,9 @@ if (is_linux) {
sources = [
"source/cpu_features_linux.c",
]
deps = [
":cpu_features_api",
]
}
}
@ -179,6 +221,8 @@ if (rtc_include_tests) {
deps = [
":metrics_default",
":system_wrappers",
"..:webrtc_common",
"../base:rtc_base_approved",
"../test:test_main",
"//testing/gtest",
]